-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin wipes out cordova-plugin-add-swift-support configuration #108
Comments
I am unable to produce this issue with a simple test case - see this screencast. Can you provide a reproducible scenario in which this plugin will implicitly "wipe out" the configuration added by Unlike other plugins which have hard-coded custom configuration keys built into them (e.g. The intention of this plugin is that it allows advanced custom configuration of the native project files and hence its use is with the caveat that the user understands what they are modifying.
So, for example, if I were using
|
Ahh meant to post more info when I got it, the issue was that there was a preference in the config.xml called
but the plugin hook saw this as a XCBuildConfiguration property and modified the buildSettings values, wiping out any modifications from the swift plugin. If you add that pref with the swift plugin you should be able to see what im talking about when doing a platform rm, platform add, and prepare Since you cant know exactly how the Cordova CLI, or any other plugins or plugin hooks can modify project files now and in the future, the best thing would be to merge any of your custom config modifications with whats already in the value for buildSettings... so if I have SOME_PROP = "value" in the XCBuildConfiguration buildSettings, then that should also be present in the buildSettings after this plugins hook runs even if I have custom config from this plugin, or if some other plugin uses the prefix so in a nutshell...the hook is causing to wipe out other buildSettings values from the swift plugin, which is definitely something that should be addressed. Thanks! |
I'm unable to reproduce the issue by adding the preference However I can see that it would match the iOS preference regex, causing the plugin to read then write the The fact that this preference would cause the custom config plugin to read then write the This plugin returns a promise in order to block further execution in the Cordova hooks lifecycle until it has finished its operations. The swift plugin does not, so I think it's possible for the custom config plugin to be invoked before the swift plugin has written back its changes. I will attempt to reproduce this scenario and confirm whether this is the case.
This is simple to say, but not to implement, since merging existing values requires knowledge of the given key's value type, because depending on the field type, XCode uses different values or separators. And therefore is unlikely to be implemented any time soon. |
got ya, I think you are right about the concurrent file access. I was about to say when I originally wrote this hook, I never had any concurrent modification issues, however that was back before Cordova even allowed you to execute hooks async.. That makes me think that plugins that modify some of the main Cordova project files, such as Manifest, plist, or any Xcode project files, should prob do so synchronously to ensure there are no race conditions. That wouldnt really change much from an overall time perspective since the plugin reads all the files sync. |
yep, of course it could be this hook script that's causing the concurrency issue, but I'm reckoning, whatever the cause, that's looking like the issue here. I kind of hope it is this plugin/hook script causing the problem, cause then I can fix it :-) If it's internal to how Cordova is executing its hooks, that's more tricky... |
OK, leave this with me. It certainly warrants some looking at how this hook script is interacting with the filesystem. Will keep you posted with what I find. BTW sorry if I sound bitchy in comments above - been a long day :-) |
cool no worries! sounds good. |
OK, I think I've found and fixed the problem. Parsing the project.pbxproj file using the xcode module is async, therefore the promise was being resolved before the plugin had written the file to disk, creating the race condition we speculated existed. I've pushed this fix out in a patch release: |
awesome! I'll be able to confirm a little later (have to switch to a different laptop where the code is) but sounds good. Thanks! |
Pretty sure this issue is now fixed. Let me know if not and I'll reopen. |
Ahhh my bad forgot all about this. Sounds good thanks again!! |
The cordova-plugin-add-swift-support allows us to use legacy swift version 2.3, as well as consolidates Bridging-Header files from plugins into the projects Bridging-Header.h.
Its hook will add the following to the project.pbxproj for debug and release XCBuildConfiguration buildSettings when adding support for legacy swift.
This plugin will wipe out those values, when it should merge with them and overwrit if present, but not wipe out vlaues that arent defined for this plugin
The text was updated successfully, but these errors were encountered: