mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-12-11 07:16:40 +03:00
Merge pull request #500 from lukewakeford/build_script_xcfilelist
Adding input and output file lists to build script spec
This commit is contained in:
commit
4062b6c883
@ -5,6 +5,7 @@
|
||||
#### Added
|
||||
- Added ability to generate empty directories via `options.generateEmptyDirectories` [#480](https://github.com/yonaskolb/XcodeGen/pull/480) @Beniamiiin
|
||||
- Added support for the `instrumentsPackage` product type [#482](https://github.com/yonaskolb/XcodeGen/pull/482) @ksulliva
|
||||
- Added support for `inputFileLists` and `outputFileLists` within project build scripts [#500](https://github.com/yonaskolb/XcodeGen/pull/500) @lukewakeford
|
||||
|
||||
#### Fixed
|
||||
- Fixed `--project` argument not taking effect [#487](https://github.com/yonaskolb/XcodeGen/pull/487) @monowerker
|
||||
|
@ -423,6 +423,8 @@ Each script can contain:
|
||||
- [ ] **name**: **String** - name of a script. Defaults to `Run Script`
|
||||
- [ ] **inputFiles**: **[String]** - list of input files
|
||||
- [ ] **outputFiles**: **[String]** - list of output files
|
||||
- [ ] **inputFileLists**: **[String]** - list of input .xcfilelist
|
||||
- [ ] **outputFileLists**: **[String]** - list of output .xcfilelist
|
||||
- [ ] **shell**: **String** - shell used for the script. Defaults to `/bin/sh`
|
||||
- [ ] **showEnvVars**: **Bool** - whether the environment variables accessible to the script show be printed to the build log. Defaults to yes
|
||||
- [ ] **runOnlyWhenInstalling**: **Bool** - whether the script is only run when installing (`runOnlyForDeploymentPostprocessing`). Defaults to no
|
||||
@ -440,9 +442,13 @@ targets:
|
||||
inputFiles:
|
||||
- $(SRCROOT)/file1
|
||||
- $(SRCROOT)/file2
|
||||
inputFileLists:
|
||||
- $(SRCROOT)/inputFiles.xcfilelist
|
||||
outputFiles:
|
||||
- $(DERIVED_FILE_DIR)/file1
|
||||
- $(DERIVED_FILE_DIR)/file2
|
||||
outputFileLists:
|
||||
- $(SRCROOT)/outputFiles.xcfilelist
|
||||
postCompileScripts:
|
||||
- script: swiftlint
|
||||
name: Swiftlint
|
||||
|
@ -8,6 +8,8 @@ public struct BuildScript: Equatable {
|
||||
public var shell: String?
|
||||
public var inputFiles: [String]
|
||||
public var outputFiles: [String]
|
||||
public var inputFileLists: [String]
|
||||
public var outputFileLists: [String]
|
||||
public var runOnlyWhenInstalling: Bool
|
||||
public let showEnvVars: Bool
|
||||
|
||||
@ -21,6 +23,8 @@ public struct BuildScript: Equatable {
|
||||
name: String? = nil,
|
||||
inputFiles: [String] = [],
|
||||
outputFiles: [String] = [],
|
||||
inputFileLists: [String] = [],
|
||||
outputFileLists: [String] = [],
|
||||
shell: String? = nil,
|
||||
runOnlyWhenInstalling: Bool = false,
|
||||
showEnvVars: Bool = true
|
||||
@ -29,6 +33,8 @@ public struct BuildScript: Equatable {
|
||||
self.name = name
|
||||
self.inputFiles = inputFiles
|
||||
self.outputFiles = outputFiles
|
||||
self.inputFileLists = inputFileLists
|
||||
self.outputFileLists = outputFileLists
|
||||
self.shell = shell
|
||||
self.runOnlyWhenInstalling = runOnlyWhenInstalling
|
||||
self.showEnvVars = showEnvVars
|
||||
@ -41,7 +47,9 @@ extension BuildScript: JSONObjectConvertible {
|
||||
name = jsonDictionary.json(atKeyPath: "name")
|
||||
inputFiles = jsonDictionary.json(atKeyPath: "inputFiles") ?? []
|
||||
outputFiles = jsonDictionary.json(atKeyPath: "outputFiles") ?? []
|
||||
|
||||
inputFileLists = jsonDictionary.json(atKeyPath: "inputFileLists") ?? []
|
||||
outputFileLists = jsonDictionary.json(atKeyPath: "outputFileLists") ?? []
|
||||
|
||||
if let string: String = jsonDictionary.json(atKeyPath: "script") {
|
||||
script = .script(string)
|
||||
} else {
|
||||
|
@ -289,6 +289,8 @@ public class PBXProjGenerator {
|
||||
name: buildScript.name ?? "Run Script",
|
||||
inputPaths: buildScript.inputFiles,
|
||||
outputPaths: buildScript.outputFiles,
|
||||
inputFileListPaths: buildScript.inputFileLists,
|
||||
outputFileListPaths: buildScript.outputFileLists,
|
||||
shellPath: buildScript.shell ?? "/bin/sh",
|
||||
shellScript: shellScript,
|
||||
runOnlyForDeploymentPostprocessing: buildScript.runOnlyWhenInstalling,
|
||||
|
@ -1601,9 +1601,13 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = MyScript;
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -1615,9 +1619,13 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = MyScript;
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -1629,9 +1637,13 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Strip Unused Architectures from Frameworks";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
@ -1643,9 +1655,13 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = MyScript;
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -1657,9 +1673,13 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = MyScript;
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -1671,9 +1691,15 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
inputList.xcfilelist,
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = MyScript;
|
||||
outputFileListPaths = (
|
||||
outputList.xcfilelist,
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -1685,9 +1711,13 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = MyScript;
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -112,6 +112,10 @@ targets:
|
||||
- name: MyScript
|
||||
script: |
|
||||
echo "You ran a script!"
|
||||
inputFileLists:
|
||||
- inputList.xcfilelist
|
||||
outputFileLists:
|
||||
- outputList.xcfilelist
|
||||
|
||||
App_watchOS:
|
||||
type: application.watchapp2
|
||||
|
@ -438,6 +438,8 @@ class SpecLoadingTests: XCTestCase {
|
||||
["path": "script.sh"],
|
||||
["script": "shell script\ndo thing", "name": "myscript", "inputFiles": ["file", "file2"], "outputFiles": ["file", "file2"], "shell": "bin/customshell", "runOnlyWhenInstalling": true],
|
||||
["script": "shell script\ndo thing", "name": "myscript", "inputFiles": ["file", "file2"], "outputFiles": ["file", "file2"], "shell": "bin/customshell", "showEnvVars": false],
|
||||
["script": "shell script\nwith file lists", "name": "myscript", "inputFileLists": ["inputList.xcfilelist"], "outputFileLists": ["outputList.xcfilelist"], "shell": "bin/customshell", "runOnlyWhenInstalling": true],
|
||||
["script": "shell script\nwith file lists", "name": "myscript", "inputFileLists": ["inputList.xcfilelist"], "outputFileLists": ["outputList.xcfilelist"], "shell": "bin/customshell", "showEnvVars": false]
|
||||
]
|
||||
target["preBuildScripts"] = scripts
|
||||
target["postCompileScripts"] = scripts
|
||||
@ -447,6 +449,8 @@ class SpecLoadingTests: XCTestCase {
|
||||
BuildScript(script: .path("script.sh")),
|
||||
BuildScript(script: .script("shell script\ndo thing"), name: "myscript", inputFiles: ["file", "file2"], outputFiles: ["file", "file2"], shell: "bin/customshell", runOnlyWhenInstalling: true, showEnvVars: true),
|
||||
BuildScript(script: .script("shell script\ndo thing"), name: "myscript", inputFiles: ["file", "file2"], outputFiles: ["file", "file2"], shell: "bin/customshell", runOnlyWhenInstalling: false, showEnvVars: false),
|
||||
BuildScript(script: .script("shell script\nwith file lists"), name: "myscript", inputFileLists: ["inputList.xcfilelist"], outputFileLists: ["outputList.xcfilelist"], shell: "bin/customshell", runOnlyWhenInstalling: true, showEnvVars: true),
|
||||
BuildScript(script: .script("shell script\nwith file lists"), name: "myscript", inputFileLists: ["inputList.xcfilelist"], outputFileLists: ["outputList.xcfilelist"], shell: "bin/customshell", runOnlyWhenInstalling: false, showEnvVars: false),
|
||||
]
|
||||
|
||||
let parsedTarget = try Target(name: "test", jsonDictionary: target)
|
||||
|
Loading…
Reference in New Issue
Block a user