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

Add support for defining PRODUCT_NAME in the manifest #435

Merged
merged 15 commits into from Jul 5, 2019

Conversation

ollieatkinson
Copy link
Collaborator

@ollieatkinson ollieatkinson commented Jul 3, 2019

Short description πŸ“

Specifying the product name will allow you to have a different target and product name. This is particularly useful when you want to support different versions of the same product. E.g. different platforms.

Solution πŸ“¦

Expose productName in the manifest.

Implementation πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

  • Add productName to manifest
  • Update TuistGenerator to use new variable
  • Update Documentation
  • Update CHANGELOG.md

Test Plan πŸ› 

  • Generate fixtures/ios_app_with_frameworks via tuist generate
  • Run the following:
xcrun xcodebuild -workspace Workspace.xcworkspace -scheme Framework2-macOS -sdk macosx
xcrun xcodebuild -workspace Workspace.xcworkspace -scheme Framework2-iOS -sdk iphoneos
xcrun xcodebuild -workspace Workspace.xcworkspace -scheme Framework1 -sdk iphoneos
xcrun xcodebuild -workspace Workspace.xcworkspace -scheme Framework1 -sdk iphonesimulator
xcrun xcodebuild -workspace Workspace.xcworkspace -scheme App -sdk iphoneos 
xcrun xcodebuild -workspace Workspace.xcworkspace -scheme App -sdk iphonesimulator
  • Ensure all builds succeed
    optional:
  • Open the project in Xcode
  • Play with it

@ollieatkinson ollieatkinson force-pushed the product-name branch 2 times, most recently from 3b0a960 to 958e4d2 Compare July 3, 2019 20:17
@tuistbot
Copy link
Contributor

tuistbot commented Jul 3, 2019

1 Warning
⚠️ Have you introduced any user-facing changes? If so, please take some time to update the documentation. Keeping the documentation up to date makes it easier for users to learn how to use Tuist.

Generated by 🚫 Danger

Copy link
Collaborator

@kwridan kwridan left a comment

Choose a reason for hiding this comment

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

πŸ‘

I was testing out fixtures/ios_app_with_frameworks - attempting to build the App, Xcode didn't build the dependencies oddly, I had to manually building each framework individually - couldn't spot the issue just yet, will take another look.

Sources/TuistKit/Generator/ManifestTargetGenerator.swift Outdated Show resolved Hide resolved
@ollieatkinson
Copy link
Collaborator Author

Ah, I must have missed that as my build system is set to legacy - I see the problem when switching to the new build system. I will check the build product references there's likely one broken somewhere (using target name rather than product name).

@ollieatkinson ollieatkinson marked this pull request as ready for review July 4, 2019 12:27
@ollieatkinson
Copy link
Collaborator Author

@kwridan So it turns out there was a bug. Previously the products were store in a dictionary products which were indexed by the product name. This obviously caused problems when two product names were the same. So to fix this I instead uniqued on the target name the same way Xcode does.

Interestingly enough the Legacy build system still worked which is why I didn't see it originally, the new build system complained. Thanks for raising the issue!

@codecov
Copy link

codecov bot commented Jul 4, 2019

Codecov Report

Merging #435 into master will increase coverage by 0.08%.
The diff coverage is 98.12%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #435      +/-   ##
==========================================
+ Coverage   92.19%   92.28%   +0.08%     
==========================================
  Files         316      316              
  Lines       15891    15949      +58     
==========================================
+ Hits        14651    14718      +67     
+ Misses       1240     1231       -9
Impacted Files Coverage Ξ”
Sources/ProjectDescription/Target.swift 100% <100%> (ΓΈ) ⬆️
Sources/TuistGenerator/Linter/TargetLinter.swift 96.77% <100%> (+0.38%) ⬆️
...es/TuistGenerator/Generator/SchemesGenerator.swift 99.6% <100%> (ΓΈ) ⬆️
...neratorTests/Models/TestData/Target+TestData.swift 100% <100%> (ΓΈ) ⬆️
Tests/TuistGeneratorTests/Graph/GraphTests.swift 100% <100%> (ΓΈ) ⬆️
...ts/Generator/StableStructureIntegrationTests.swift 98.97% <100%> (+0.01%) ⬆️
...tGeneratorTests/Generator/LinkGeneratorTests.swift 100% <100%> (ΓΈ) ⬆️
...rces/TuistKit/Generator/GeneratorModelLoader.swift 89.58% <100%> (+0.09%) ⬆️
...s/TuistKit/Generator/ManifestTargetGenerator.swift 100% <100%> (ΓΈ) ⬆️
...atorTests/Generator/ProjectFileElementsTests.swift 99.63% <100%> (ΓΈ) ⬆️
... and 16 more

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 95f7422...3907b63. Read the comment docs.

@codecov
Copy link

codecov bot commented Jul 4, 2019

Codecov Report

Merging #435 into master will increase coverage by 0.01%.
The diff coverage is 98.07%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #435      +/-   ##
==========================================
+ Coverage   92.19%   92.21%   +0.01%     
==========================================
  Files         316      316              
  Lines       15891    15921      +30     
==========================================
+ Hits        14651    14681      +30     
  Misses       1240     1240
Impacted Files Coverage Ξ”
...rces/TuistKit/Generator/GeneratorModelLoader.swift 89.58% <100%> (+0.09%) ⬆️
...atorTests/Generator/ProjectFileElementsTests.swift 99.63% <100%> (ΓΈ) ⬆️
Sources/ProjectDescription/Target.swift 100% <100%> (ΓΈ) ⬆️
...s/TuistKit/Generator/ManifestTargetGenerator.swift 100% <100%> (ΓΈ) ⬆️
...atorTests/Generator/BuildPhaseGeneratorTests.swift 100% <100%> (ΓΈ) ⬆️
...es/TuistGenerator/Generator/SchemesGenerator.swift 99.6% <100%> (ΓΈ) ⬆️
...rator/MultipleConfigurationsIntegrationTests.swift 96.47% <100%> (ΓΈ) ⬆️
Tests/TuistGeneratorTests/Graph/GraphTests.swift 100% <100%> (ΓΈ) ⬆️
...ts/Generator/StableStructureIntegrationTests.swift 98.97% <100%> (+0.01%) ⬆️
Tests/ProjectDescriptionTests/TargetTests.swift 100% <100%> (ΓΈ) ⬆️
... and 12 more

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 f584917...7a4bc41. Read the comment docs.

@ollieatkinson
Copy link
Collaborator Author

Updated ios_app_with_transitive_framework with the issue found during integration testing:

5107D546-92D8-4152-B117-970800412FC2

The problem arises when the new product name to support two targets, it will look at all targets inside a manifest and embed frameworks from each target. This caused a problem when trying to support multiple platforms in one manifest.

Copy link
Collaborator

@kwridan kwridan left a comment

Choose a reason for hiding this comment

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

Great work putting this together! πŸ‘

Few comments / questions :) let me know if I can help with any of them.

Sources/TuistGenerator/Graph/Graph.swift Outdated Show resolved Hide resolved
Sources/TuistGenerator/Models/Target.swift Outdated Show resolved Hide resolved
Tests/TuistGeneratorTests/Graph/GraphTests.swift Outdated Show resolved Hide resolved
Sources/TuistGenerator/Graph/Graph.swift Outdated Show resolved Hide resolved
Copy link
Collaborator

@kwridan kwridan left a comment

Choose a reason for hiding this comment

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

πŸš€

XCTAssertTrue(got.contains(LintingIssue(reason: reason, severity: .error)))
}

let XCTAssertValidProductName: (String) -> Void = { bundleId in
Copy link
Collaborator

Choose a reason for hiding this comment

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

πŸ‘

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.

None yet

3 participants