Skip to content
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

[MAJOR] Do not overwrite all targets with same id (minimal) #708

Closed
wants to merge 19 commits into from

Conversation

NiklasMerz
Copy link
Member

Platforms affected

iOS

Motivation and Context

This is a simplified version of #545 with the minimal changes to fix #538

Description

See discussion in #545

Testing

Manual tests with complex project

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

msari-ipe-ext-1 and others added 6 commits February 22, 2019 10:20
…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)
# Conflicts:
#	bin/templates/scripts/cordova/lib/prepare.js
@NiklasMerz NiklasMerz marked this pull request as ready for review November 5, 2019 09:30
@timbru31 timbru31 requested a review from dpogue November 5, 2019 15:51
@NiklasMerz
Copy link
Member Author

NiklasMerz commented Nov 6, 2019

I changed the the original PR that way that only the bundle id gets checked for the target. Other settings should be applied to other targets, too.

For my type of extensions this necessary. @msari-ipe-ext-1 Does this work for watch extensions?

@NiklasMerz
Copy link
Member Author

Would be great to get this and this apache/cordova-node-xcode#79 fixed for the next release. How can I help to get this ready?

@brodycj
Copy link
Contributor

brodycj commented Dec 16, 2019

Hi @NiklasMerz I may need some extra time to understand the history of issue #538, previous attempts such as #545, this proposal, and apache/cordova-node-xcode#79, before I am ready to answer your question. I would also like to point to the sustainability issue I raised in apache/cordova#163. Thanks for your understanding and thanks for your recent contributions!

@brodycj brodycj changed the title Do not overwrite all targets with same id (minimal) [MAJOR] Do not overwrite all targets with same id (minimal) Dec 16, 2019
@brodycj brodycj added this to the 6.0.0 milestone Dec 16, 2019
@brodycj
Copy link
Contributor

brodycj commented Dec 16, 2019

I added [MAJOR] to the title and set the milestone to the next major release (6.0.0), due to the risk of this change breaking something else.

Copy link
Contributor

@brodycj brodycj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I think test cases are needed to help ensure this functionality does not get broken in the future.
  • I think this change should be done in a major release due to the risk of breaking something, as I said in another comment.
  • I find the added code pretty hard to understand, wonder if there is anything we can do to make it easier to understand.
  • Use of the displayName variable name does not make sense to me. Please explain it and please consider changing it.

Please feel free to follow up on GitHub, mailing list, or Slack (see footer of cordova.io for contact information). As I said before and in apache/cordova#163, committers are overloaded due to resource issues.

@NiklasMerz
Copy link
Member Author

NiklasMerz commented Dec 16, 2019

Thanks @brodybits for your review. Good points.

I am aware of the current maintainer situation. I will do my best to clear this code up and explain the open questions as soon as I find time at work with my dev environment on hand.

Tests are a good idea since this should be a fix for a regression as described in #583. To put that confusing discussion into short words: Cordova previously did not touch additional targets in Xcode projects (like Watch extension, call directroy extension ..). With Cordova 5 that changed and thos additinal targets get the name of the host app for example. This is undesirable for certain complex apps with additional targets.

This PR tries to bring back the old behavior basically. I think the whole replacing placeholder stuff in Xcode projects changed in Cordova 5. That's why apache/cordova-node-xcode#79 is needed to fix the PRODUCT_BUNDLE_IDENTIFIER placeholder while adding targets with hooks.

As said before I am going to work on the code and I am open to discussions. We are using to extensions to our Cordova app and this is really important. A new release with this fix is not urgent because using forks works is fine for a while but I don't want to maintain these forks forever.

@NiklasMerz NiklasMerz requested review from dpogue December 16, 2019 19:47
@NiklasMerz
Copy link
Member Author

I updated the displayName variable to make this clear.

I can agree the updateBuildPropertyLocal method is not that easy to understand but it is handling info.plist file wizardry I don't understand either. The method is written by @wolfmanfx in #545 and just put together in this PR.

@wolfmanfx What do you think of this PR? Do you have ideas how to improve this method?

@brodycj
Copy link
Contributor

brodycj commented Dec 16, 2019

Thanks @NiklasMerz for the recent fix, looks nice. And thanks for your help and understanding of our maintainer situation.

I completely understand that you are basically adapting a bug fix from someone else, with the obvious challenges of taking over code with missing test cases.

I would like to continue the discussion in #538 which I have just pinned in order to get a better understanding of the whole situation of this functionality.

@NiklasMerz
Copy link
Member Author

Yes the missing test cases part is crucial. That kind of app is not considered in the tests and I am having a hard time thinking of adding it right now.

But I must admit that using extensions with Cordova might not be a often used features except for plugins like open with .

@codecov-io
Copy link

codecov-io commented Dec 17, 2019

Codecov Report

Merging #708 into master will increase coverage by 0.2%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #708     +/-   ##
=========================================
+ Coverage   74.42%   74.63%   +0.2%     
=========================================
  Files          11       11             
  Lines        1830     1853     +23     
=========================================
+ Hits         1362     1383     +21     
- Misses        468      470      +2
Impacted Files Coverage Δ
bin/templates/scripts/cordova/lib/prepare.js 84.4% <91.66%> (+0.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 266d339...41ac8e3. Read the comment docs.

@timbru31
Copy link
Member

I've restarted the timed out Travis test, CI is now green

NiklasMerz and others added 7 commits December 24, 2019 11:01
Co-Authored-By: エリス <erisu@users.noreply.github.com>
Co-Authored-By: エリス <erisu@users.noreply.github.com>
Co-Authored-By: エリス <erisu@users.noreply.github.com>
Used a throw to fall back to default.
Changed a for loop to use for-of


See: #1
@NiklasMerz NiklasMerz requested a review from erisu December 25, 2019 00:56
Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 JS stuff LGTM

NiklasMerz pushed a commit to GEDYSIntraWare/cordova-ios that referenced this pull request Feb 24, 2020
Combined patch from apache#708 from @msari-ipe-ext-1 with refactorings

Co-authored-by: Murat Sari <murat.sari@coderabbit.at>
@NiklasMerz
Copy link
Member Author

This code somehow works for my project, but is not correct. We need to find a better solution possibly involving a change in cordova-node-xcode.

I would love to contribute this but I think it is beyon my capabilities and understandings of Cordova. I tried to work on this a few times but I head always explodes. I appreciate if someone with more experience has the capacity to work on this and I will do my best to support that.

@NiklasMerz NiklasMerz closed this Mar 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cordova overwrites bundleIdentifier for all existing targets
7 participants