[ 
https://issues.apache.org/jira/browse/CB-13112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16117720#comment-16117720
 ] 

Shazron Abdullah commented on CB-13112:
---------------------------------------

Found the culprit.

The project test fixture in the tests folder is really old and uses an older 
template with an older structure. When it is saved in the test fixture in the 
older structure, it is saved as it was specified 
"Resources/GoogleService-Info.plist". In the cordova-ios@4.4.0 pbxproj 
structure, it is stored as "GoogleServices-Info.plist", note that the prefix is 
lost. 

Why is this important? When saving a file reference to the project, it goes 
through {{node-xcode/pbxProject.js/hasFile}}, which returns true in the unit 
test with the older template structure (so no dupes) but it returns false in 
the cordova-ios@4.4.0 pbxproj structure, thus it will dupe. This is definitely 
not the problem of "hasFile" (the code is sound), but it's through 
{{node-xcode/pbxProject.js/addFileResource}} which strips off the {{Resource}} 
prefix in {{node-xcode/pbxProject.js/correctForResourcesPath}}. 

... and it turns out it is this: 
https://github.com/alunny/node-xcode/blob/59506f1cf9c74c180a1f830d5b9189a3cbba612e/lib/pbxProject.js#L1586
 ... where the old template structure's {{Resource}} group had no {{path}} at 
all.

Thus, the fix is to:
1. Update the unit test to use the new project structure (this may cause side 
effects to other unit tests, which we will have to fix)
2. Re-test the addFileResource tests, try to add duplicates
3. Fix the failing tests



> <resource-file> should not create a new file reference on each "cordova 
> prepare"
> --------------------------------------------------------------------------------
>
>                 Key: CB-13112
>                 URL: https://issues.apache.org/jira/browse/CB-13112
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-ios
>            Reporter: Shazron Abdullah
>            Assignee: Shazron Abdullah
>
> See 
> https://github.com/phonegap/phonegap-plugin-push/issues/1826#issuecomment-317750559
> Race condition is the result of multiple file references, which results in a 
> CopyPlistFile error.
> Only create one file reference, not multiples. 
> {code}
> cordova create foo
> cd foo
> cordova plugin add phonegap-plugin-push@2.0.0-rc4
> nano config.xml (add GoogleService-Info.plist file, see 
> https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/INSTALLATION.md#installation-requirements)
> cordova platform add ios
> cordova build ios
> {code} 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to