Skip to content

Commit

Permalink
No longer rely on config files - just inject the INFO_PLIST settings
Browse files Browse the repository at this point in the history
  • Loading branch information
samdeane committed Aug 9, 2024
1 parent 695ebe2 commit 0ec336b
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 10 deletions.
88 changes: 88 additions & 0 deletions .swiftpm/configuration/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"object": {
"pins": [
{
"package": "Builder",
"repositoryURL": "https://github.com/elegantchaos/Builder.git",
"state": {
"branch": null,
"revision": "2c62722be9ed28035242a05f6abcc154a514ca9e",
"version": "1.2.3"
}
},
{
"package": "BuilderConfiguration",
"repositoryURL": "https://github.com/elegantchaos/BuilderConfiguration.git",
"state": {
"branch": null,
"revision": "c21cebac262244d920894bba2351ff65c1378bf2",
"version": "1.1.5"
}
},
{
"package": "Coercion",
"repositoryURL": "https://github.com/elegantchaos/Coercion.git",
"state": {
"branch": null,
"revision": "df699ebd4707bcfd99fcad4b9f6c09ddc1208af9",
"version": "1.1.3"
}
},
{
"package": "Files",
"repositoryURL": "https://github.com/elegantchaos/Files.git",
"state": {
"branch": null,
"revision": "ccb417b5b4f2d473964594a7c906a50a62c8530c",
"version": "1.2.2"
}
},
{
"package": "Logger",
"repositoryURL": "https://github.com/elegantchaos/Logger.git",
"state": {
"branch": null,
"revision": "a5cfb4ede43a0f4782afb2aea3175a04f206efcf",
"version": "1.8.1"
}
},
{
"package": "Matchable",
"repositoryURL": "https://github.com/elegantchaos/Matchable.git",
"state": {
"branch": null,
"revision": "d53e807009960aafbd54f6229c2542f906628b38",
"version": "1.0.7"
}
},
{
"package": "Runner",
"repositoryURL": "https://github.com/elegantchaos/Runner.git",
"state": {
"branch": null,
"revision": "65420eb4e534a58c8fb1bf18e344bc86edb42c65",
"version": "1.3.2"
}
},
{
"package": "swift-argument-parser",
"repositoryURL": "https://github.com/apple/swift-argument-parser",
"state": {
"branch": null,
"revision": "6b2aa2748a7881eebb9f84fb10c01293e15b52ca",
"version": "0.5.0"
}
},
{
"package": "XCTestExtensions",
"repositoryURL": "https://github.com/elegantchaos/XCTestExtensions.git",
"state": {
"branch": null,
"revision": "39694671be8bea1ab0bbd87114705b2a92567a8e",
"version": "1.5.0"
}
}
]
},
"version": 1
}
4 changes: 2 additions & 2 deletions Sources/ReleaseTools/Commands/ArchiveCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ struct ArchiveCommand: ParsableCommand {

parsed.log("Updating Version Info")
let infoHeaderPath = "\(parsed.buildURL.path)/VersionInfo.h"
try UpdateBuildCommand.generateHeader(parsed: parsed, header: infoHeaderPath, repo: parsed.rootURL.path)
let build = try UpdateBuildCommand.generateHeader(parsed: parsed, header: infoHeaderPath, repo: parsed.rootURL.path)
parsed.log("Archiving scheme \(parsed.scheme).")

let xcode = XCodeBuildRunner(parsed: parsed)
var args = ["-workspace", parsed.workspace, "-scheme", parsed.scheme, "archive", "-archivePath", parsed.archiveURL.path, "-allowProvisioningUpdates", "INFOPLIST_PREFIX_HEADER=\(infoHeaderPath)"]
var args = ["-workspace", parsed.workspace, "-scheme", parsed.scheme, "archive", "-archivePath", parsed.archiveURL.path, "-allowProvisioningUpdates", "INFOPLIST_PREFIX_HEADER=\(infoHeaderPath)", "INFOPLIST_PREPROCESS=YES", "CURRENT_PROJECT_VERSION=\(build)"]
if let config = xcconfig {
args.append(contentsOf: ["-xcconfig", config])
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/ReleaseTools/Commands/BootstrapCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ struct BootstrapCommand: ParsableCommand {
command: Self.configuration
)

parsed.log("Copying .xcconfig files to \(Self.localConfigFolder).")
try Resources.configsPath.merge(into: Self.localConfigFolder)
// parsed.log("Copying .xcconfig files to \(Self.localConfigFolder).")
// try Resources.configsPath.merge(into: Self.localConfigFolder)

parsed.log("Copying scripts to \(Self.localScriptsFolder).")
try Resources.scriptsPath.merge(into: Self.localScriptsFolder)
Expand Down
5 changes: 3 additions & 2 deletions Sources/ReleaseTools/Commands/UpdateBuildCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,17 @@ struct UpdateBuildCommand: ParsableCommand {
}
}

static func generateHeader(parsed: OptionParser, header: String, repo: String) throws {
static func generateHeader(parsed: OptionParser, header: String, repo: String) throws -> String {
let headerURL = URL(fileURLWithPath: header)
let repoURL = URL(fileURLWithPath: repo)

let git = GitRunner()
let (build, commit) = try getBuild(in: repoURL, using: git)
parsed.log("Setting build number to \(build).")
let header = "#define BUILD \(build)\n#define COMMIT \(commit)"
let header = "#define BUILD \(build)\n#define CURRENT_PROJECT_VERSION \(build)\n#define COMMIT \(commit)"
try? FileManager.default.createDirectory(at: headerURL.deletingLastPathComponent(), withIntermediateDirectories: true)
try header.write(to: headerURL, atomically: true, encoding: .utf8)
return build
}

static func generateConfig(parsed: OptionParser, config: String?) throws {
Expand Down
8 changes: 4 additions & 4 deletions Sources/ReleaseTools/meta.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
struct Metadata {
let build = "182"
let version = "v1.3.6"
let commit = "3a2ca6fcb7e926f704f136cc0b6f699bcdf1d28a"
let tags = "tags/v1.3.6"
let build = "184"
let version = "v1.3.6-2-g695ebe2"
let commit = "695ebe27d6992d8441df3551be341fd4d47b3bc7"
let tags = "heads/main"

static var main = Metadata()
}

0 comments on commit 0ec336b

Please sign in to comment.