Skip to content

Commit 126339f

Browse files
dalemyersDale Myers
andauthored
Run preGenCommand before checking the cache (#1519)
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. Co-authored-by: Dale Myers <dalemyers@microsoft.com>
1 parent a51a548 commit 126339f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Sources/XcodeGenCLI/Commands/GenerateCommand.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ class GenerateCommand: ProjectCommand {
3939

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

42+
// run pre gen command before we use the cache as the scripts may change it
43+
if let command = project.options.preGenCommand {
44+
try Task.run(bash: command, directory: projectDirectory.absolute().string)
45+
}
46+
4247
let cacheFilePath = self.cacheFilePath ??
4348
Path("~/.xcodegen/cache/\(projectSpecPath.absolute().string.md5)").absolute()
4449
var cacheFile: CacheFile?
@@ -69,11 +74,6 @@ class GenerateCommand: ProjectCommand {
6974
}
7075
}
7176

72-
// run pre gen command
73-
if let command = project.options.preGenCommand {
74-
try Task.run(bash: command, directory: projectDirectory.absolute().string)
75-
}
76-
7777
// validate project
7878
do {
7979
try project.validateMinimumXcodeGenVersion(version)

0 commit comments

Comments
 (0)