Skip to content

Commit

Permalink
Merge pull request #107 from giginet/infoplist-version
Browse files Browse the repository at this point in the history
Add CFBundleVersion and CFBundleShortVersionString to Info.plist
  • Loading branch information
giginet authored Oct 10, 2023
2 parents 1d89d20 + 42dfdbb commit f429f97
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/ScipioKit/Producer/PIF/PIFGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ private struct PIFLibraryTargetModifier {
settings[.SKIP_INSTALL] = "NO"
settings[.INSTALL_PATH] = "/usr/local/lib"
settings[.ONLY_ACTIVE_ARCH] = "NO"

settings[.GENERATE_INFOPLIST_FILE] = "YES"
// These values are required to ship built frameworks to AppStore as embedded frameworks
settings[.MARKETING_VERSION] = "1.0"
settings[.CURRENT_PROJECT_VERSION] = "1"

// Set framework type
switch buildOptions.frameworkType {
Expand Down
25 changes: 25 additions & 0 deletions Tests/ScipioKitTests/RunnerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,25 @@ private let clangPackagePath = fixturePath.appendingPathComponent("ClangPackage"
private let clangPackageWithCustomModuleMapPath = fixturePath.appendingPathComponent("ClangPackageWithCustomModuleMap")
private let clangPackageWithUmbrellaDirectoryPath = fixturePath.appendingPathComponent("ClangPackageWithUmbrellaDirectory")

private struct InfoPlist: Decodable {
var bundleVersion: String
var bundleShortVersionString: String
var bundleExecutable: String

enum CodingKeys: String, CodingKey {
case bundleVersion = "CFBundleVersion"
case bundleShortVersionString = "CFBundleShortVersionString"
case bundleExecutable = "CFBundleExecutable"
}
}

final class RunnerTests: XCTestCase {
private let fileManager: FileManager = .default
lazy var tempDir = fileManager.temporaryDirectory
lazy var frameworkOutputDir = tempDir.appendingPathComponent("XCFrameworks")

private let plistDecoder: PropertyListDecoder = .init()

override class func setUp() {
LoggingSystem.bootstrap { _ in SwiftLogNoOpLogHandler() }

Expand Down Expand Up @@ -75,6 +89,17 @@ final class RunnerTests: XCTestCase {
"Binary should be a dynamic library"
)

let infoPlistPath = deviceFramework.appendingPathComponent("Info.plist")
let infoPlistData = try XCTUnwrap(
fileManager.contents(atPath: infoPlistPath.path),
"Info.plist should be exist"
)

let infoPlist = try plistDecoder.decode(InfoPlist.self, from: infoPlistData)
XCTAssertEqual(infoPlist.bundleExecutable, library)
XCTAssertEqual(infoPlist.bundleVersion, "1")
XCTAssertEqual(infoPlist.bundleShortVersionString, "1.0")

XCTAssertFalse(fileManager.fileExists(atPath: simulatorFramework.path),
"Should not create Simulator framework")
}
Expand Down

0 comments on commit f429f97

Please sign in to comment.