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

Allow missing files in sources #200

Merged
merged 1 commit into from
Dec 21, 2017

Conversation

alvarhansen
Copy link
Contributor

Adds optional flag to TargetSource to allow files that do not exist yet.
This is useful in cases where build script will generate files.

@yonaskolb
Copy link
Owner

Yeah I thought someone might bring up the strictness of the file validation eventually :)
In this sources case though, if the source directory doesn't exist nothing will be added, so even if they were generated later it wouldn't change anything. Or would you use this when pointing directly at a source file?
Also is this maybe better as a top level option? allowMissingSources?

@alvarhansen
Copy link
Contributor Author

We are pointing directly to file, like so:

sources:
  - path: Assets.generated.swift
    type: file
    optional: true
  - path: GraphQL.generated.swift
    type: file
    optional: true

I kind of like to have this missing source check enables for other files as this kind of missing file inclusion is exception.

@@ -101,6 +101,16 @@ func projectSpecTests() {
try expectValidationError(spec, .invalidSchemeConfig(scheme: "scheme1", config: "debugInvalid"))
try expectValidationError(spec, .invalidSchemeConfig(scheme: "scheme1", config: "releaseInvalid"))
}

$0.it("allows missing optional file", closure: {
Copy link
Owner

Choose a reason for hiding this comment

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

nitpick: we use trailing closure for these 👍
Thanks for the test! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uniform style is important. Changed it.

@yonaskolb
Copy link
Owner

Ok great, some good reasons there 👍

Adds `optional` flag to `TargetSource` to allow files that do not exist yet.
This is useful in cases where build script will generate files.
@yonaskolb yonaskolb merged commit 375d322 into yonaskolb:master Dec 21, 2017
@keith
Copy link
Collaborator

keith commented Dec 27, 2017

Here's a small bug related to this change #210

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.

3 participants