Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11873

No plugins installed when running a prepare before a build in a gulp task.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 6.3.1
    • None
    • cordova-lib
    • None

    Description

      I use a gulp task for building, so I work directly with

      var cordova = require('cordova-lib').cordova;
      cordova.build({platforms: ['ios', 'android'], options: {}}, cb);

      Because of a check in cordova-lib/src/cordova/util.js, platforms need to be added before the project can be build, otherwise the error "No platforms added to this project..." is thrown.

      Since I always remove the contents of the platforms and plugins directories before building (I target multiple apps from the same codebase), I need to prepare the project before I can build, because of this check. This leads to a bug similar to CB-11519 and CB-11589, where plugins are never correctly installed.

      Unfortunately, I couldn't find the exact reason why platforms/ios/ios.json is missing the plugins when running a prepare immediately followed by a build. When the tasks are performed manually one after the other, everything works fine. I am waiting for the callback of prepare to be called, before the build task is started, but perhaps the prepare callback is called too early?

      Since the build function in cordova-lib/src/cordova/build.js already prepares the project (after calling preProcessOptions in util.js), it seems redundant to be forced to prepare the project before building.

      When the check I mentioned is not performed, a build with empty platforms and plugins directories works just fine: it saves one superfluous prepare task and, more importantly, plugins are correctly installed.

      My proposal: perhaps this check could be omitted when preProcessOptions is called from the build task?

      Attachments

        Activity

          People

            Unassigned Unassigned
            alexbuijs Alex Buijs
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: