Skip to content

Commit

Permalink
Run preGenCommand before checking the cache
Browse files Browse the repository at this point in the history
The preGenCommand may generate files, change paths, etc. If we run this after checking the cache, it never gets the chance to run if the cache hasn't changed. Running it before checking the cache lets us make these changes and _then_ we can check the cache to see if we need to regenerate or not.
  • Loading branch information
Dale Myers committed Nov 7, 2024
1 parent a51a548 commit 21320aa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Sources/XcodeGenCLI/Commands/GenerateCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class GenerateCommand: ProjectCommand {

let projectPath = projectDirectory + "\(project.name).xcodeproj"

// run pre gen command before we use the cache as the scrips may change it
if let command = project.options.preGenCommand {
try Task.run(bash: command, directory: projectDirectory.absolute().string)
}

let cacheFilePath = self.cacheFilePath ??
Path("~/.xcodegen/cache/\(projectSpecPath.absolute().string.md5)").absolute()
var cacheFile: CacheFile?
Expand Down Expand Up @@ -69,11 +74,6 @@ class GenerateCommand: ProjectCommand {
}
}

// run pre gen command
if let command = project.options.preGenCommand {
try Task.run(bash: command, directory: projectDirectory.absolute().string)
}

// validate project
do {
try project.validateMinimumXcodeGenVersion(version)
Expand Down

0 comments on commit 21320aa

Please sign in to comment.