[ 
https://issues.apache.org/jira/browse/CB-10654?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tony Homer updated CB-10654:
----------------------------
    Attachment: CB-10654.zip

The following example uses the attached project.
The project contains platorm-specific hooks in config.xml - it does not use 
hooks folder, see [the Cordova hooks 
guide|https://cordova.apache.org/docs/en/latest/guide/appdev/hooks/index.html#config.xml].
In the first case below, add the platforms from npm and the hooks run.
In the second case, add the platforms from repos and the hooks do not run.

{code}
[~/CB-10654]$ cordova platform add ios android
completed scripts/before_platform_add/ios/001_test.js
completed scripts/before_platform_add/android/001_test.js
Adding ios project...
...
Adding android project...
...
completed scripts/after_platform_add/ios/001_test.js
completed scripts/after_platform_add/android/001_test.js
{code}
{code}
[~CB-10654]$ cordova platform add 
https://github.com/apache/cordova-android#5.0.0 
https://github.com/apache/cordova-ios#4.0.1
git cloning: https://github.com/apache/cordova-android#5.0.0
Repository "https://github.com/apache/cordova-android"; checked out to git ref 
"5.0.0".
Adding android project...
..
git cloning: https://github.com/apache/cordova-ios#4.0.1
Repository "https://github.com/apache/cordova-ios"; checked out to git ref 
"4.0.1".
Adding ios project...
...
[~/CB-10654]$ 
{code}

> _platform_add hooks not executed when platform added from repo or directory
> ---------------------------------------------------------------------------
>
>                 Key: CB-10654
>                 URL: https://issues.apache.org/jira/browse/CB-10654
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaLib
>    Affects Versions: Master
>            Reporter: Tony Homer
>            Assignee: Tony Homer
>         Attachments: CB-10654.zip
>
>
> 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
> {code}
> <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>
> {code}
> 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
> # create a project with platform-specific hooks for before_platform_add 
> and/or after_platform_add defined in config.xml
> # add platform from npm, e.g.
> {code}
> cordova platform add android
> {code}
> # hooks get executed
> # add platform from repo or local dir, e.g.
> {code}
> cordova platform add https://github.com/apache/cordova-android
> cordova platform add my-local-copy-of-cordova-android
> {code}
> # hooks do not get executed



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to