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

Ensuring the correct platform SDK dependencies path is set #419

Merged
merged 2 commits into from Jun 26, 2019

Conversation

kwridan
Copy link
Collaborator

@kwridan kwridan commented Jun 22, 2019

Resolves #417

Short description πŸ“

When the project doesn't have the SDKROOT setting set at the project level, .sdkRoot based paths always assume they are for macOS!

Solution πŸ“¦

  • Update the SDK dependency paths to be based on the developer directory and the platform SDK root path

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

  • Add the SDK root paths for currently supported platforms
  • Update the SDK dependencies paths to be based on the developer directory + SDK root paths of the corresponding platform
  • Update fixture
  • Update changelog

Test Plan πŸ› 

  • Generate the fixture fixtures/ios_app_with_sdk via tuist generate
  • Open the generated project
  • Verify the linked system frameworks and libraries have the correct path set based on the platform

Resolves tuist#417

- Updating SDK dependency paths to be based on the developer directory and the platform SDK root path

Test Plan:

- generate the fixture `fixtures/ios_app_with_sdk` via `tuist generate`
- Verify the linked system frameworks and libraries have the correct path set based on the platform
@tuistbot
Copy link
Contributor

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

@codecov
Copy link

codecov bot commented Jun 22, 2019

Codecov Report

Merging #419 into master will increase coverage by 0.02%.
The diff coverage is 98.91%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #419      +/-   ##
==========================================
+ Coverage   92.24%   92.27%   +0.02%     
==========================================
  Files         293      293              
  Lines       15267    15318      +51     
==========================================
+ Hits        14083    14134      +51     
  Misses       1184     1184
Impacted Files Coverage Ξ”
...atorTests/Generator/ProjectFileElementsTests.swift 99.63% <100%> (ΓΈ) ⬆️
...sts/TuistGeneratorTests/Models/PlatformTests.swift 100% <100%> (ΓΈ) ⬆️
Sources/TuistGenerator/Models/Platform.swift 100% <100%> (ΓΈ) ⬆️
...sts/TuistGeneratorTests/Graph/GraphNodeTests.swift 100% <100%> (ΓΈ) ⬆️
...TuistGenerator/Generator/ProjectFileElements.swift 97.52% <100%> (ΓΈ) ⬆️
Sources/TuistGenerator/Graph/GraphNode.swift 79.32% <97.05%> (+1.48%) ⬆️

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 641e33c...3e60fd1. Read the comment docs.

status: SDKStatus) throws {
let sdk = AbsolutePath("/\(name)")

guard let sdkExtension = sdk.extension,
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of throwing here, I'd add a new linting rule that verifies that the extension is supported. That way developers can see all the validation issues at once and fix them before running tuist generate again.

Copy link
Contributor

Choose a reason for hiding this comment

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

That means then that this Error.unsupported should be reported as a bug because we should never reach this point if the extension is not supported.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moving this to a lint rule would be much better - I did attempt that in the previous PR, sadly was unable to as the graph is created before any linting is done.

One idea is to always construct an SDKNode even if an invalid name is passed in (e.g. Foo without the extension, or Foo.bar not a .framework and .tbd) and only work out the paths and type later in the pipeline - that way we're able to lint the names. Can play around with this see if it works.

Another is possibly to be more explicit to avoid user error in the first place (will be a breaking change - but maybe ok if we feel its a better choice).

dependencies: [
   .sdk(name: "CloudKit", type: .framework),
   .sdk(name: "ARKit", type: .framework, status: .optional),
   .sdk(name: "libc++", type: .tbd),
]

Copy link
Contributor

Choose a reason for hiding this comment

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

Another is possibly to be more explicit to avoid user error in the first place (will be a breaking change - but maybe ok if we feel its a better choice).

I like this one πŸ‘, even though it's a breaking change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would you be ok for that being a follow up PR to reduce the scope of changes in this one?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added #422

Copy link
Contributor

@pepicrft pepicrft left a comment

Choose a reason for hiding this comment

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

Only a minor thing. Good job @kwridan
giphy (1)

Copy link
Collaborator

@ollieatkinson ollieatkinson left a comment

Choose a reason for hiding this comment

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

πŸ—Ώ Nice work & Solution

@kwridan kwridan merged commit 089697f into tuist:master Jun 26, 2019
@kwridan kwridan deleted the fixes/sdk-paths branch June 26, 2019 07:44
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.

Ensure SDKROOT is set so that sdk dependencies are correctly resolved
4 participants