-
Notifications
You must be signed in to change notification settings - Fork 822
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 minimumXcodeGenVersion option #349
Conversation
2c0db7c
to
a69cae6
Compare
Sources/XcodeGen/main.swift
Outdated
@@ -41,7 +41,7 @@ func generate(spec: String, project: String, isQuiet: Bool, justVersion: Bool) { | |||
do { | |||
logger.info("⚙️ Generating project...") | |||
let projectGenerator = ProjectGenerator(project: project) | |||
let xcodeProject = try projectGenerator.generateXcodeProject() | |||
let xcodeProject = try projectGenerator.generateXcodeProject(xcodeGenVersion: version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this can be a useful feature, but at the moment I feel its affects are a bit too pervasive in the codebase. I'd be happy to have an extension Project.meetsMinimumVersion(_ version: Version) -> Bool
that gets checked for in this file and throws an error.
XcodeGenKit is also a library that gets used by other packages as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I’ll adjust.
a69cae6
to
67c87d7
Compare
@yonaskolb I made it less pervasive. Let me know if there is anything else needed 😄. |
@@ -74,6 +74,17 @@ class ProjectSpecTests: XCTestCase { | |||
configSettings: ["invalidConfig": [:]], | |||
groups: ["invalidSettingGroup"] | |||
) | |||
|
|||
$0.it("fails with invalid XcodeGen version") { | |||
let minimumVersion = try! Version("1.11.1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No biggie, but these tests are allowed to throw so no need for the exclamation marks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, true. I'll adjust it.
@@ -205,3 +216,9 @@ fileprivate func expectValidationError(_ project: Project, _ expectedError: Spec | |||
} | |||
throw failure("Supposed to fail with \"\(expectedError)\"", file: file, line: line) | |||
} | |||
|
|||
fileprivate func expectMinimumXcodeGenVersionError(_ project: Project, minimumVersion: Version, xcodeGenVersion: Version, file: String = #file, line: Int = #line) throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this just go inside the it
closure, as it's only used there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
If XcodeGen's version is less than this version validation will fail.
67c87d7
to
57966c4
Compare
@yonaskolb Good to go! |
If XcodeGen's version is less than this version validation will fail.