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 custom search path settings are included in generated projects #751

Merged
merged 3 commits into from Dec 5, 2019

Conversation

kwridan
Copy link
Collaborator

@kwridan kwridan commented Dec 5, 2019

Resolves #750

Short description πŸ“

Specifying a custom HEADER_SEARCH_PATHS or FRAMEWORK_SEARCH_PATHS build setting in manifest is ignored in the event a project has a static library dependency.

Solution πŸ“¦

  • The previous logic was setting the $(inherited) and the derived search paths seperately
  • This caused the derrived search paths to replace any existing custom settings
  • To solve this, we can set the derived search paths and the $(inherited) setting as one setting
  • This allows the extend helper method to extend existing settings

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

  • Update LinkGenerator
  • Add unit tests
  • Update fixture
  • Update changelog

Test Plan πŸ› 

  • Run tuist generate within fixtures/ios_app_with_static_libraries
  • Inspect the generated workspace, Module A should have a $(SRCROOT/CustomHeader header search path

- The previous logic was setting the `$(inherited)` and the derived search paths seperately
- This caused the derrived search paths to replace any existing custom settings
- To solve this, we can set the derived search paths and the `$(inherited)` setting as one setting
- This allows the extend helper method to extend existing settings

Test Plan:

- Run `tuist generate` within `fixtures/ios_app_with_static_libraries`
- Inspect the generated workspace, Module A should have a `$(SRCROOT/CustomHeader` header search path
Copy link
Collaborator Author

@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.

looks like this changes causes a project instability - will investigate it

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.

Good catch @kwridan

@pepicrft
Copy link
Contributor

pepicrft commented Dec 5, 2019

looks like this changes causes a project instability - will investigate it

πŸ‘

Also don't forget about the CHANGELOG :)

@kwridan
Copy link
Collaborator Author

kwridan commented Dec 5, 2019

Updated the changelog! The remaining checks are failing for different reason, I wonder if its due to submitting a PR from a fork?

Tuist / Changelog

Run peterjgrainger/action-changelog-reminder@v1
##[error]Resource not accessible by integration
##[error]Node run failed with exit code 1

Tuist / Upload

Run bundle exec rake package_commit
Decryption failed: invalid private key
rake aborted!
JSON::ParserError: 785: unexpected token at ''
/Users/runner/runners/2.162.0/work/tuist/tuist/Rakefile:70:in `decrypt_secrets'
/Users/runner/runners/2.162.0/work/tuist/tuist/Rakefile:48:in `block in <top (required)>'
/Users/runner/hostedtoolcache/Ruby/2.6.3/x64/bin/bundle:23:in `load'
/Users/runner/hostedtoolcache/Ruby/2.6.3/x64/bin/bundle:23:in `<main>'
Tasks: TOP => package_commit
(See full trace by running task with --trace)
##[error]Process completed with exit code 1.

@kwridan kwridan merged commit 42d2ae4 into tuist:master Dec 5, 2019
@kwridan kwridan deleted the fix/header-search-paths branch December 5, 2019 13:53
pepicrft pushed a commit that referenced this pull request Dec 9, 2019
…#751)

Resolves #750

- The previous logic was setting the `$(inherited)` and the derived search paths seperately
- This caused the derrived search paths to replace any existing custom settings
- To solve this, we can set the derived search paths and the `$(inherited)` setting as one setting
- This allows the extend helper method to extend existing settings

Test Plan:

- Run `tuist generate` within `fixtures/ios_app_with_static_libraries`
- Inspect the generated workspace, Module A should have a `$(SRCROOT/CustomHeader` header search path
kwridan added a commit to bloomberg/tuist that referenced this pull request Dec 12, 2019
- In the even two library dependencies shared the same `publicHeaders` path (e.g. `libcrypto.a` and `libssl.a` in OpenSSL) duplicate entries were added to the `HEADER_SEARCH_PATHS` build setting
- This was regressed due to an earlier change tuist#751
  - previously the uniquing was happening in the settings helper when build settings were extended multiple times
- To resolve this, we now ensure we unique paths being added
- Additionally a test is included to ensure this doesn't regress in the future

Test Plan:

- Verify the unit tests pass
kwridan added a commit to bloomberg/tuist that referenced this pull request Dec 12, 2019
- In the even two library dependencies shared the same `publicHeaders` path (e.g. `libcrypto.a` and `libssl.a` in OpenSSL) duplicate entries were added to the `HEADER_SEARCH_PATHS` build setting
- This was regressed due to an earlier change tuist#751
  - previously the uniquing was happening in the settings helper when build settings were extended multiple times
- To resolve this, we now ensure we unique paths being added
- Additionally a test is included to ensure this doesn't regress in the future

Test Plan:

- Verify the unit tests pass
@kwridan kwridan mentioned this pull request Dec 12, 2019
3 tasks
kwridan added a commit that referenced this pull request Dec 12, 2019
- In the even two library dependencies shared the same `publicHeaders` path (e.g. `libcrypto.a` and `libssl.a` in OpenSSL) duplicate entries were added to the `HEADER_SEARCH_PATHS` build setting
- This was regressed due to an earlier change #751
  - previously the uniquing was happening in the settings helper when build settings were extended multiple times
- To resolve this, we now ensure we unique paths being added
- Additionally a test is included to ensure this doesn't regress in the future

Test Plan:

- Verify the unit tests pass

A bit of a contrived manual test case

update the fixture in `fixtures/ios_app_with_static_libraries/Modules/A/Project.swift`

```swift
let project = Project(name: "A",
                      targets: [
                          Target(name: "A",
                                 platform: .iOS,
                                 product: .staticLibrary,
                                 bundleId: "io.tuist.A",
                                 infoPlist: "Info.plist",
                                 sources: "Sources/**",
                                 dependencies: [
                                     .project(target: "B", path: "../B"),
                                     .library(path: "../C/prebuilt/C/libC.a",
                                             publicHeaders: "../C/prebuilt/C",
                                             swiftModuleMap: "../C/prebuilt/C/C.swiftmodule"),
                                    // Add a duplicate
                                     .library(path: "../C/prebuilt/C/libC.a",
                                             publicHeaders: "../C/prebuilt/C",
                                             swiftModuleMap: "../C/prebuilt/C/C.swiftmodule")
                          ])
])
```

This of course causes a duplicate binary (hence why it wasn't included) but can help illustrate a situation where two `.library` dependencies point to the same `publicHeaders` path.
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.

Custom *_SEARCH_PATHS build settings are ignored
2 participants