enable caching by default

This commit is contained in:
yonaskolb 2020-02-01 17:30:51 +11:00
parent 49ed1503ef
commit e00e8361d8
2 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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 {