import ProjectDescription import Foundation func getSettingsFromXCConfigFile(at path: String) -> [String: SettingValue]? { do { let contents = try String(contentsOfFile: path) return convertXCConfigFileContentToSettingsDictionary(contentsOfFile: contents) } catch { print("Error reading file at \(path): \(error)") return nil } } func convertXCConfigFileContentToSettingsDictionary(contentsOfFile contents: String) -> [String: SettingValue] { var settings = [String: SettingValue]() let lines = contents.split(whereSeparator: \.isNewline) lines.forEach { line in let parts = line.split(separator: "=", maxSplits: 1) if parts.count == 2 { let key = parts[0].trimmingCharacters(in: .whitespaces) let rawValue = parts[1].trimmingCharacters(in: .whitespaces) if rawValue.contains(" ") { let arrayValue = rawValue.split(separator: " ").map { String($0) } settings[key] = .array(arrayValue) } else { settings[key] = .string(rawValue) } } } return settings } let targetSettings = getSettingsFromXCConfigFile(at: "xcconfigs/ExampleTarget.xcconfig") let testAction = TestAction.testPlans(["Example/Example.xctestplan"]) let buildAction = BuildAction.buildAction(targets: [TargetReference.target("Example")]) let project = Project( name: "Example", settings: .settings(base: ["IPHONEOS_DEPLOYMENT_TARGET": "15.0"], configurations: [ .debug(name: "Debug", xcconfig: "xcconfigs/ExampleProject.xcconfig") ]), targets: [ .target(name: "Example", destinations: [.iPhone], product: .app, bundleId: "raizen.Acelera.Example", deploymentTargets: .iOS("15.0"), sources: ["Example/*.swift", "Example/**/*.swift"], resources: ["Example/Assets.xcassets", "Example/Base.lproj/LaunchScreen.storyboard"], settings: .settings(base: ["IPHONEOS_DEPLOYMENT_TARGET": "15.0"], configurations: [ .debug(name: "Debug", settings: targetSettings! ) ]) ) ], schemes: [ .scheme(name: "Example", shared: true, hidden: false, buildAction: buildAction, testAction: testAction ) ] )