-
Notifications
You must be signed in to change notification settings - Fork 984
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
Do not overwrite all targets with same id #545
Conversation
…th the old behavior it were not possible to add apple watch targets and build it because cordova bricked the bundleids for these targets. * Add new build parameter multipleProvisioningProfiles. Here the usage within the build.json: "multipleProvisioningProfiles": [ { "key": "de.demo.html5", "value": "DemoME-Enterprise" }, { "key": "de.demo.html5.watchkitapp", "value": "DemoWE-Enterprise" }, { "key": "de.demo.html5.watchkitapp.watchkitextension", "value": "DemoWE Extension-Enterprise" } ], This one is needed too otherwise the signing step fails because cordova generates a wrong bundleid to prov.profile mapping. With these settings the exportOptions.plist is written correctly for multiple targets. This patch is needed to make the apple watch targets work with the cordova-ios workflow (apple watch targets added within a post process scripts using npm xcode)
Link #538 |
@@ -42,6 +42,7 @@ var buildOpts = nopt({ | |||
'codeSignIdentity': String, | |||
'codeSignResourceRules': String, | |||
'provisioningProfile': String, | |||
'multipleProvisioningProfiles': Array, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should add a new property here for multipleProvisioningProfiles
vs changing the existing provisioningProfile
property to accept either a single string or an array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess thats a better approach - i will change that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to revert the idea - merging the two options do not work and require more refactoring. So I suggest to add this additional parameter which is only used for the export plist.
function updateBuildPropertyLocal(proj, displayName, prop, value, build) { | ||
try { | ||
// Check if we have a valid target - during prepare we do not have it | ||
var target = proj.pbxTargetByName(displayName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this definitely use the display name, and not the full name? In Cordova apps those are usually the same, but it's not guaranteed (and we provide a way to change the display name).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give me an example how to change the name - I will test that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In config.xml:
<name short="MyApp">My Full Application Name</name>
In that example, "MyApp"
would be the short name (which is what you're putting into the displayName
variable).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you were right - I have fixed the pbx target retrieval (tried both variants)
Codecov Report
@@ Coverage Diff @@
## master #545 +/- ##
==========================================
+ Coverage 74.75% 74.86% +0.11%
==========================================
Files 11 11
Lines 1822 1850 +28
==========================================
+ Hits 1362 1385 +23
- Misses 460 465 +5
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #545 +/- ##
==========================================
+ Coverage 74.19% 74.31% +0.11%
==========================================
Files 11 11
Lines 1829 1857 +28
==========================================
+ Hits 1357 1380 +23
- Misses 472 477 +5
Continue to review full report at Codecov.
|
So we are using the fork on a day by day basis everythinh working (with the embeded watch app). |
Maybe create a companion PR that adds some documentation on that at https://github.com/apache/cordova-docs/blob/master/www/docs/en/dev/guide/platforms/ios/index.md#signing-an-app (I guess?). |
# Conflicts: # bin/templates/scripts/cordova/lib/prepare.js
What's the state of this PR? I am encountering this issue as well. This PR solved the issue. |
A code review or a confirmation that this PR solves the issue would help us to merge this faster :) |
The problem with overwriting bundle ids is solved with this PR. My tests were successful. I am not sure if this change with I would split that in a seperate PR. |
The flag overwrites the correct profiles for the given bundle ids - I can build my app within the console without to open xcode. The value is name of the provision profile. |
The more I think about this, the more I feel like this is probably outside the scope of what Cordova should be handling. I'm hesitant to add this for several reasons:
|
@dpogue I can agree you with some points but have to disagree with others. I am with you that this change should be minimal to avoid breaking stuff and keep maintainance cost low. That's why I would suggest to simplify this PR and remove the provisioning profile stuff. I am happy to do and/or test this. Is this viable? But I would strongly argue to fix the core issue "Do not overwrite bundle ids". Cordova iOS 5 does not work for our app but 4.5.5 did before these changes. You are probably right that at some point projects with multiple targets grow out of the original scope of Cordova. But this can happen organically. Our app now has two plugins which add extensions, because we need those features. Switching to Capacitor is not an option at this point because of other design choices. Managing profiles and signing manually in Xcode is fine for me, but everything else should work with cordova build. That's why I want to fix the bundleid issue to make upgrading to cordova-ios 5 possible. |
I see your points - but overwriting existing profiles is a bug, I have combined it with a feature to automate profile settings. You could split this PR and extract the bug fix and remove the feature. best regards Murat |
Thanks Murat. I would like to see this bug fixed. I took you branch and removed the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I think too many things are changed at the same time in this proposal. It looks like @NiklasMerz made a nicer subset of the changes in PR [MAJOR] Do not overwrite all targets with same id (minimal) #708.
- Test cases would be needed.
- I would agree with the comments by @dpogue in Do not overwrite all targets with same id #545 (comment)
- I think changes to this extent should only be considered for a major release.
Thanks anyways for the contribution.
Closing this because of the reasons above and many conflicts. We need to address this differently. We should discuss more in the issue when time is ready. |
@NiklasMerz @msari-ipe-ext-1 is the multiple provisioning profile available in latest release of cordova-ios? I see that when using the fovea's openwith share extension the |
Prepare script update build properties for the main target only. Wi…th the old behavior it were not possible to add apple watch targets and build it because cordova bricked the bundleids for these targets.
Add new build parameter multipleProvisioningProfiles. Here the usage within the build.json:
This one is needed too otherwise the signing step fails because cordova generates a wrong bundleid to prov.profile mapping. With these settings the exportOptions.plist is written correctly for multiple targets.
This patch is needed to make the apple watch targets work with the cordova-ios workflow (apple watch targets added within a post process scripts using npm xcode)
Platforms affected
iOS
Motivation and Context
When cordova (using 5.0.0) projects contains watch targets (watchkit, watch extension) which have their own bundle id setup correctly, cordova overwrites all targets with the same id.
So the motivation is clear to have an hybrid app as watchos host without maintaining a manual created xcode project.
Description
See commit message
Testing
Tested against a real project with an watchos app.
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)