mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-12-11 07:16:40 +03:00
Add --project-root option to generate command. (#828)
This commit is contained in:
parent
7afcf1f5f7
commit
b1edbda583
@ -4,6 +4,7 @@
|
||||
#### Added
|
||||
- Improve speed of metadata parsing and dependency resolution. [#803](https://github.com/yonaskolb/XcodeGen/pull/803) @michaeleisel
|
||||
- Improve support for iOS sticker packs and add support for `launchAutomaticallySubstyle` to run schemes. [#824](https://github.com/yonaskolb/XcodeGen/pull/824) @scelis
|
||||
- Add --project-root option to generate command. [#828](https://github.com/yonaskolb/XcodeGen/pull/828) @ileitch
|
||||
|
||||
#### Fixed
|
||||
- Fixed issue when linking and embeding static frameworks: they should be linked and NOT embed. [#820](https://github.com/yonaskolb/XcodeGen/pull/820) @acecilia
|
||||
|
@ -15,10 +15,10 @@ public class SpecLoader {
|
||||
self.version = version
|
||||
}
|
||||
|
||||
public func loadProject(path: Path, variables: [String: String] = [:]) throws -> Project {
|
||||
public func loadProject(path: Path, projectRoot: Path? = nil, variables: [String: String] = [:]) throws -> Project {
|
||||
let spec = try SpecFile(path: path)
|
||||
let resolvedDictionary = spec.resolvedDictionary(variables: variables)
|
||||
let project = try Project(basePath: spec.basePath, jsonDictionary: resolvedDictionary)
|
||||
let project = try Project(basePath: projectRoot ?? spec.basePath, jsonDictionary: resolvedDictionary)
|
||||
|
||||
self.project = project
|
||||
projectDictionary = resolvedDictionary
|
||||
|
@ -15,6 +15,9 @@ class ProjectCommand: Command {
|
||||
@Key("-s", "--spec", description: "The path to the project spec file. Defaults to project.yml")
|
||||
var spec: Path?
|
||||
|
||||
@Key("-r", "--project-root", description: "The path to the project root directory. Defaults to the directory containing the project spec.")
|
||||
var projectRoot: Path?
|
||||
|
||||
@Flag("-n", "--no-env", description: "Disable environment variable expansions")
|
||||
var disableEnvExpansion: Bool
|
||||
|
||||
@ -38,7 +41,7 @@ class ProjectCommand: Command {
|
||||
let variables: [String: String] = disableEnvExpansion ? [:] : ProcessInfo.processInfo.environment
|
||||
|
||||
do {
|
||||
project = try specLoader.loadProject(path: projectSpecPath, variables: variables)
|
||||
project = try specLoader.loadProject(path: projectSpecPath, projectRoot: projectRoot, variables: variables)
|
||||
} catch {
|
||||
throw GenerationError.projectSpecParsingError(error)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user