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

Jay Proulx updated CB-8287:
---------------------------
    Description: 
before/after compile and/or build never fire when running via cordova cli.

expected behaviour: When running `cordova run <platform>` from the command 
line, we expect that a compile must occur before running.

actual behaviour: the compile and build hooks never actually fire, even though 
the build still happens.

test case:
{panel:title=Note about the below gist}
The gist executed below simply populates all of the known hooks in the hooks 
folder.  When a hook is executed it echos "#### HOOK: <hook_name>"
{panel}
{panel:title=Note about the sed expression below}
The hooks described above will output a pound sign at the beginning of the 
line, remove all lines not beginning with a # and any empty lines
{panel}

{code:title=testcase.sh}
#!/bin/bash
PLATFORM=ios

echo ----- Create a project -----
cordova create hello-world
echo ----- Enter the project hooks folder -----
cd hello-world/hooks
echo ----- Populate the hooks folder with all known hooks -----
bash <(curl -s 
https://gist.githubusercontent.com/jayproulx/214bfa61684a5c5f0cb9/raw/43048b2c5a66783719accabe1f15b1b2cbe159e2/create_hooks.sh)
echo ----- Return to the project root -----
cd ..
echo ----- Add a platform -----
cordova platform add $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
echo ----- Try building first -----
cordova build $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
echo ----- Then try running -----
cordova run $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
echo ----- Clean your platform -----
cordova platform remove $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
cordova platform add $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
echo ----- Then try running directly -----
cordova run $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
{code}

output:
{code}
jproulx-mbp-2:tmp jproulx$ ./testcase.sh 
----- Create a project -----
Creating a new cordova project with name "HelloCordova" and id 
"io.cordova.hellocordova" at location "/Users/jproulx/tmp/hello-world"
----- Enter the project hooks folder -----
----- Populate the hooks folder with all known hooks -----
----- Return to the project root -----
----- Add a platform -----
#### HOOK: before_platform_add
#### HOOK: before_prepare
#### HOOK: after_prepare
#### HOOK: after_platform_add
----- Try building first -----
#### HOOK: before_build
#### HOOK: before_prepare
#### HOOK: after_prepare
#### HOOK: before_compile
#### HOOK: after_compile
#### HOOK: after_build
----- Then try running -----
#### HOOK: before_run
#### HOOK: before_prepare
#### HOOK: after_prepare
No device is connected, trying Simulator.
2015-01-09 15:18:43.103 ios-sim[86821:3288011] stderrPath: 
/Users/jproulx/tmp/hello-world/platforms/ios/cordova/console.log
2015-01-09 15:18:43.104 ios-sim[86821:3288011] stdoutPath: 
/Users/jproulx/tmp/hello-world/platforms/ios/cordova/console.log
#### HOOK: after_run
----- Clean your platform -----
#### HOOK: before_platform_rm
#### HOOK: after_platform_rm
#### HOOK: before_platform_add
#### HOOK: before_prepare
#### HOOK: after_prepare
#### HOOK: after_platform_add
----- Then try running directly -----
#### HOOK: before_run
#### HOOK: before_prepare
#### HOOK: after_prepare
No device is connected, trying Simulator.
2015-01-09 15:18:54.362 ios-sim[87036:3288601] stderrPath: 
/Users/jproulx/tmp/hello-world/platforms/ios/cordova/console.log
2015-01-09 15:18:54.363 ios-sim[87036:3288601] stdoutPath: 
/Users/jproulx/tmp/hello-world/platforms/ios/cordova/console.log
#### HOOK: after_run
{code}

Note that (before|after)-compile only execute when running `cordova build ios`

  was:
before/after compile and/or build never fire when running via cordova cli.

expected behaviour: When running `cordova run <platform>` from the command 
line, we expect that a compile must occur before running.

actual behaviour: the compile and build hooks never actually fire, even though 
the build still happens.

test case:
{panel:title=Note about the below gist}
The gist executed below simply populates all of the known hooks in the hooks 
folder.  When a hook is executed it echos "#### HOOK: <hook_name>"
{panel}
{panel:title=Note about the sed expression below}
The hooks described above will output a pound sign at the beginning of the 
line, remove all lines not beginning with a # and any empty lines
{panel}

{code:title=testcase.sh}
#!/bin/bash
PLATFORM=ios

echo ----- Create a project -----
cordova create hello-world
echo ----- Enter the project hooks folder -----
cd hello-world/hooks
echo ----- Populate the hooks folder with all known hooks -----
bash <(curl -s 
https://gist.githubusercontent.com/jayproulx/214bfa61684a5c5f0cb9/raw/43048b2c5a66783719accabe1f15b1b2cbe159e2/create_hooks.sh)
echo ----- Return to the project root -----
cd ..
echo ----- Add a platform -----
cordova platform add $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
echo ----- Try building first -----
cordova build $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
echo ----- Then try running -----
cordova run $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
echo ----- Clean your platform -----
cordova platform remove $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
cordova platform add $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
echo ----- Then try running directly -----
cordova run $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
{code}

output:
{code}
jproulx-mbp-2:tmp jproulx$ ./testcase.sh 
----- Create a project -----
Creating a new cordova project with name "HelloCordova" and id 
"io.cordova.hellocordova" at location "/Users/jproulx/tmp/hello-world"
----- Enter the project hooks folder -----
----- Populate the hooks folder with all known hooks -----
----- Return to the project root -----
----- Add a platform -----
#### HOOK: before_platform_add
#### HOOK: before_prepare
#### HOOK: after_prepare
#### HOOK: after_platform_add
----- Try building first -----
#### HOOK: before_build
#### HOOK: before_prepare
#### HOOK: after_prepare
#### HOOK: before_compile
#### HOOK: after_compile
#### HOOK: after_build
----- Then try running -----
#### HOOK: before_run
#### HOOK: before_prepare
#### HOOK: after_prepare
No device is connected, trying Simulator.
2015-01-09 15:18:43.103 ios-sim[86821:3288011] stderrPath: 
/Users/jproulx/tmp/hello-world/platforms/ios/cordova/console.log
2015-01-09 15:18:43.104 ios-sim[86821:3288011] stdoutPath: 
/Users/jproulx/tmp/hello-world/platforms/ios/cordova/console.log
#### HOOK: after_run
----- Clean your platform -----
#### HOOK: before_platform_rm
#### HOOK: after_platform_rm
#### HOOK: before_platform_add
#### HOOK: before_prepare
#### HOOK: after_prepare
#### HOOK: after_platform_add
----- Then try running directly -----
#### HOOK: before_run
#### HOOK: before_prepare
#### HOOK: after_prepare
No device is connected, trying Simulator.
2015-01-09 15:18:54.362 ios-sim[87036:3288601] stderrPath: 
/Users/jproulx/tmp/hello-world/platforms/ios/cordova/console.log
2015-01-09 15:18:54.363 ios-sim[87036:3288601] stdoutPath: 
/Users/jproulx/tmp/hello-world/platforms/ios/cordova/console.log
#### HOOK: after_run
{code}


> Inconsistent hook execution order between build and run
> -------------------------------------------------------
>
>                 Key: CB-8287
>                 URL: https://issues.apache.org/jira/browse/CB-8287
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CLI
>    Affects Versions: 4.1.3
>         Environment: jproulx-mbp-2:hello-world jproulx$ sw_vers 
> -productVersion
> 10.10.1
> jproulx-mbp-2:hello-world jproulx$ xcodebuild -version
> Xcode 6.1.1
> Build version 6A2008a
> jproulx-mbp-2:hello-world jproulx$ cordova -v
> 4.1.2
> jproulx-mbp-2:hello-world jproulx$ phonegap -v
> 4.1.2-0.22.11
>            Reporter: Jay Proulx
>
> before/after compile and/or build never fire when running via cordova cli.
> expected behaviour: When running `cordova run <platform>` from the command 
> line, we expect that a compile must occur before running.
> actual behaviour: the compile and build hooks never actually fire, even 
> though the build still happens.
> test case:
> {panel:title=Note about the below gist}
> The gist executed below simply populates all of the known hooks in the hooks 
> folder.  When a hook is executed it echos "#### HOOK: <hook_name>"
> {panel}
> {panel:title=Note about the sed expression below}
> The hooks described above will output a pound sign at the beginning of the 
> line, remove all lines not beginning with a # and any empty lines
> {panel}
> {code:title=testcase.sh}
> #!/bin/bash
> PLATFORM=ios
> echo ----- Create a project -----
> cordova create hello-world
> echo ----- Enter the project hooks folder -----
> cd hello-world/hooks
> echo ----- Populate the hooks folder with all known hooks -----
> bash <(curl -s 
> https://gist.githubusercontent.com/jayproulx/214bfa61684a5c5f0cb9/raw/43048b2c5a66783719accabe1f15b1b2cbe159e2/create_hooks.sh)
> echo ----- Return to the project root -----
> cd ..
> echo ----- Add a platform -----
> cordova platform add $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
> echo ----- Try building first -----
> cordova build $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
> echo ----- Then try running -----
> cordova run $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
> echo ----- Clean your platform -----
> cordova platform remove $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
> cordova platform add $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
> echo ----- Then try running directly -----
> cordova run $PLATFORM -d | sed '/^[^#].*$/d;/^\s*$/d'
> {code}
> output:
> {code}
> jproulx-mbp-2:tmp jproulx$ ./testcase.sh 
> ----- Create a project -----
> Creating a new cordova project with name "HelloCordova" and id 
> "io.cordova.hellocordova" at location "/Users/jproulx/tmp/hello-world"
> ----- Enter the project hooks folder -----
> ----- Populate the hooks folder with all known hooks -----
> ----- Return to the project root -----
> ----- Add a platform -----
> #### HOOK: before_platform_add
> #### HOOK: before_prepare
> #### HOOK: after_prepare
> #### HOOK: after_platform_add
> ----- Try building first -----
> #### HOOK: before_build
> #### HOOK: before_prepare
> #### HOOK: after_prepare
> #### HOOK: before_compile
> #### HOOK: after_compile
> #### HOOK: after_build
> ----- Then try running -----
> #### HOOK: before_run
> #### HOOK: before_prepare
> #### HOOK: after_prepare
> No device is connected, trying Simulator.
> 2015-01-09 15:18:43.103 ios-sim[86821:3288011] stderrPath: 
> /Users/jproulx/tmp/hello-world/platforms/ios/cordova/console.log
> 2015-01-09 15:18:43.104 ios-sim[86821:3288011] stdoutPath: 
> /Users/jproulx/tmp/hello-world/platforms/ios/cordova/console.log
> #### HOOK: after_run
> ----- Clean your platform -----
> #### HOOK: before_platform_rm
> #### HOOK: after_platform_rm
> #### HOOK: before_platform_add
> #### HOOK: before_prepare
> #### HOOK: after_prepare
> #### HOOK: after_platform_add
> ----- Then try running directly -----
> #### HOOK: before_run
> #### HOOK: before_prepare
> #### HOOK: after_prepare
> No device is connected, trying Simulator.
> 2015-01-09 15:18:54.362 ios-sim[87036:3288601] stderrPath: 
> /Users/jproulx/tmp/hello-world/platforms/ios/cordova/console.log
> 2015-01-09 15:18:54.363 ios-sim[87036:3288601] stdoutPath: 
> /Users/jproulx/tmp/hello-world/platforms/ios/cordova/console.log
> #### HOOK: after_run
> {code}
> Note that (before|after)-compile only execute when running `cordova build ios`



--
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