From 86b3e1334ed5a1f7005280245f616eb0ce262b60 Mon Sep 17 00:00:00 2001 From: Yonas Kolb Date: Wed, 30 Aug 2017 17:19:53 +0200 Subject: [PATCH 1/2] load setting preset for combination of product and platform --- Sources/XcodeGenKit/SettingsBuilder.swift | 3 ++- Sources/XcodeGenKit/SettingsPresetFile.swift | 3 +++ Tests/XcodeGenKitTests/ProjectGeneratorTests.swift | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Sources/XcodeGenKit/SettingsBuilder.swift b/Sources/XcodeGenKit/SettingsBuilder.swift index c579665a..33c6557b 100644 --- a/Sources/XcodeGenKit/SettingsBuilder.swift +++ b/Sources/XcodeGenKit/SettingsBuilder.swift @@ -34,6 +34,7 @@ extension ProjectSpec { buildSettings += SettingsPresetFile.platform(target.platform).getBuildSettings() buildSettings += SettingsPresetFile.product(target.type).getBuildSettings() + buildSettings += SettingsPresetFile.productPlatform(target.type, target.platform).getBuildSettings() buildSettings += getBuildSettings(settings: target.settings, config: config) return buildSettings @@ -76,7 +77,7 @@ extension SettingsPresetFile { switch self { case .base, .config, .platform: print("No \"\(name)\" settings found at \(settingsPath)") - case .product: + case .product, .productPlatform: break } return nil diff --git a/Sources/XcodeGenKit/SettingsPresetFile.swift b/Sources/XcodeGenKit/SettingsPresetFile.swift index 8f4d2c66..0314077e 100644 --- a/Sources/XcodeGenKit/SettingsPresetFile.swift +++ b/Sources/XcodeGenKit/SettingsPresetFile.swift @@ -14,6 +14,7 @@ public enum SettingsPresetFile { case config(ConfigType) case platform(Platform) case product(PBXProductType) + case productPlatform(PBXProductType,Platform) case base var path: String { @@ -21,6 +22,7 @@ public enum SettingsPresetFile { case let .config(config): return "Configs/\(config.rawValue)" case let .platform(platform): return "Platforms/\(platform.rawValue)" case let .product(product): return "Products/\(product.name)" + case let .productPlatform(product, platform): return "Product_Platform/\(product.name)_\(platform.rawValue)" case .base: return "base" } } @@ -30,6 +32,7 @@ public enum SettingsPresetFile { case let .config(config): return "\(config.rawValue) config" case let .platform(platform): return platform.rawValue case let .product(product): return product.name + case let .productPlatform(product, platform): return "\(platform) \(product)" case .base: return "base" } } diff --git a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift index 0ae3357c..e416e914 100644 --- a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift +++ b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift @@ -66,8 +66,9 @@ func projectGeneratorTests() { try expect(debugProjectSettings.equals(buildSettings)).beTrue() var expectedTargetDebugSettings = BuildSettings() - expectedTargetDebugSettings += SettingsPresetFile.product(.application).getBuildSettings() expectedTargetDebugSettings += SettingsPresetFile.platform(.iOS).getBuildSettings() + expectedTargetDebugSettings += SettingsPresetFile.product(.application).getBuildSettings() + expectedTargetDebugSettings += SettingsPresetFile.productPlatform(.application,.iOS).getBuildSettings() expectedTargetDebugSettings += ["SETTING 2": "value 2", "SETTING 3": "value 3", "SETTING": "value"] try expect(targetDebugSettings.equals(expectedTargetDebugSettings)).beTrue() From 016040d6bf4886d6f25b98306af7c331898d3f7f Mon Sep 17 00:00:00 2001 From: Yonas Kolb Date: Wed, 30 Aug 2017 17:20:13 +0200 Subject: [PATCH 2/2] move code signing settings from iOS to application_iOS --- .../TestProject/GeneratedProject.xcodeproj/project.pbxproj | 4 ---- SettingPresets/Platforms/iOS.yml | 1 - SettingPresets/Product_Platform/application_iOS.yml | 1 + 3 files changed, 1 insertion(+), 5 deletions(-) create mode 100644 SettingPresets/Product_Platform/application_iOS.yml diff --git a/Fixtures/TestProject/GeneratedProject.xcodeproj/project.pbxproj b/Fixtures/TestProject/GeneratedProject.xcodeproj/project.pbxproj index 6cb43073..b0c6ac6d 100644 --- a/Fixtures/TestProject/GeneratedProject.xcodeproj/project.pbxproj +++ b/Fixtures/TestProject/GeneratedProject.xcodeproj/project.pbxproj @@ -365,7 +365,6 @@ XCBC19846901 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; @@ -453,7 +452,6 @@ XCBC60448901 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = TestProjectTests/Info.plist; @@ -530,7 +528,6 @@ XCBC89077001 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; BUNDLE_LOADER = "$(TEST_HOST)"; INFOPLIST_FILE = TestProjectTests/Info.plist; @@ -548,7 +545,6 @@ XCBC89204001 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; diff --git a/SettingPresets/Platforms/iOS.yml b/SettingPresets/Platforms/iOS.yml index 6a78e303..623f44ca 100644 --- a/SettingPresets/Platforms/iOS.yml +++ b/SettingPresets/Platforms/iOS.yml @@ -3,4 +3,3 @@ SDKROOT: iphoneos IPHONEOS_DEPLOYMENT_TARGET: 10.0 TARGETED_DEVICE_FAMILY: '1,2' ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon -CODE_SIGN_IDENTITY[sdk=iphoneos*]: iPhone Developer diff --git a/SettingPresets/Product_Platform/application_iOS.yml b/SettingPresets/Product_Platform/application_iOS.yml new file mode 100644 index 00000000..72ab8af2 --- /dev/null +++ b/SettingPresets/Product_Platform/application_iOS.yml @@ -0,0 +1 @@ +CODE_SIGN_IDENTITY[sdk=iphoneos*]: iPhone Developer