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

Optionally make intermediate filler groups #108

Merged
merged 1 commit into from
Nov 2, 2017

Conversation

bkase
Copy link
Collaborator

@bkase bkase commented Oct 25, 2017

This commit adds a new option mirrorsFileSystem that defaults to
false. When it is false, the behavior of XcodeGen is the same as
before. When it is true, we make intermediate groups recursively until
we reach the basePath. In practice that means if you've chosen
Platform/PINFoundation/Sources as one of your sourcePaths, you get a
top-level group of Platform and under that PINFoundation and under
that Sources. This is instead of the default behavior of just making
Sources a top-level group (which is confusing when your directory is
called Sources for example).

I think this would probably be a good place to put a fixture, but I wasn't
sure how I should go about adding one. Please advise, thanks!

mirrorsFileSystem: false (or unset):

screen shot 2017-10-25 at 3 27 06 pm

mirrorsFileSystem: true:

screen shot 2017-10-25 at 3 36 16 pm

@yonaskolb
Copy link
Owner

Awesome @bkase! I've been thinking of something similar but adding it to a more configurable source struct as hinted at here #25 where you could define the name or path of group.
These would be a good catch all solution though.

let group: PBXGroup
if let cachedGroup = groupsByPath[path] {
group = cachedGroup
if spec.options.mirrorsFileSystem {
Copy link
Owner

Choose a reason for hiding this comment

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

Once thing that would need to be checked for is the case where you define a source outside of the base path eg. sources: ../directory. Currently this would probably add every directory until the filesystem root

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch

@yonaskolb
Copy link
Owner

Could you add documentation to docs/ProjectSpec.md as well.

In terms of the fixture, you could add something to the TestProject. You could make a hierarchy of directories and then include one as a source at least one level down to validate this works

@@ -29,6 +29,7 @@ public struct ProjectSpec {

public struct Options {
public var carthageBuildPath: String?
public var mirrorsFileSystem: Bool
Copy link
Owner

Choose a reason for hiding this comment

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

As XcodeGen already somewhat mirrors the file system, can we call this createIntermediateGroups or something similar?

@bkase bkase force-pushed the optionally-make-filler-groups branch from e5802c4 to 3bcb212 Compare November 1, 2017 06:15
@bkase
Copy link
Collaborator Author

bkase commented Nov 1, 2017

@yonaskolb okay made requested changes + added example to fixture

@yonaskolb
Copy link
Owner

To fix the tests, re-run swift test to re-generate the fixture and commit it. And make sure the generated project isn't opened or xcode will make some slight modifications to it, which is what seems to have happened here. (Resolving #114, would fix the need for that)

This commit adds a new option `createIntermediateGroups` that defaults
to false. When it is false, the behavior of XcodeGen is the same as
before. When it is true, we make intermediate groups recursively until
we reach the basePath. In practice that means if you've chosen
`Platform/PINFoundation/Sources` as one of your sourcePaths, you get a
top-level group of `Platform` and under that `PINFoundation` and under
that `Sources`. This is instead of the default behavior of just making
`Sources` a top-level group (which is confusing when your directory is
called `Sources` for example).
@bkase bkase force-pushed the optionally-make-filler-groups branch from 3bcb212 to e48045d Compare November 2, 2017 01:02
@bkase
Copy link
Collaborator Author

bkase commented Nov 2, 2017

Okay rebased + swift test commits @yonaskolb

@yonaskolb yonaskolb merged commit 57216be into yonaskolb:master Nov 2, 2017
bkase pushed a commit to bkase/XcodeGen that referenced this pull request Nov 2, 2017
Added support for compilerFlags in source list. If any source file
metadata (like compilerFlags) is attached to a directory the metadata
propagates downwards to all children recursively until the files are
reached.

Files are now processed in the same way as directories in `getSources`
this depends on yonaskolb#108 to not over-eagerly cache groups. The `source` is
propagated as metadata down all the way (thanks @yonaskolb)

Fixtures and unit tests are updated as well.
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

2 participants