Compare commits

...

11 Commits

Author SHA1 Message Date
Thanh Vu
ea67442fa3
Merge bcdbd68b4b into 45151c2882 2024-07-10 11:10:36 -03:00
Ernesto Cambuston
45151c2882
Allow changing macro expansions on test actions. (#1468)
* Allow to override test macroExpansions

* update doc

* style

* Address feedback from PR

* fix build

* add toJSONValue encoding
2024-07-10 12:19:30 +10:00
Thanh Vu
bcdbd68b4b Remove header 2024-01-02 11:40:27 +07:00
Thanh Vu
29c5c4bcdc Update unit test 2024-01-02 11:28:09 +07:00
Thanh Vu
665048eea2 Update xcodeproj 2024-01-02 11:21:47 +07:00
Thanh Vu
bc60348269 Update xcschemes 2023-10-31 21:22:45 +07:00
Thanh Vu
8aeb8c088e Update project.pbxproj 2023-10-31 20:53:45 +07:00
Thanh Vu
92c4092596
Merge branch 'yonaskolb:master' into master 2023-10-31 20:53:08 +07:00
Thanh Vu
60c761a9ce Add unit test and example 2023-10-31 20:52:26 +07:00
Thanh Vu
f28d3caa3b Update ProjectSpec.md 2023-09-07 14:44:12 +07:00
Thanh Vu
02007ae92d Allow lookup template variables from globalTemplateAttributes 2023-09-07 11:43:47 +07:00
14 changed files with 352 additions and 4 deletions

View File

@ -35,6 +35,7 @@ You can also use environment variables in your configuration file, by using `${S
- [Legacy Target](#legacy-target)
- [Aggregate Target](#aggregate-target)
- [Target Template](#target-template)
- [Global Template Attributes](#global-template-attributes)
- [Scheme](#scheme)
- [Build](#build)
- [Common Build Action options](#common-build-action-options)
@ -974,6 +975,15 @@ targetTemplates:
- ${frameworkName}/${target_name}
```
## Global template attributes
This is place to define global variables used to resolve missing `${target_name}` within each template. This also helps share attributes between yaml files.
```yaml
globalTemplateAttributes:
version: legacy
```
## Scheme
Schemes allows for more control than the convenience [Target Scheme](#target-scheme) on [Target](#target)
@ -1039,7 +1049,7 @@ The different actions share some properties:
- [ ] **askForAppToLaunch**: **Bool** - `run` and `profile` actions can define the executable set to ask to launch. This defaults to false.
- [ ] **launchAutomaticallySubstyle**: **String** - `run` action can define the launch automatically substyle ('2' for extensions).
- [ ] **storeKitConfiguration**: **String** - `run` action can specify a storekit configuration. See [Options](#options).
- [ ] **macroExpansion**: **String** - `run` action can define the macro expansion from other target. This defaults to nil.
- [ ] **macroExpansion**: **String** - `run` and `test` action can define the macro expansion from other target. This defaults to nil.
### Execution Action

View File

@ -220,6 +220,7 @@ public struct Scheme: Equatable {
public var captureScreenshotsAutomatically: Bool
public var deleteScreenshotsWhenEachTestSucceeds: Bool
public var testPlans: [TestPlan]
public var macroExpansion: String?
public struct TestTarget: Equatable, ExpressibleByStringLiteral {
@ -286,7 +287,8 @@ public struct Scheme: Equatable {
debugEnabled: Bool = debugEnabledDefault,
customLLDBInit: String? = nil,
captureScreenshotsAutomatically: Bool = captureScreenshotsAutomaticallyDefault,
deleteScreenshotsWhenEachTestSucceeds: Bool = deleteScreenshotsWhenEachTestSucceedsDefault
deleteScreenshotsWhenEachTestSucceeds: Bool = deleteScreenshotsWhenEachTestSucceedsDefault,
macroExpansion: String? = nil
) {
self.config = config
self.gatherCoverageData = gatherCoverageData
@ -304,6 +306,7 @@ public struct Scheme: Equatable {
self.customLLDBInit = customLLDBInit
self.captureScreenshotsAutomatically = captureScreenshotsAutomatically
self.deleteScreenshotsWhenEachTestSucceeds = deleteScreenshotsWhenEachTestSucceeds
self.macroExpansion = macroExpansion
}
public var shouldUseLaunchSchemeArgsEnv: Bool {
@ -620,6 +623,7 @@ extension Scheme.Test: JSONObjectConvertible {
customLLDBInit = jsonDictionary.json(atKeyPath: "customLLDBInit")
captureScreenshotsAutomatically = jsonDictionary.json(atKeyPath: "captureScreenshotsAutomatically") ?? Scheme.Test.captureScreenshotsAutomaticallyDefault
deleteScreenshotsWhenEachTestSucceeds = jsonDictionary.json(atKeyPath: "deleteScreenshotsWhenEachTestSucceeds") ?? Scheme.Test.deleteScreenshotsWhenEachTestSucceedsDefault
macroExpansion = jsonDictionary.json(atKeyPath: "macroExpansion")
}
}
@ -636,6 +640,7 @@ extension Scheme.Test: JSONEncodable {
"language": language,
"region": region,
"coverageTargets": coverageTargets.map { $0.reference },
"macroExpansion": macroExpansion
]
if gatherCoverageData != Scheme.Test.gatherCoverageDataDefault {

View File

@ -66,6 +66,10 @@ private func resolveTemplates(jsonDictionary: JSONDictionary, templateStructure:
if let templateAttributes = reference["templateAttributes"] as? [String: String] {
reference = reference.expand(variables: templateAttributes)
}
if let globalVariables = jsonDictionary["globalTemplateAttributes"] as? [String: String] {
reference = reference.expand(variables: globalVariables)
}
}
baseDictionary[referenceName] = reference
}

View File

@ -289,9 +289,18 @@ public class SchemeGenerator {
let testBuildableEntries = buildActionEntries.filter({ $0.buildFor.contains(.testing) }) + testBuildTargetEntries
let testMacroExpansionBuildableRef = testBuildableEntries.map(\.buildableReference).contains(buildableReference) ? buildableReference : testBuildableEntries.first?.buildableReference
let testMacroExpansion: XCScheme.BuildableReference = buildActionEntries.first(
where: { value in
if let macroExpansion = scheme.test?.macroExpansion {
return value.buildableReference.blueprintName == macroExpansion
}
return false
}
)?.buildableReference ?? testMacroExpansionBuildableRef ?? buildableReference
let testAction = XCScheme.TestAction(
buildConfiguration: scheme.test?.config ?? defaultDebugConfig.name,
macroExpansion: testMacroExpansionBuildableRef,
macroExpansion: testMacroExpansion,
testables: testables,
testPlans: testPlans.isEmpty ? nil : testPlans,
preActions: scheme.test?.preActions.map(getExecutionAction) ?? [],

View File

@ -0,0 +1 @@
API_PATH = https://dev.google.com

View File

@ -0,0 +1 @@
API_PATH = https://release.google.com

View File

@ -0,0 +1,15 @@
import UIKit
import MobileCoreServices
class ContentBlockerRequestHandler: NSObject, NSExtensionRequestHandling {
func beginRequest(with context: NSExtensionContext) {
let attachment = NSItemProvider(contentsOf: Bundle.main.url(forResource: "blockerList", withExtension: "json"))!
let item = NSExtensionItem()
item.attachments = [attachment]
context.completeRequest(returningItems: [item], completionHandler: nil)
}
}

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.Safari.content-blocker</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).ContentBlockerRequestHandler</string>
</dict>
</dict>
</plist>

View File

@ -0,0 +1,10 @@
[
{
"action": {
"type": "block"
},
"trigger": {
"url-filter": "webkit.svg"
}
}
]

View File

@ -76,6 +76,7 @@
3BBCA6F76E5F212E9C55FB78 /* BundleX.bundle in Copy Bundle Resources */ = {isa = PBXBuildFile; fileRef = 45C12576F5AA694DD0CE2132 /* BundleX.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3C5134EE524310ACF7B7CD6E /* ExtensionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CAF6C55B555E3E1352645B6 /* ExtensionDelegate.swift */; };
3DF22C477446669094AC7C8C /* ExternalTarget.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F6ADE654A3459AFDA2CC0CD3 /* ExternalTarget.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
419BA91BBFD0053822D29F8B /* ContentBlockerRequestHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFD19E77891EFBB771E7C1F6 /* ContentBlockerRequestHandler.swift */; };
447D59BE2E0993D7245EA247 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3797E591F302ECC0AA2FC607 /* Assets.xcassets */; };
45E6702CD9C088FF1FC25F34 /* App_watchOS.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = A680BE9F68A255B0FB291AE6 /* App_watchOS.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
470D3493CDBFE56E2083A5FD /* BundleY.bundle in Copy Bundle Resources */ = {isa = PBXBuildFile; fileRef = E3958AB20082EA12D4D5E60C /* BundleY.bundle */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
@ -100,6 +101,7 @@
61401517ECCEB2362582B5DA /* libEndpointSecurity.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 0BC75409252FF15F540FBB7B /* libEndpointSecurity.tbd */; };
61516CAC12B2843FBC4572E6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 59DA55A04FA2366B5D0BEEFF /* Assets.xcassets */; };
61601545B6BE00CA74A4E38F /* SceneKitCatalog.scnassets in Resources */ = {isa = PBXBuildFile; fileRef = C9E358FBE2B54D2B5C7FD609 /* SceneKitCatalog.scnassets */; };
61E7E700A540CA86CFE30987 /* blockerList.json in Resources */ = {isa = PBXBuildFile; fileRef = B003E6782AAF80CE3DC662F4 /* blockerList.json */; };
6241507B4947B0B65429587C /* ExternalTarget.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F6ADE654A3459AFDA2CC0CD3 /* ExternalTarget.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
632774E7F21CCB386A76B2A8 /* MessagesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B198242976C3395E31FE000A /* MessagesViewController.swift */; };
63D8E7F00276736EDA62D227 /* Framework2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3EF21DF245F66BEF5446AAEF /* Framework2.framework */; platformFilter = ios; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@ -724,6 +726,7 @@
/* Begin PBXFileReference section */
0095836FE59395511E0CB4F0 /* CrossOverlayFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CrossOverlayFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; };
01E6934B571B91EAAFF0EDCB /* Resource.abc */ = {isa = PBXFileReference; path = Resource.abc; sourceTree = "<group>"; };
020B4FF64D029A2F6B13984D /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
020E4DA91C9132845CAFDC5D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
039F208D1138598CE060F140 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
03CD22B8CD2E91BB97CC534E /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
@ -763,6 +766,7 @@
2F430AABE04B7499B458D9DB /* SwiftFileInDotPath.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftFileInDotPath.swift; sourceTree = "<group>"; };
3096A0760969873D46F80A92 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
325F18855099386B08DD309B /* Resource.abcd */ = {isa = PBXFileReference; path = Resource.abcd; sourceTree = "<group>"; };
334B75B25BEE708C56586797 /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
33F6DCDC37D2E66543D4965D /* App_macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App_macOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
34F13B632328979093CE6056 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
3571E41E19A5AB8AAAB04109 /* StandaloneAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = StandaloneAssets.xcassets; sourceTree = "<group>"; };
@ -774,6 +778,8 @@
3ED831531AA349CCC19B258B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
3EF21DF245F66BEF5446AAEF /* Framework2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Framework2.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3FC04772130400920D68A167 /* App_Clip_Tests.xctest */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = App_Clip_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
4060DCDEBE331FD9C0D33D14 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
40707675B7DC5C5158C16329 /* ContentBlocker.appex */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "wrapper.app-extension"; path = ContentBlocker.appex; sourceTree = BUILT_PRODUCTS_DIR; };
407C3F0009FDCE5B1B7DC2A8 /* App_supportedDestinations.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = App_supportedDestinations.app; sourceTree = BUILT_PRODUCTS_DIR; };
40863AE6202CFCD0529D8438 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
41FC82ED1C4C3B7B3D7B2FB7 /* Framework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Framework.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@ -841,6 +847,7 @@
AEBCA8CFF769189C0D52031E /* App_iOS.xctestplan */ = {isa = PBXFileReference; path = App_iOS.xctestplan; sourceTree = "<group>"; };
AEDB7833B8AE2126630D6FCB /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
AEEFDE76B5FEC833403C0869 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
B003E6782AAF80CE3DC662F4 /* blockerList.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = blockerList.json; sourceTree = "<group>"; };
B17B8D9C9B391332CD176A35 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LocalizedStoryboard.storyboard; sourceTree = "<group>"; };
B198242976C3395E31FE000A /* MessagesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesViewController.swift; sourceTree = "<group>"; };
B1C33BB070583BE3B0EC0E68 /* App_iOS.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = App_iOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -873,6 +880,7 @@
D7E73F4E11A4B74449E7FDFE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
D8A016580A3B8F72B820BFBF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
DAA7880242A9DE61E68026CC /* Folder */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Folder; sourceTree = SOURCE_ROOT; };
DFD19E77891EFBB771E7C1F6 /* ContentBlockerRequestHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentBlockerRequestHandler.swift; sourceTree = "<group>"; };
DFE6A6FAAFF701FE729293DE /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
E0F31A9DE15B210D101AFC81 /* CrossOverlayFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CrossOverlayFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E3958AB20082EA12D4D5E60C /* BundleY.bundle */ = {isa = PBXFileReference; lastKnownFileType = wrapper.cfbundle; path = BundleY.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
@ -1126,6 +1134,7 @@
BAE6C12745737019DC9E98BF /* App_watchOS */,
795B8D70B674C850B57DD39D /* App_watchOS Extension */,
6DBE0EE90642BB3F6E58AD43 /* Configs */,
F1FBA0D5C2FF5CB9E3DF1C94 /* ContentBlocker */,
3F2E22B7AB20FA42CD205C2A /* CopyFiles */,
ED8625A7E716E1BA50AB88AB /* CrossOverlayFramework */,
FCC084D4F8992BBC49983A38 /* CustomGroup */,
@ -1414,6 +1423,7 @@
A680BE9F68A255B0FB291AE6 /* App_watchOS.app */,
84317819C92F78425870E483 /* BundleX.bundle */,
BB677D970923F663D846D7E0 /* BundleY.bundle */,
40707675B7DC5C5158C16329 /* ContentBlocker.appex */,
8FE05BF7897ECFD58B7AC8B1 /* CrossOverlayFramework.framework */,
E0F31A9DE15B210D101AFC81 /* CrossOverlayFramework.framework */,
0095836FE59395511E0CB4F0 /* CrossOverlayFramework.framework */,
@ -1446,6 +1456,15 @@
name = Products;
sourceTree = "<group>";
};
AF78B31F5BDF95A9589B3879 /* legacy */ = {
isa = PBXGroup;
children = (
020B4FF64D029A2F6B13984D /* Debug.xcconfig */,
334B75B25BEE708C56586797 /* Release.xcconfig */,
);
path = legacy;
sourceTree = "<group>";
};
BAE6C12745737019DC9E98BF /* App_watchOS */ = {
isa = PBXGroup;
children = (
@ -1477,6 +1496,14 @@
path = iMessageExtension;
sourceTree = "<group>";
};
C273E3A2CF5F0D2308907EB1 /* Configs */ = {
isa = PBXGroup;
children = (
AF78B31F5BDF95A9589B3879 /* legacy */,
);
path = Configs;
sourceTree = "<group>";
};
C81493FAD71E9A9A19E00AD5 /* App_Clip */ = {
isa = PBXGroup;
children = (
@ -1557,6 +1584,17 @@
path = App_macOS;
sourceTree = "<group>";
};
F1FBA0D5C2FF5CB9E3DF1C94 /* ContentBlocker */ = {
isa = PBXGroup;
children = (
C273E3A2CF5F0D2308907EB1 /* Configs */,
B003E6782AAF80CE3DC662F4 /* blockerList.json */,
DFD19E77891EFBB771E7C1F6 /* ContentBlockerRequestHandler.swift */,
4060DCDEBE331FD9C0D33D14 /* Info.plist */,
);
path = ContentBlocker;
sourceTree = "<group>";
};
FC1515684236259C50A7747F /* Frameworks */ = {
isa = PBXGroup;
children = (
@ -2334,6 +2372,22 @@
productReference = 3EF21DF245F66BEF5446AAEF /* Framework2.framework */;
productType = "com.apple.product-type.framework";
};
CE850EC53E9530D777ED6B31 /* ContentBlocker */ = {
isa = PBXNativeTarget;
buildConfigurationList = E52CEBE94EB3DA1F6DECC49F /* Build configuration list for PBXNativeTarget "ContentBlocker" */;
buildPhases = (
3EF36228A8A64153AF4A166C /* Sources */,
F0E27F118501847320425EB6 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = ContentBlocker;
productName = ContentBlocker;
productReference = 40707675B7DC5C5158C16329 /* ContentBlocker.appex */;
productType = "com.apple.product-type.app-extension";
};
D137C04B64B7052419A2DF4E /* App_Clip */ = {
isa = PBXNativeTarget;
buildConfigurationList = 07B4E73E56B7C2C80DE2A378 /* Build configuration list for PBXNativeTarget "App_Clip" */;
@ -2516,6 +2570,7 @@
307AE3FA155FFD09B74AE351 /* App_watchOS Extension */,
DA40AB367B606CCE2FDD398D /* BundleX */,
271CAC331D24F4F7E12C819C /* BundleY */,
CE850EC53E9530D777ED6B31 /* ContentBlocker */,
0CE8BE7C80651629EC056066 /* CrossOverlayFramework_iOS */,
2F4FEAEFD7EE82DC49D899FC /* CrossOverlayFramework_macOS */,
3BF66A4668DFAF9338791F60 /* CrossOverlayFramework_tvOS */,
@ -2653,6 +2708,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
F0E27F118501847320425EB6 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
61E7E700A540CA86CFE30987 /* blockerList.json in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
@ -2911,6 +2974,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
3EF36228A8A64153AF4A166C /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
419BA91BBFD0053822D29F8B /* ContentBlockerRequestHandler.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
40A4456A24F99A01E340C032 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@ -4025,6 +4096,23 @@
};
name = "Production Release";
};
18AA8BA9237D5BC52525C664 /* Production Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 334B75B25BEE708C56586797 /* Release.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "Apple Development";
INFOPLIST_FILE = ContentBlocker/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.project.ContentBlocker;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Production Release";
};
18B5349AE18B7183BE4B4363 /* Staging Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -4139,6 +4227,23 @@
};
name = "Test Release";
};
1D6D36790F00BE5A86FF54A4 /* Staging Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 334B75B25BEE708C56586797 /* Release.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "Apple Development";
INFOPLIST_FILE = ContentBlocker/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.project.ContentBlocker;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Staging Release";
};
1FB2AFB2F45076B4A047499E /* Staging Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -7049,6 +7154,23 @@
};
name = "Production Debug";
};
B2D62E426DBC2DE731C9790D /* Test Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 020B4FF64D029A2F6B13984D /* Debug.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "Apple Development";
INFOPLIST_FILE = ContentBlocker/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.project.ContentBlocker;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Test Debug";
};
B3B2FEA08FA4ACD18FDF9BC2 /* Production Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -7806,6 +7928,40 @@
};
name = "Staging Debug";
};
D69E04FC7BE3A6968EF236C1 /* Staging Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 020B4FF64D029A2F6B13984D /* Debug.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "Apple Development";
INFOPLIST_FILE = ContentBlocker/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.project.ContentBlocker;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Staging Debug";
};
D6A2E246E9EEDAA18B76937A /* Production Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 020B4FF64D029A2F6B13984D /* Debug.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "Apple Development";
INFOPLIST_FILE = ContentBlocker/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.project.ContentBlocker;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Production Debug";
};
D70B7AB6D219453ABF475EED /* Production Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -8772,6 +8928,23 @@
};
name = "Staging Release";
};
FFA29E0E53E5B870627E1A2C /* Test Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 334B75B25BEE708C56586797 /* Release.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "Apple Development";
INFOPLIST_FILE = ContentBlocker/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.project.ContentBlocker;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = "Test Release";
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@ -9321,6 +9494,19 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "Production Debug";
};
E52CEBE94EB3DA1F6DECC49F /* Build configuration list for PBXNativeTarget "ContentBlocker" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D6A2E246E9EEDAA18B76937A /* Production Debug */,
18AA8BA9237D5BC52525C664 /* Production Release */,
D69E04FC7BE3A6968EF236C1 /* Staging Debug */,
1D6D36790F00BE5A86FF54A4 /* Staging Release */,
B2D62E426DBC2DE731C9790D /* Test Debug */,
FFA29E0E53E5B870627E1A2C /* Test Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "Production Debug";
};
ED1A174BA92C6E5172B519B7 /* Build configuration list for PBXNativeTarget "iMessageExtension" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@ -16,6 +16,8 @@ options:
buildPhase: none
abcd:
buildPhase: none
globalTemplateAttributes:
version: legacy
fileGroups:
- Configs
- FileGroup
@ -79,7 +81,9 @@ targets:
legacy:
toolPath: /usr/bin/true
passSettings: true
ContentBlocker:
templates:
- ContentBlockerTemplate
App_macOS:
type: application
platform: macOS
@ -521,6 +525,20 @@ schemes:
targetTemplates:
MyTemplate:
scheme: {}
ContentBlockerTemplate:
platform: iOS
type: app-extension
settings:
CODE_SIGN_IDENTITY: Apple Development
configFiles:
Test Debug: ContentBlocker/Configs/${version}/Debug.xcconfig
Staging Debug: ContentBlocker/Configs/${version}/Debug.xcconfig
Production Debug: ContentBlocker/Configs/${version}/Debug.xcconfig
Test Release: ContentBlocker/Configs/${version}/Release.xcconfig
Staging Release: ContentBlocker/Configs/${version}/Release.xcconfig
Production Release: ContentBlocker/Configs/${version}/Release.xcconfig
sources:
- ContentBlocker
aggregateTargets:
SuperTarget:
attributes:

View File

@ -0,0 +1,32 @@
targetTemplates:
ContentBlockerTemplate:
platform: iOS
type: app-extension
settings:
CODE_SIGN_IDENTITY: Apple Development
configFiles:
Test Debug: ContentBlocker/Configs/${version}/Debug.xcconfig
Staging Debug: ContentBlocker/Configs/${version}/Debug.xcconfig
Production Debug: ContentBlocker/Configs/${version}/Debug.xcconfig
Test Release: ContentBlocker/Configs/${version}/Release.xcconfig
Staging Release: ContentBlocker/Configs/${version}/Release.xcconfig
Production Release: ContentBlocker/Configs/${version}/Release.xcconfig
sources:
- ContentBlocker
globalTemplateAttributes:
version: legacy
name: Demo
options:
createIntermediateGroups: True
targets:
Demo:
type: application
platform: iOS
deploymentTarget: "10.0"
sources:
- DemoXcodeGenGlobalTemplateAttribute
ContentBlocker:
templates:
- ContentBlockerTemplate

View File

@ -285,6 +285,15 @@ class SpecLoadingTests: XCTestCase {
]
try expect(project.targets.last?.sources) == ["SomeTarget", "doesWin", "templateVariable"]
}
$0.it("lookup global template attributes") {
let path = fixturePath + "global_template_attributes_test.yml"
let project = try loadSpec(path: path)
let extensionTarget = project.targets.first!
try expect(extensionTarget.configFiles["Production Debug"]) == "ContentBlocker/Configs/legacy/Debug.xcconfig"
try expect(extensionTarget.configFiles["Production Release"]) == "ContentBlocker/Configs/legacy/Release.xcconfig"
}
}
}

View File

@ -476,6 +476,41 @@ class SchemeGeneratorTests: XCTestCase {
let xcodeProject = try project.generateXcodeProject()
let xcscheme = try unwrap(xcodeProject.sharedData?.schemes.first)
try expect(xcscheme.testAction?.macroExpansion?.buildableName) == "MyApp.app"
try expect(xcscheme.launchAction?.macroExpansion?.buildableName) == "MyApp.app"
}
$0.it("allows to override test macroExpansion") {
let app = Target(
name: "MyApp",
type: .application,
platform: .iOS,
dependencies: [Dependency(type: .target, reference: "MyAppExtension", embed: false)]
)
let `extension` = Target(
name: "MyAppExtension",
type: .appExtension,
platform: .iOS
)
let appTarget = Scheme.BuildTarget(target: .local(app.name), buildTypes: [.running])
let extensionTarget = Scheme.BuildTarget(target: .local(`extension`.name), buildTypes: [.running])
let scheme = Scheme(
name: "TestScheme",
build: Scheme.Build(targets: [appTarget, extensionTarget]),
run: Scheme.Run(config: "Debug", macroExpansion: "MyApp"),
test: .init(macroExpansion: "MyAppExtension")
)
let project = Project(
name: "test",
targets: [app, `extension`],
schemes: [scheme]
)
let xcodeProject = try project.generateXcodeProject()
let xcscheme = try unwrap(xcodeProject.sharedData?.schemes.first)
try expect(xcscheme.testAction?.macroExpansion?.buildableName) == "MyAppExtension.appex"
try expect(xcscheme.launchAction?.macroExpansion?.buildableName) == "MyApp.app"
}