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

Add TargetSource.buildPhase for overriding build phase #206

Merged
merged 1 commit into from
Dec 26, 2017

Conversation

yonaskolb
Copy link
Owner

This lets you override the build phase for a source file or all the files in a directory.
This is useful if XcodeGen makes the wrong guesses based off the file extension.

I think we have a pretty stable list of files right now, but this gives us more flexibility. Especially as we are treating all unknown file types as resources by default, which may not be the desired behaviour.

- file.apns
- file.123
- file.xcassets
- Info.plist
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if it's MyApp_Info.plist instead of Info.plist ?

Copy link
Owner Author

Choose a reason for hiding this comment

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

It’s treated as a resource. Would be a good test case as well 👍

Choose a reason for hiding this comment

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

I was about to comment the same. I wouldn't assume that Info.plist is the name of the target info.plist file. Is it feasible to get a list of all the info.plists defined in the yaml and us that to filter these .plist out from the resources?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yeah it's a tricky problem. I think it's fair to say that if we find a Info.plist, it's being used for that purpose. But yes, some projects may also have other names. It would be possible to check all the build settings for any INFOPLIST_FILE settings, and then ignore those. I've created a seperate issue for this #207


public enum SourceType: String {
case group
case file
case folder
}

public init(path: String, name: String? = nil, compilerFlags: [String] = [], excludes: [String] = [], type: SourceType? = nil, optional: Bool = false) {
public init(path: String, name: String? = nil, compilerFlags: [String] = [], excludes: [String] = [], type: SourceType? = nil, optional: Bool = false, buildPhase: BuildPhase? = nil) {

Choose a reason for hiding this comment

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

I think @toshi0383 mentioned something in another PR but what do you think about splitting this into multiple lines to make it easier to read. Out of curiosity, is there any linter being passed on CI in every PR? That could help keeping method names short.

Copy link
Owner Author

Choose a reason for hiding this comment

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

At the moment no linter is run on CI. There's a format_code make task though that I occasionally run. This is yet to be automated. Along with the automation, rules for line wrapping can be added 👍

Copy link

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

Just a minor code-style-related comment 👏

@yonaskolb yonaskolb merged commit 8be6a74 into master Dec 26, 2017
@yonaskolb yonaskolb deleted the override_build_phase branch December 26, 2017 09:36
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

3 participants