-
Notifications
You must be signed in to change notification settings - Fork 823
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
Run scripts #17
Merged
Merged
Run scripts #17
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if which swiftlint >/dev/null; then | ||
swiftlint | ||
else | ||
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// | ||
// RunScript.swift | ||
// XcodeGen | ||
// | ||
// Created by Yonas Kolb on 1/8/17. | ||
// | ||
// | ||
|
||
import Foundation | ||
import JSONUtilities | ||
|
||
public struct RunScript: Equatable { | ||
|
||
public var script: ScriptType | ||
public var name: String? | ||
public var shell: String? | ||
public var inputFiles: [String] | ||
public var outputFiles: [String] | ||
|
||
public enum ScriptType: Equatable { | ||
case path(String) | ||
case script(String) | ||
|
||
public static func ==(lhs: ScriptType, rhs: ScriptType) -> Bool { | ||
switch (lhs, rhs) { | ||
case let (.path(lhs), .path(rhs)): return lhs == rhs | ||
case let (.script(lhs), .script(rhs)): return lhs == rhs | ||
default: return false | ||
} | ||
} | ||
} | ||
|
||
public init(script: ScriptType, name: String? = nil, inputFiles: [String] = [], outputFiles: [String] = [], shell: String? = nil) { | ||
self.script = script | ||
self.name = name | ||
self.inputFiles = inputFiles | ||
self.outputFiles = outputFiles | ||
self.shell = shell | ||
} | ||
|
||
public static func ==(lhs: RunScript, rhs: RunScript) -> Bool { | ||
return lhs.script == rhs.script && | ||
lhs.name == rhs.name && | ||
lhs.script == rhs.script && | ||
lhs.inputFiles == rhs.inputFiles && | ||
lhs.outputFiles == rhs.outputFiles && | ||
lhs.shell == rhs.shell | ||
} | ||
} | ||
|
||
extension RunScript: JSONObjectConvertible { | ||
|
||
public init(jsonDictionary: JSONDictionary) throws { | ||
name = jsonDictionary.json(atKeyPath: "name") | ||
inputFiles = jsonDictionary.json(atKeyPath: "inputFiles") ?? [] | ||
outputFiles = jsonDictionary.json(atKeyPath: "outputFiles") ?? [] | ||
|
||
if let string: String = jsonDictionary.json(atKeyPath: "script") { | ||
script = .script(string) | ||
} else { | ||
let path: String = try jsonDictionary.json(atKeyPath: "path") | ||
script = .path(path) | ||
} | ||
shell = jsonDictionary.json(atKeyPath: "shell") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What about making
shell
non-optional and using a default value in theRunScript
constructor with/bin/sh
. Since the shell is required for creating aPBXShellScriptBuildPhase
I'd make it non-optional here as well. What do you think?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.
Yeah that would be an option. I've been trying to keep any specific knowledge out of ProjectSpec though, and just keep it dumb.
Also I think that
/bin/sh
should be the default value in thexcodeproj
constructor, and I didn't want to double up work there. It's something we still need to add to xcodeproj though