mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
allow multiple spec files to be provided to XcodeGen (#1270)
* allow spec to be a comma separated list of specs instead of one * update readme and --spec command documentation * update Changelog * print project name
This commit is contained in:
@@ -64,7 +64,7 @@ class GenerateCommand: ProjectCommand {
|
||||
do {
|
||||
let existingCacheFile: String = try cacheFilePath.read()
|
||||
if cacheFile.string == existingCacheFile {
|
||||
info("Project has not changed since cache was written")
|
||||
info("Project \(project.name) has not changed since cache was written")
|
||||
return
|
||||
}
|
||||
} catch {
|
||||
|
||||
@@ -12,8 +12,8 @@ class ProjectCommand: Command {
|
||||
let name: String
|
||||
let shortDescription: String
|
||||
|
||||
@Key("-s", "--spec", description: "The path to the project spec file. Defaults to project.yml")
|
||||
var spec: Path?
|
||||
@Key("-s", "--spec", description: "The path to the project spec file. Defaults to project.yml. (It is also possible to link to multiple spec files by comma separating them. Note that all other flags will be the same.)")
|
||||
var spec: String?
|
||||
|
||||
@Key("-r", "--project-root", description: "The path to the project root directory. Defaults to the directory containing the project spec.")
|
||||
var projectRoot: Path?
|
||||
@@ -29,24 +29,32 @@ class ProjectCommand: Command {
|
||||
|
||||
func execute() throws {
|
||||
|
||||
let projectSpecPath = (spec ?? "project.yml").absolute()
|
||||
var projectSpecs: [Path] = []
|
||||
if let spec = spec {
|
||||
projectSpecs = spec.components(separatedBy: ",").map { Path($0).absolute() }
|
||||
} else {
|
||||
projectSpecs = [ Path("project.yml").absolute() ]
|
||||
}
|
||||
|
||||
if !projectSpecPath.exists {
|
||||
throw GenerationError.missingProjectSpec(projectSpecPath)
|
||||
for projectSpecPath in projectSpecs {
|
||||
if !projectSpecPath.exists {
|
||||
throw GenerationError.missingProjectSpec(projectSpecPath)
|
||||
}
|
||||
|
||||
|
||||
let specLoader = SpecLoader(version: version)
|
||||
let project: Project
|
||||
|
||||
let variables: [String: String] = disableEnvExpansion ? [:] : ProcessInfo.processInfo.environment
|
||||
|
||||
do {
|
||||
project = try specLoader.loadProject(path: projectSpecPath, projectRoot: projectRoot, variables: variables)
|
||||
} catch {
|
||||
throw GenerationError.projectSpecParsingError(error)
|
||||
}
|
||||
|
||||
try execute(specLoader: specLoader, projectSpecPath: projectSpecPath, project: project)
|
||||
}
|
||||
|
||||
let specLoader = SpecLoader(version: version)
|
||||
let project: Project
|
||||
|
||||
let variables: [String: String] = disableEnvExpansion ? [:] : ProcessInfo.processInfo.environment
|
||||
|
||||
do {
|
||||
project = try specLoader.loadProject(path: projectSpecPath, projectRoot: projectRoot, variables: variables)
|
||||
} catch {
|
||||
throw GenerationError.projectSpecParsingError(error)
|
||||
}
|
||||
|
||||
try execute(specLoader: specLoader, projectSpecPath: projectSpecPath, project: project)
|
||||
}
|
||||
|
||||
func execute(specLoader: SpecLoader, projectSpecPath: Path, project: Project) throws {}
|
||||
|
||||
Reference in New Issue
Block a user