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

Ensure DEVELOPER_DIR is used in all swiftc calls #1819

Merged

Conversation

kwridan
Copy link
Collaborator

@kwridan kwridan commented Sep 24, 2020

Resolves: #1816

Short description 📝

In the event xcode-select -p mismatches the environment variable DEVELOPER_DIR tuist generate would fail to for projects with ProjectDescriptionHelpers.

This was happening due toProjectDescriptionHelpers getting compiled with the default version Xcode ignoring the DEVELOPER_DIR environment variable, whereas the manifests were respecting the environment variable causing a mismatch in Swift versions used during the loading process.

Solution 📦

Ensure all manifest loading operations (all calls to swiftc) respect the DEVELOPER_DIR environment variable.

Implementation 👩‍💻👨‍💻

  • Update allowed environment variables (PATH was not required, removed to minimise changes)
  • Leverage manifestLoadingVariables for all manifest loading operations (to ensure consistent version of Swift is used)
  • Leverage manifestLoadingVariables for all manifest hashing operations (to ensure cache is invalidated in case of switch Xcode versions)

Test Plan 🛠

  • Set your default Xcode to 11.5 (e.g. sudo xcode-select -s /Applications/Xcode11.5.app/Contents/Developer)
  • Create a local release package of tuist using bundle exec rake local_package
  • Unzip build/tuist
  • Clear the tuist cache via rm ~/.tuist/Cache
  • Run build/tuist/tuist generate --path fixtures/ios_app_with_helpers
  • Set the developer dir environment to Xcode 12 (e.g. export DEVELOPER_DIR=/Applications/Xcode12.app/Contents/Developer)
  • Clear the tuist cache via rm ~/.tuist/Cache
  • Run build/tuist/tuist generate --path fixtures/ios_app_with_helpers
  • Verify project generation succeeds

Resolves: tuist#1816

- `ProjectDescriptionHelpers` were being compiled with the default version Xcode ignoring the `DEVELOPER_DIR` environment variable, whereas the manifests were respecting the environment variable
- This led to a possible mismatch in compiler versions in the case where the enviorment variable was set to an Xcode version different fromt he default (`xcode-select -p`)
- To mitigate this, we now ensure all manifest loading operations (all calls to `swiftc`) respect the `DEVELOPER_DIR` environment variable

Test Plan:

- Set your default Xcode to 11.5 (e.g. `sudo xcode-select -s /Applications/Xcode11.5.app/Contents/Developer`)
- Create a local release package of `tuist` using `bundle exec rake local_package`
- Unzip `build/tuist`
- Clear the tuist cache via `rm ~/.tuist/Cache`
- Run `build/tuist/tuist generate --path fixtures/ios_app_with_helpers`
- Set the developer dir environment to Xcode 12 (e.g. `export DEVELOPER_DIR=/Applications/Xcode12.app/Contents/Developer`)
- Clear the tuist cache via `rm ~/.tuist/Cache`
- Run `build/tuist/tuist generate --path fixtures/ios_app_with_helpers`
- Verify project generation succeeds
@pepicrft pepicrft merged commit 5bde784 into tuist:master Sep 25, 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.

Generate command failing on Github CI
2 participants