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

_platform_add hooks not executed when platform added from repo or directory

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersLinkUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

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

    Description

      platform-specific before_platform_add and after_platform_add hooks are not executed when platforms are added from directory or repo.
      e.g., hooks defined in config.xml as follows

      <platform name="android">
      <hook type="before_platform_add" src="scripts/before_platform_add/android/001_test.js" />
      <hook type="after_platform_add" src="scripts/after_platform_add/android/001_test.js" />
      </platform>
      

      This is because the matching logic in platform.js depends on the targets specified in command line arguments.
      It seems that the matching logic should be deferred until the platform can be determined via getPlatformDetailsFromDir.
      This would require that the before_platform_add hook not be executed until after the platform has been downloaded.

      Steps to reproduce

      1. create a project with platform-specific hooks for before_platform_add and/or after_platform_add defined in config.xml
      2. add platform from npm, e.g.
        cordova platform add android
        
      3. hooks get executed
      4. add platform from repo or local dir, e.g.
        cordova platform add https://github.com/apache/cordova-android
        cordova platform add my-local-copy-of-cordova-android
        
      5. hooks do not get executed

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            tony-- Tony Homer
            tony-- Tony Homer

            Dates

              Created:
              Updated:

              Slack

                Issue deployment