From e00e8361d8c0cc4c09ccc37c89c677c5edc5e87b Mon Sep 17 00:00:00 2001 From: yonaskolb Date: Sat, 1 Feb 2020 17:30:51 +1100 Subject: [PATCH] enable caching by default --- README.md | 5 ++++- Sources/XcodeGenCLI/Commands/GenerateCommand.swift | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 680a5237..9cb72cf7 100644 --- a/README.md +++ b/README.md @@ -127,11 +127,14 @@ Options: - **--spec**: An optional path to a `.yml` or `.json` project spec. Defaults to `project.yml` - **--project**: An optional path to a directory where the project will be generated. By default this is the directory the spec lives in. - **--quiet**: Suppress informational and success messages. -- **--use-cache**: Used to prevent unnecessarily generating the project. If this is set, then a cache file will be written to when a project is generated. If `xcodegen` is later run but the spec and all the files it contains are the same, the project won't be generated. +- **--no-cache**: Disables caching - **--cache-path**: A custom path to use for your cache file. This defaults to `~/.xcodegen/cache/{PROJECT_SPEC_PATH_HASH}` There are other commands as well. Use `xcodegen help` to see more detailed usage information. +### Caching +By default XcodeGen uses a cache to prevent unnecessarily generating the project. A cache file will be written when a project is generated. If `xcodegen` is later run but the spec and all the files it contains are the same, the project won't be generated. + ## Editing ```shell git clone https://github.com/yonaskolb/XcodeGen.git diff --git a/Sources/XcodeGenCLI/Commands/GenerateCommand.swift b/Sources/XcodeGenCLI/Commands/GenerateCommand.swift index c01c7b9a..34cb7ff5 100644 --- a/Sources/XcodeGenCLI/Commands/GenerateCommand.swift +++ b/Sources/XcodeGenCLI/Commands/GenerateCommand.swift @@ -10,8 +10,8 @@ class GenerateCommand: ProjectCommand { @Flag("-q", "--quiet", description: "Suppress all informational and success output") var quiet: Bool - @Flag("-c", "--use-cache", description: "Use a cache for the xcodegen spec. This will prevent unnecessarily generating the project if nothing has changed") - var useCache: Bool + @Flag("-n", "--no-cache", description: "Don't use a cache for the spec") + var noCache: Bool @Key("--cache-path", description: "Where the cache file will be loaded from and save to. Defaults to ~/.xcodegen/cache/{SPEC_PATH_HASH}") var cacheFilePath: Path? @@ -46,7 +46,7 @@ class GenerateCommand: ProjectCommand { var cacheFile: CacheFile? // read cache - if useCache || self.cacheFilePath != nil { + if !noCache || self.cacheFilePath != nil { do { cacheFile = try specLoader.generateCacheFile() } catch {