Compare commits

...

14 Commits

Author SHA1 Message Date
Thanh Vu
22eda4da13
Merge bcdbd68b4b into f51719ce29 2024-05-22 14:39:36 +02:00
Yonas Kolb
f51719ce29
Update cache hook docs 2024-05-21 11:28:45 +10:00
Yonas Kolb
1b0720d139 Update to 2.41.0 2024-05-20 21:37:00 +10:00
Yonas Kolb
576739bcb5
Add cache command (#1476)
* add cache command

* docs: update git hook info
2024-05-20 21:32:24 +10:00
Tyler Milner
aa79a3ed0b
Fix typo in README (#1452) 2024-05-20 21:26:31 +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
21 changed files with 389 additions and 31 deletions

View File

@ -2,6 +2,16 @@
## Next Version
## 2.41.0
### Added
- Added `xcodegen cache` command that writes the cache. Useful for `post-commit` git hook integration #1476 @yonaskolb
### Changed
- Include folders in file sorting #1466 @jflan-dd
### Fixed
- Fixed `supportedDestinations` validation when it contains watchOS for multiplatform apps. #1470 @tatsuky

View File

@ -9,10 +9,14 @@ Absolutely. You will get the most out of XcodeGen by adding your project to your
>Note that you can run `xcodegen` as a step in your build process on CI.
## What happens when I switch branches
If files were added or removed in the new checkout you will most likely need to run `xcodegen` again so that your project will reference all your files. Unfortunately this is a manual step at the moment, but in the future this could be automated.
If files were added or removed in the new checkout you will most likely need to run `xcodegen` again so that your project will reference all your files.
For now you can always add xcodegen as a git `post-checkout` hook.
It's recommended to use `--use-cache` so that the project is not needlessly generated.
It's recommended to set up some [git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) to automate the process:
- run `xcodegen generate --use-cache` on the following hooks. This will make sure the project is up to date when checking out, merging and rebasing
- `post-checkout`
- `post-rewrite`
- `post-merge`
- run `xcodegen cache` on `pre-commit`. This will make sure that when switching branches the cache will be updated in case you made local changes, or are ammending a commit that added a new file.
## Can I use CocoaPods
Yes, you will just need to run `pod install` after the project is generated to integrate Cocoapods changes.

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)

View File

@ -1,6 +1,6 @@
TOOL_NAME = XcodeGen
export EXECUTABLE_NAME = xcodegen
VERSION = 2.40.1
VERSION = 2.41.0
PREFIX = /usr/local
INSTALL_PATH = $(PREFIX)/bin/$(EXECUTABLE_NAME)

View File

@ -113,7 +113,7 @@ swift run xcodegen
Add the following to your Package.swift file's dependencies:
```swift
.package(url: "https://github.com/yonaskolb/XcodeGen.git", from: "2.40.1"),
.package(url: "https://github.com/yonaskolb/XcodeGen.git", from: "2.41.0"),
```
And then import wherever needed: `import XcodeGenKit`
@ -136,7 +136,7 @@ Options:
- **--use-cache**: Used to prevent unnecessarily generating the project. If this is set, then a cache file will be written to when a project is generated. If `xcodegen` is later run but the spec and all the files it contains are the same, the project won't be generated.
- **--cache-path**: A custom path to use for your cache file. This defaults to `~/.xcodegen/cache/{PROJECT_SPEC_PATH_HASH}`
There are other commands as well such as `xcodegen dump` which lets out output the resolved spec in many different formats, or write it to a file. Use `xcodegen help` to see more detailed usage information.
There are other commands as well such as `xcodegen dump` which lets one output the resolved spec in many different formats, or write it to a file. Use `xcodegen help` to see more detailed usage information.
## Dependency Diagrams
<details>

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

@ -3,6 +3,6 @@ import ProjectSpec
import XcodeGenCLI
import Version
let version = Version("2.40.1")
let version = Version("2.41.0")
let cli = XcodeGenCLI(version: version)
cli.execute()

View File

@ -0,0 +1,44 @@
import Foundation
import PathKit
import ProjectSpec
import SwiftCLI
import XcodeGenKit
import XcodeProj
import Version
class CacheCommand: ProjectCommand {
@Key("--cache-path", description: "Where the cache file will be loaded from and save to. Defaults to ~/.xcodegen/cache/{SPEC_PATH_HASH}")
var cacheFilePath: Path?
init(version: Version) {
super.init(version: version,
name: "cache",
shortDescription: "Write the project cache")
}
override func execute(specLoader: SpecLoader, projectSpecPath: Path, project: Project) throws {
let cacheFilePath = self.cacheFilePath ?? Path("~/.xcodegen/cache/\(projectSpecPath.absolute().string.md5)").absolute()
var cacheFile: CacheFile?
// generate cache
do {
cacheFile = try specLoader.generateCacheFile()
} catch {
throw GenerationError.projectSpecParsingError(error)
}
// write cache
if let cacheFile = cacheFile {
do {
try cacheFilePath.parent().mkpath()
try cacheFilePath.write(cacheFile.string)
success("Wrote cache to \(cacheFilePath)")
} catch {
info("Failed to write cache: \(error.localizedDescription)")
}
}
}
}

View File

@ -49,7 +49,7 @@ class DumpCommand: ProjectCommand {
try file.parent().mkpath()
try file.write(output)
} else {
stdout.print(output)
success(output)
}
}
}

View File

@ -8,9 +8,6 @@ import Version
class GenerateCommand: ProjectCommand {
@Flag("-q", "--quiet", description: "Suppress all informational and success output")
var quiet: Bool
@Flag("-c", "--use-cache", description: "Use a cache for the xcodegen spec. This will prevent unnecessarily generating the project if nothing has changed")
var useCache: Bool
@ -46,7 +43,7 @@ class GenerateCommand: ProjectCommand {
Path("~/.xcodegen/cache/\(projectSpecPath.absolute().string.md5)").absolute()
var cacheFile: CacheFile?
// read cache
// generate cache
if useCache || self.cacheFilePath != nil {
do {
cacheFile = try specLoader.generateCacheFile()
@ -138,22 +135,4 @@ class GenerateCommand: ProjectCommand {
try Task.run(bash: command, directory: projectDirectory.absolute().string)
}
}
func info(_ string: String) {
if !quiet {
stdout.print(string)
}
}
func warning(_ string: String) {
if !quiet {
stdout.print(string.yellow)
}
}
func success(_ string: String) {
if !quiet {
stdout.print(string.green)
}
}
}

View File

@ -12,6 +12,9 @@ class ProjectCommand: Command {
let name: String
let shortDescription: String
@Flag("-q", "--quiet", description: "Suppress all informational and success output")
var quiet: Bool
@Key("-s", "--spec", description: "The path to the project spec file. Defaults to project.yml. (It is also possible to link to multiple spec files by comma separating them. Note that all other flags will be the same.)")
var spec: String?
@ -58,4 +61,22 @@ class ProjectCommand: Command {
}
func execute(specLoader: SpecLoader, projectSpecPath: Path, project: Project) throws {}
func info(_ string: String) {
if !quiet {
stdout.print(string)
}
}
func warning(_ string: String) {
if !quiet {
stdout.print(string.yellow)
}
}
func success(_ string: String) {
if !quiet {
stdout.print(string.green)
}
}
}

View File

@ -15,6 +15,7 @@ public class XcodeGenCLI {
description: "Generates Xcode projects",
commands: [
generateCommand,
CacheCommand(version: version),
DumpCommand(version: version),
]
)

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"
}
}
}