You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Kelvin Dart (JIRA)" <ji...@apache.org> on 2014/01/29 15:28:09 UTC

[jira] [Updated] (CB-5936) `cordova build` is not deleting the 'build' folder in platforms/ios

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

Kelvin Dart updated CB-5936:
----------------------------

    Description: 
It appears if `cordova build` doesn't execute properly a first time, then all subsequent times it does not finish with the desired behaviour. Let me be explain further and why I think this happens.

I started with a new project, first adding in a couple of cordova plugins (in order to replicate, it doesn't matter which). I then added in the iOS platform and performed `cordova build` which was fine and built as expected - all plugins installed fine.

I then altered a plugin and unbeknown to me at the time, I introduced an error to this plugin which meant a plugin could not compile (I was blindly coding at the time - silly of me, I know). Without knowing this, I executed `cordova build` again. It then failed, because presumably xcodebuild could not complete due to my source file which could not compile - and as a result, `cordova build` executed prematurely with an exit code something other than '0'. This is expected behaviour thus far.

So I altered my plugin, updated my project with the new plugin code and thought I was good to go again - I then executed `cordova build` again in order to fully build my Cordova project. The CLI said this executed fine, but in reality it did not since no plugins were loaded. I opened the ROOT 'config.xml' (i.e. one under the Xcode project, not in ‘www’) and the <feature> tags had not been added (and so the app did not run) which is the indicator to say which plugins are in your project.

After digging around, to fix this I had to remove 'build' in ./platforms/ios/ - then after executing `cordova build` again, it started building fine - and the <feature> tags were being added back in for each of my installed plugins.

After doing some investigation, I have found the issue why (and it should be a fairly quick fix). These are the steps (with using a broken plugin) to replicate
1) As part of `cordova build` I *think* the build script will copy the default cordova www to all platforms temporarily (i.e. the index.html with no plugins except LocalStorage) which includes the basic config.xml with no plugins.
2) This is then compiled with xcodebuild and as a result, the config.xml from the default www is copied to the Xcode project (remembering this is the basic ‘config.xml’ with no plugins).
3) It then attempts to compile this, but fails - and the basic config.xml is still there.
4) At some point, the ‘build’ folder is created in ./platforms/ios/ which contains a build of the cordova project.
5) `cordova build` fails.
6) Fix the broken plugin
7) Execute `cordova build` again and this is when the problem crops up.

If I delete the build folder, and re-execute `cordova build` then it works as expected and ‘config.xml’ populates fine.

After that extremely long-winded explanation, in short, I think `cordova build` needs to remove the ‘build’ folder as part of the cleanup step, as it seems to get some data from here - and if that contains a broken plugin, then it’s going to cause problems in future.

If you need further explanations, I’m happy to provide. I hope that makes sense!

  was:
It appears if `cordova build` doesn't execute properly a first time, then all subsequent times it does not finish with the desired behaviour. Let me be explain further and why I think this happens.

I started with a new project, first adding in a couple of cordova plugins (in order to replicate, it doesn't matter which). I then added in the iOS platform and performed `cordova build` which was fine and built as expected - all plugins installed fine.

I then altered a plugin and unbeknown to me at the time, I introduced an error to this plugin which meant a plugin could not compile (I was blindly coding at the time - silly of me, I know). Without knowing this, I executed `cordova build` again. It then failed, because presumably xcodebuild could not complete due to my source file which could not compile - and as a result, `cordova build` executed prematurely with an exit code something other than '0'. This is expected behaviour thus far.

So I altered my plugin, updated my project with the new plugin code and thought I was good to go again - I then executed `cordova build` again in order to fully build my Cordova project. The CLI said this executed fine, but in reality it did not since no plugins were loaded. I opened the ROOT 'config.xml' (i.e. one under the Xcode project, not in ‘www’) and the <feature> tags had not been added (and so the app did not run) which is the indicator to say which plugins are in your project.

After doing some investigation, I have found the issue why (and it should be a fairly quick fix). These are the steps (with using a broken plugin)
1) As part of `cordova build` I *think* the build script will copy the default cordova www to all platforms temporarily (i.e. the index.html with no plugins except LocalStorage) which includes the basic config.xml with no config.xml
2) This is then compiled with xcodebuild and as a result, the config.xml from the default www is copied to the Xcode project (remembering this is the basic ‘config.xml’ with no plugins).
3) It then attempts to compile this, but fails - and the basic config.xml is still there.
4) At some point, the ‘build’ folder is created in ./platforms/ios/ which contains a build of the cordova project.
5) `cordova build` fails.
6) Fix the broken plugin
7) Execute `cordova build` again and this is when the problem crops up.

If I delete the build folder, and re-execute `cordova build` then it works as expected and ‘config.xml’ populates fine.

After that extremely long-winded explanation, in short, I think `cordova build` needs to remove the ‘build’ folder as part of the cleanup step, as it seems to get some data from here - and if that contains a broken plugin, then it’s going to cause problems in future.

If you need further explanations, I’m happy to provide. I hope that makes sense!


> `cordova build` is not deleting the 'build' folder in platforms/ios
> -------------------------------------------------------------------
>
>                 Key: CB-5936
>                 URL: https://issues.apache.org/jira/browse/CB-5936
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CLI, iOS
>    Affects Versions: 3.3.0
>         Environment: Mavericks 10.9.1; Xcode 5; Cordova 3.3.1-0.1.2
>            Reporter: Kelvin Dart
>              Labels: build-failure, cordova, cordova-cli
>
> It appears if `cordova build` doesn't execute properly a first time, then all subsequent times it does not finish with the desired behaviour. Let me be explain further and why I think this happens.
> I started with a new project, first adding in a couple of cordova plugins (in order to replicate, it doesn't matter which). I then added in the iOS platform and performed `cordova build` which was fine and built as expected - all plugins installed fine.
> I then altered a plugin and unbeknown to me at the time, I introduced an error to this plugin which meant a plugin could not compile (I was blindly coding at the time - silly of me, I know). Without knowing this, I executed `cordova build` again. It then failed, because presumably xcodebuild could not complete due to my source file which could not compile - and as a result, `cordova build` executed prematurely with an exit code something other than '0'. This is expected behaviour thus far.
> So I altered my plugin, updated my project with the new plugin code and thought I was good to go again - I then executed `cordova build` again in order to fully build my Cordova project. The CLI said this executed fine, but in reality it did not since no plugins were loaded. I opened the ROOT 'config.xml' (i.e. one under the Xcode project, not in ‘www’) and the <feature> tags had not been added (and so the app did not run) which is the indicator to say which plugins are in your project.
> After digging around, to fix this I had to remove 'build' in ./platforms/ios/ - then after executing `cordova build` again, it started building fine - and the <feature> tags were being added back in for each of my installed plugins.
> After doing some investigation, I have found the issue why (and it should be a fairly quick fix). These are the steps (with using a broken plugin) to replicate
> 1) As part of `cordova build` I *think* the build script will copy the default cordova www to all platforms temporarily (i.e. the index.html with no plugins except LocalStorage) which includes the basic config.xml with no plugins.
> 2) This is then compiled with xcodebuild and as a result, the config.xml from the default www is copied to the Xcode project (remembering this is the basic ‘config.xml’ with no plugins).
> 3) It then attempts to compile this, but fails - and the basic config.xml is still there.
> 4) At some point, the ‘build’ folder is created in ./platforms/ios/ which contains a build of the cordova project.
> 5) `cordova build` fails.
> 6) Fix the broken plugin
> 7) Execute `cordova build` again and this is when the problem crops up.
> If I delete the build folder, and re-execute `cordova build` then it works as expected and ‘config.xml’ populates fine.
> After that extremely long-winded explanation, in short, I think `cordova build` needs to remove the ‘build’ folder as part of the cleanup step, as it seems to get some data from here - and if that contains a broken plugin, then it’s going to cause problems in future.
> If you need further explanations, I’m happy to provide. I hope that makes sense!



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)