Skip to content

Commit b6ac25d

Browse files
authored
Merge pull request #46 from yonaskolb/application_platform_templates
Product + Platform setting presets
2 parents 1836301 + 016040d commit b6ac25d

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

Fixtures/TestProject/GeneratedProject.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@
365365
XCBC19846901 /* Debug */ = {
366366
isa = XCBuildConfiguration;
367367
buildSettings = {
368-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
369368
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
370369
CURRENT_PROJECT_VERSION = 1;
371370
DEFINES_MODULE = YES;
@@ -453,7 +452,6 @@
453452
XCBC60448901 /* Release */ = {
454453
isa = XCBuildConfiguration;
455454
buildSettings = {
456-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
457455
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
458456
BUNDLE_LOADER = "$(TEST_HOST)";
459457
INFOPLIST_FILE = TestProjectTests/Info.plist;
@@ -530,7 +528,6 @@
530528
XCBC89077001 /* Debug */ = {
531529
isa = XCBuildConfiguration;
532530
buildSettings = {
533-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
534531
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
535532
BUNDLE_LOADER = "$(TEST_HOST)";
536533
INFOPLIST_FILE = TestProjectTests/Info.plist;
@@ -548,7 +545,6 @@
548545
XCBC89204001 /* Release */ = {
549546
isa = XCBuildConfiguration;
550547
buildSettings = {
551-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
552548
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
553549
CURRENT_PROJECT_VERSION = 1;
554550
DEFINES_MODULE = YES;

SettingPresets/Platforms/iOS.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ SDKROOT: iphoneos
33
IPHONEOS_DEPLOYMENT_TARGET: 10.0
44
TARGETED_DEVICE_FAMILY: '1,2'
55
ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
6-
CODE_SIGN_IDENTITY[sdk=iphoneos*]: iPhone Developer
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CODE_SIGN_IDENTITY[sdk=iphoneos*]: iPhone Developer

Sources/XcodeGenKit/SettingsBuilder.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ extension ProjectSpec {
3434

3535
buildSettings += SettingsPresetFile.platform(target.platform).getBuildSettings()
3636
buildSettings += SettingsPresetFile.product(target.type).getBuildSettings()
37+
buildSettings += SettingsPresetFile.productPlatform(target.type, target.platform).getBuildSettings()
3738
buildSettings += getBuildSettings(settings: target.settings, config: config)
3839

3940
return buildSettings
@@ -76,7 +77,7 @@ extension SettingsPresetFile {
7677
switch self {
7778
case .base, .config, .platform:
7879
print("No \"\(name)\" settings found at \(settingsPath)")
79-
case .product:
80+
case .product, .productPlatform:
8081
break
8182
}
8283
return nil

Sources/XcodeGenKit/SettingsPresetFile.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ public enum SettingsPresetFile {
1414
case config(ConfigType)
1515
case platform(Platform)
1616
case product(PBXProductType)
17+
case productPlatform(PBXProductType,Platform)
1718
case base
1819

1920
var path: String {
2021
switch self {
2122
case let .config(config): return "Configs/\(config.rawValue)"
2223
case let .platform(platform): return "Platforms/\(platform.rawValue)"
2324
case let .product(product): return "Products/\(product.name)"
25+
case let .productPlatform(product, platform): return "Product_Platform/\(product.name)_\(platform.rawValue)"
2426
case .base: return "base"
2527
}
2628
}
@@ -30,6 +32,7 @@ public enum SettingsPresetFile {
3032
case let .config(config): return "\(config.rawValue) config"
3133
case let .platform(platform): return platform.rawValue
3234
case let .product(product): return product.name
35+
case let .productPlatform(product, platform): return "\(platform) \(product)"
3336
case .base: return "base"
3437
}
3538
}

Tests/XcodeGenKitTests/ProjectGeneratorTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ func projectGeneratorTests() {
6666
try expect(debugProjectSettings.equals(buildSettings)).beTrue()
6767

6868
var expectedTargetDebugSettings = BuildSettings()
69-
expectedTargetDebugSettings += SettingsPresetFile.product(.application).getBuildSettings()
7069
expectedTargetDebugSettings += SettingsPresetFile.platform(.iOS).getBuildSettings()
70+
expectedTargetDebugSettings += SettingsPresetFile.product(.application).getBuildSettings()
71+
expectedTargetDebugSettings += SettingsPresetFile.productPlatform(.application,.iOS).getBuildSettings()
7172
expectedTargetDebugSettings += ["SETTING 2": "value 2", "SETTING 3": "value 3", "SETTING": "value"]
7273

7374
try expect(targetDebugSettings.equals(expectedTargetDebugSettings)).beTrue()

0 commit comments

Comments
 (0)