Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
--selfrequired expectation,wait
--patternlet inline

--disable wrapMultilineStatementBraces, blankLinesAroundMark
--disable wrapFunctionBodies, wrapPropertyBodies, wrapMultilineStatementBraces, blankLinesAroundMark

--exclude Scripts, Generated

7 changes: 3 additions & 4 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let package = Package(
.executable(name: "xcp", targets: ["XcodeProjectCLI"])
],
dependencies: [
.package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "8.12.0")),
.package(url: "https://github.com/tuist/XcodeProj.git", .upToNextMajor(from: "9.12.0")),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0")
],
targets: [
Expand Down
20 changes: 12 additions & 8 deletions Sources/XcodeProject/Core/ProjectTargets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public final class ProjectTargets {
buildConfig = target.buildConfigurationList?.buildConfigurations.first
}

if let array = buildConfig?.buildSettings[key] as? [String] {
if let array = buildConfig?.buildSettings[key]?.arrayValue {
return array.joined(separator: "\n")
} else {
return buildConfig?.buildSettings[key] as? String
return buildConfig?.buildSettings[key]?.stringValue
}
}

Expand All @@ -60,16 +60,20 @@ public final class ProjectTargets {
.filter { configs.isEmpty || configs.contains($0.name) }
.forEach { config in
for (key, value) in settings {
if append, let existingValue = config.buildSettings[key] as? String {
config.buildSettings[key] = existingValue + " " + value
} else if let existingValue = config.buildSettings[key] as? [Any] {
if let existingValue = config.buildSettings[key]?.arrayValue {
if append {
config.buildSettings[key] = existingValue + [value]
config.buildSettings[key] = .array(existingValue + [value])
} else {
config.buildSettings[key] = [value]
config.buildSettings[key] = .array([value])
}
} else if let existingValue = config.buildSettings[key]?.stringValue {
if append {
config.buildSettings[key] = .string("\(existingValue) \(value)")
} else {
config.buildSettings[key] = .string(value)
}
} else {
config.buildSettings[key] = value
config.buildSettings[key] = .string(value)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/XcodeProjectCLI/XcodeProjectCLI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct XcodeProjectCLI: ParsableCommand {
static let configuration: CommandConfiguration = .init(
commandName: "xcp",
abstract: "XcodeProjectCLI",
version: "1.2.1",
version: "1.3.0",
groupedSubcommands: [
.init(
name: "Target",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,12 @@ extension SerializedSuite.SetBuildSettingCommandTests {
$0.name == config
}

return buildConfig?.buildSettings[key] as? T
if T.self == [String].self {
return buildConfig?.buildSettings[key]?.arrayValue as? T
} else if T.self == String.self {
return buildConfig?.buildSettings[key]?.stringValue as? T
}

return nil
}
}
Loading