Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed copy with move in writeXcodeProject. Resolves #1409 #1410

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

- Fixed source file `includes` not working when no paths were found #1337 @shnhrrsn
- Supports specifying multiple package products #1395 @simonbs
- Fixed generation of multiple schemes when running xcodegen in preAction scheme script

## 2.37.0

Expand Down
9 changes: 8 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PackageDescription

let package = Package(
name: "XcodeGen",
platforms: [.macOS(.v10_13)],
platforms: [.macOS(.v10_13), .iOS(.v13)],
products: [
.executable(name: "xcodegen", targets: ["XcodeGen"]),
.library(name: "XcodeGenKit", targets: ["XcodeGenKit"]),
Expand All @@ -23,6 +23,13 @@ let package = Package(
],

targets: [
// .plugin(
// name: "XcodeGenPlugin",
// capability: .buildTool(),
// dependencies: [
// .target(name: "XcodeGen", condition: .when(platforms: [.macOS]))
// ]
// ),
.executableTarget(name: "XcodeGen", dependencies: [
"XcodeGenCLI",
"Version",
Expand Down
10 changes: 8 additions & 2 deletions Sources/XcodeGenKit/FileWriter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Foundation
import PathKit
import ProjectSpec
import XcodeProj
import SwiftCLI

public class FileWriter {

Expand All @@ -15,13 +16,18 @@ public class FileWriter {
let projectPath = projectPath ?? project.defaultProjectPath
let tempPath = try Path.processUniqueTemporary() + "XcodeGen"
try? tempPath.delete()

var tempXcodeProj: XcodeProj?
if projectPath.exists {
try projectPath.copy(tempPath)
tempXcodeProj = try XcodeProj(path: projectPath)
try tempXcodeProj?.write(path: tempPath, override: true)
}

try xcodeProject.write(path: tempPath, override: true)
try? projectPath.delete()
try tempPath.copy(projectPath)
try tempPath.move(projectPath)
try? tempPath.delete()
WriteStream.stdout.print("TERMINADO")
}

public func writePlists() throws {
Expand Down
Loading