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

Support multiple header paths in the project manifest #354

Closed
kwridan opened this issue May 14, 2019 · 0 comments · Fixed by #459
Closed

Support multiple header paths in the project manifest #354

kwridan opened this issue May 14, 2019 · 0 comments · Fixed by #459
Labels
good first issue Good for newcomers type:enhancement New feature or request

Comments

@kwridan
Copy link
Collaborator

kwridan commented May 14, 2019

Is your feature request related to a problem? Please describe.

Existing projects may not have all their header files in a single directory, as such it may be challenging to define a single glob pattern to include all required headers. This becomes more challenging when different header types (public, private & project) are all within the same directories.

Describe the solution you'd like

Add support to specify array of paths / glob patterns for headers:

e.g.

Headers(public: ["Sources/A/**/*.h", "Sources/B/**/*.h"],
        private: ["Sources/C/**/*.h", "Sources/D/**/*.h"],
        project: ["Sources/E/**/*.h", "Sources/F/**/*.h"])

Describe alternatives you've considered

An alternate is to move code around to group all public, private and project classes.

e.g.

  • Sources
    • Public
      • Foo.h
      • Foo.m
    • Private
      • Bar.h
      • Bar.m
    • Project
      • FooBar.h
      • FooBar.m

Additional Context

Both sources and resources have been updated to support multiple paths / glob patterns (e.g. #266) - a similar approach can be adopted here.

Reference

What about headers that are outside of the scope of "Support" dir and still should be project headers?

Originally posted by @zdnk in #352 (comment)

@kwridan kwridan added type:enhancement New feature or request good first issue Good for newcomers labels May 14, 2019
@kwridan kwridan mentioned this issue May 14, 2019
adamkhazi added a commit that referenced this issue Jul 25, 2019
Resolves #354

### Short description 📝

Add support to specify array of paths / glob patterns for headers such as the case below:

```
Headers(public: ["Sources/A/**/*.h", "Sources/B/**/*.h"],
        private: ["Sources/C/**/*.h", "Sources/D/**/*.h"],
        project: "Sources/E/**/*.h")
```

### Solution 📦

Similar to the way multiple source file paths/glob patterns were implemented  (#266). We can use `FileList` and `ExpressibleByStringLiteral` to  expose public, private and project headers as either a String or Array of Strings. The original `FileList` used for sources was not reused as it contained `compilerFlags` which is specific to source files. A new `FileList` containing only paths/glob patterns was created for use with headers. This way `FileList` can be potentially reused elsewhere.

### Implementation 👩‍💻👨‍💻

- [X] Remove `FileList` type alias from `SourceFilesList` and references to it 
- [X] Create new `FileList` without `compilerFlags`
- [X] Modify `Headers` to use the new `FileList` for public, private and project headers
- [X] Add tests to `GeneratorModelLoaderTests` to verify newly supported cases work
- [X] Create `ios_app_with_headers` fixture to support new array of strings case for headers
- [X] Write test that verifies `ios_app_with_headers` fixture targets build

### Test Plan
- Run `tuist generate` inside the `ios_app_with_headers` fixture
- Verify that the Framework1 target has the correct header files specified in the manifest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type:enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant