From 4b8d46429a4a2536ede559f4e11d3bb480a04ad0 Mon Sep 17 00:00:00 2001 From: Tom Quist Date: Tue, 26 Mar 2019 14:04:08 +0100 Subject: [PATCH] Fix order of file generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the `Info.plist` doesn’t exist in filesystem (e.g. because it’s in `.gitignore`) xcodegen generates the file but doesn’t add it to the `xcodeproj`. Only when `xcodegen` is executed a second time it is included. This changes the order of generation of these files to first generate the plist and then the project. --- CHANGELOG.md | 7 +++++++ Sources/XcodeGenCLI/GenerateCommand.swift | 12 +++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faa1100a..0d12dbdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## Next Version +#### Added + +#### Changed + +#### Fixed +- Fixed order of file generation. Plists are now generated before the project is generated so that the project includes the generated plists [#544](https://github.com/yonaskolb/XcodeGen/issues/544) @tomquist + ## 2.3.0 #### Added diff --git a/Sources/XcodeGenCLI/GenerateCommand.swift b/Sources/XcodeGenCLI/GenerateCommand.swift index 43932818..0c51bf29 100644 --- a/Sources/XcodeGenCLI/GenerateCommand.swift +++ b/Sources/XcodeGenCLI/GenerateCommand.swift @@ -111,6 +111,15 @@ class GenerateCommand: Command { throw GenerationError.validationError(error) } + // generate plists + info("⚙️ Generating plists...") + let fileWriter = FileWriter(project: project) + do { + try fileWriter.writePlists() + } catch { + throw GenerationError.writingError(error) + } + // generate project info("⚙️ Generating project...") let xcodeProject: XcodeProj @@ -124,10 +133,7 @@ class GenerateCommand: Command { // write project info("⚙️ Writing project...") do { - - let fileWriter = FileWriter(project: project) try fileWriter.writeXcodeProject(xcodeProject, to: projectPath) - try fileWriter.writePlists() success("Created project at \(projectPath)") } catch { throw GenerationError.writingError(error)