Compare commits

...

12 Commits

Author SHA1 Message Date
Thanh Vu
35d1749caa
Merge bcdbd68b4b into f8842228c5 2024-07-03 23:35:14 -03:00
Ernesto Cambuston
f8842228c5
Test action macroExpansion allows unavailable buildable reference. (#1471)
* fix buildable ref

* fix test

* add test
2024-07-03 21:41:03 +10:00
Kohki Miki
7eb5e9bd06
Remove GraphViz feature (#1485)
* Remove GraphViz to pass build on Xcode 16

* Update documentations
2024-07-02 17:06:02 +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
20 changed files with 345 additions and 208 deletions

View File

@ -2,6 +2,8 @@
## Next Version
- Removed `xcodegen dump --type graphviz` feature. @giginet
## 2.41.0
### Added

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

@ -18,15 +18,6 @@
"version" : "0.0.6"
}
},
{
"identity" : "graphviz",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SwiftDocOrg/GraphViz.git",
"state" : {
"revision" : "70bebcf4597b9ce33e19816d6bbd4ba9b7bdf038",
"version" : "0.2.0"
}
},
{
"identity" : "jsonutilities",
"kind" : "remoteSourceControl",

View File

@ -19,7 +19,6 @@ let package = Package(
.package(url: "https://github.com/tuist/XcodeProj.git", exact: "8.13.0"),
.package(url: "https://github.com/jakeheis/SwiftCLI.git", from: "6.0.3"),
.package(url: "https://github.com/mxcl/Version", from: "2.0.0"),
.package(url: "https://github.com/SwiftDocOrg/GraphViz.git", exact: "0.2.0"),
.package(url: "https://github.com/freddi-kit/ArtifactBundleGen", exact: "0.0.6")
],
targets: [
@ -41,7 +40,6 @@ let package = Package(
"XcodeProj",
"PathKit",
"XcodeGenCore",
"GraphViz",
], resources: [
.copy("SettingPresets")
]),

View File

@ -35,7 +35,6 @@ The project spec is a YAML or JSON file that defines your targets, configuration
- ✅ Distribute your spec amongst multiple files for easy **sharing** and overriding
- ✅ Easily create **multi-platform** frameworks
- ✅ Integrate **Carthage** frameworks without any work
- ✅ Export **Dependency Diagrams** to view in [Graphviz](https://www.graphviz.org)
Given an example project spec:
@ -138,27 +137,6 @@ Options:
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>
<summary>Click to expand!</summary>
#### How to export dependency diagrams:
To stdout:
```
xcodegen dump --type graphviz
```
To a file:
```
xcodegen dump --type graphviz --file Graph.viz
```
During implementation, `graphviz` formatting was validated using [GraphvizOnline](https://dreampuf.github.io/GraphvizOnline/), [WebGraphviz](http://www.webgraphviz.com), and [Graphviz on MacOS](https://graphviz.org).
</details>
## Editing
```shell
git clone https://github.com/yonaskolb/XcodeGen.git

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

@ -41,8 +41,6 @@ class DumpCommand: ProjectCommand {
output = try Yams.dump(object: project.toJSONDictionary())
case .summary:
output = project.debugDescription
case .graphviz:
output = GraphVizGenerator().generateModuleGraphViz(targets: project.targets)
}
if let file = file {
@ -61,7 +59,6 @@ private enum DumpType: String, ConvertibleFromString, CaseIterable {
case parsedJSON = "parsed-json"
case parsedYaml = "parsed-yaml"
case summary
case graphviz
static var defaultValue: DumpType { .yaml }
}

View File

@ -1,66 +0,0 @@
import DOT
import Foundation
import GraphViz
import ProjectSpec
extension Dependency {
var graphVizName: String {
switch self.type {
case .bundle, .package, .sdk, .framework, .carthage:
return "[\(self.type)]\\n\(reference)"
case .target:
return reference
}
}
}
extension Dependency.DependencyType: CustomStringConvertible {
public var description: String {
switch self {
case .bundle: return "bundle"
case .package: return "package"
case .framework: return "framework"
case .carthage: return "carthage"
case .sdk: return "sdk"
case .target: return "target"
}
}
}
extension Node {
init(target: Target) {
self.init(target.name)
self.shape = .box
}
init(dependency: Dependency) {
self.init(dependency.reference)
self.shape = .box
self.label = dependency.graphVizName
}
}
public class GraphVizGenerator {
public init() {}
public func generateModuleGraphViz(targets: [Target]) -> String {
return DOTEncoder().encode(generateGraph(targets: targets))
}
func generateGraph(targets: [Target]) -> Graph {
var graph = Graph(directed: true)
targets.forEach { target in
target.dependencies.forEach { dependency in
let from = Node(target: target)
graph.append(from)
let to = Node(dependency: dependency)
graph.append(to)
var edge = Edge(from: from, to: to)
edge.style = .dashed
graph.append(edge)
}
}
return graph
}
}

View File

@ -286,10 +286,12 @@ public class SchemeGenerator {
let testPlans = scheme.test?.testPlans.enumerated().map { index, testPlan in
XCScheme.TestPlanReference(reference: "container:\(testPlan.path)", default: defaultTestPlanIndex == index)
} ?? []
let testBuildableEntries = buildActionEntries.filter({ $0.buildFor.contains(.testing) }) + testBuildTargetEntries
let testMacroExpansionBuildableRef = testBuildableEntries.map(\.buildableReference).contains(buildableReference) ? buildableReference : testBuildableEntries.first?.buildableReference
let testAction = XCScheme.TestAction(
buildConfiguration: scheme.test?.config ?? defaultDebugConfig.name,
macroExpansion: buildableReference,
macroExpansion: testMacroExpansionBuildableRef,
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

@ -1,104 +0,0 @@
import ProjectSpec
import Spectre
@testable import XcodeGenKit
import XCTest
private let app = Target(
name: "MyApp",
type: .application,
platform: .iOS,
settings: Settings(buildSettings: ["SETTING_1": "VALUE"]),
dependencies: [
Dependency(type: .target, reference: "MyInternalFramework"),
Dependency(type: .bundle, reference: "Resources"),
Dependency(type: .carthage(findFrameworks: true, linkType: .static), reference: "MyStaticFramework"),
Dependency(type: .carthage(findFrameworks: true, linkType: .dynamic), reference: "MyDynamicFramework"),
Dependency(type: .framework, reference: "MyExternalFramework"),
Dependency(type: .package(products: ["MyPackage"]), reference: "MyPackage"),
Dependency(type: .sdk(root: "MySDK"), reference: "MySDK"),
]
)
private let framework = Target(
name: "MyFramework",
type: .framework,
platform: .iOS,
settings: Settings(buildSettings: ["SETTING_2": "VALUE"])
)
private let uiTest = Target(
name: "MyAppUITests",
type: .uiTestBundle,
platform: .iOS,
settings: Settings(buildSettings: ["SETTING_3": "VALUE"]),
dependencies: [Dependency(type: .target, reference: "MyApp")]
)
private let targets = [app, framework, uiTest]
class GraphVizGeneratorTests: XCTestCase {
func testGraphOutput() throws {
describe {
let graph = GraphVizGenerator().generateGraph(targets: targets)
$0.it("generates the expected number of nodes") {
try expect(graph.nodes.count) == 16
}
$0.it("generates box nodes") {
try expect(graph.nodes.filter { $0.shape == .box }.count) == 16
}
$0.it("generates the expected carthage nodes") {
try expect(graph.nodes.filter { $0.label?.contains("[carthage]") ?? false }.count) == 2
}
$0.it("generates the expected sdk nodes") {
try expect(graph.nodes.filter { $0.label?.contains("[sdk]") ?? false }.count) == 1
}
$0.it("generates the expected Framework nodes") {
try expect(graph.nodes.filter { $0.label?.contains("[framework]") ?? false }.count) == 1
}
$0.it("generates the expected package nodes") {
try expect(graph.nodes.filter { $0.label?.contains("[package]") ?? false }.count) == 1
}
$0.it("generates the expected bundle nodes") {
try expect(graph.nodes.filter { $0.label?.contains("[bundle]") ?? false }.count) == 1
}
$0.it("generates the expected edges") {
try expect(graph.edges.count) == 8
}
$0.it("generates dashed edges") {
try expect(graph.edges.filter { $0.style == .dashed }.count) == 8
}
$0.it("generates the expected output") {
let output = GraphVizGenerator().generateModuleGraphViz(targets: targets)
try expect(output) == """
digraph {
MyApp [shape=box]
MyInternalFramework [label=MyInternalFramework shape=box]
MyApp [shape=box]
Resources [label="[bundle]\\nResources" shape=box]
MyApp [shape=box]
MyStaticFramework [label="[carthage]\\nMyStaticFramework" shape=box]
MyApp [shape=box]
MyDynamicFramework [label="[carthage]\\nMyDynamicFramework" shape=box]
MyApp [shape=box]
MyExternalFramework [label="[framework]\\nMyExternalFramework" shape=box]
MyApp [shape=box]
MyPackage [label="[package]\\nMyPackage" shape=box]
MyApp [shape=box]
MySDK [label="[sdk]\\nMySDK" shape=box]
MyAppUITests [shape=box]
MyApp [label=MyApp shape=box]
MyApp -> MyInternalFramework [style=dashed]
MyApp -> Resources [style=dashed]
MyApp -> MyStaticFramework [style=dashed]
MyApp -> MyDynamicFramework [style=dashed]
MyApp -> MyExternalFramework [style=dashed]
MyApp -> MyPackage [style=dashed]
MyApp -> MySDK [style=dashed]
MyAppUITests -> MyApp [style=dashed]
}
"""
}
}
}
}

View File

@ -479,6 +479,46 @@ class SchemeGeneratorTests: XCTestCase {
try expect(xcscheme.launchAction?.macroExpansion?.buildableName) == "MyApp.app"
}
$0.it("generates scheme with macroExpansion from tests when the main target is not part of the scheme") {
let app = Target(
name: "MyApp",
type: .application,
platform: .iOS,
dependencies: []
)
let mockApp = Target(
name: "MockApp",
type: .application,
platform: .iOS,
dependencies: []
)
let testBundle = Target(
name: "TestBundle",
type: .unitTestBundle,
platform: .iOS
)
let appTarget = Scheme.BuildTarget(target: .local(app.name), buildTypes: [.running])
let mockAppTarget = Scheme.BuildTarget(target: .local(mockApp.name), buildTypes: [.testing])
let testBundleTarget = Scheme.BuildTarget(target: .local(testBundle.name), buildTypes: [.testing])
let scheme = Scheme(
name: "TestScheme",
build: Scheme.Build(targets: [appTarget, mockAppTarget, testBundleTarget]),
run: Scheme.Run(config: "Debug", macroExpansion: "MyApp")
)
let project = Project(
name: "test",
targets: [app, mockApp, testBundle],
schemes: [scheme]
)
let xcodeProject = try project.generateXcodeProject()
let xcscheme = try unwrap(xcodeProject.sharedData?.schemes.first)
try expect(xcscheme.testAction?.macroExpansion?.buildableName) == "MockApp.app"
}
$0.it("generates scheme with test target of local swift package") {
let targetScheme = TargetScheme(
testTargets: [Scheme.Test.TestTarget(targetReference: TestableTargetReference(name: "XcodeGenKitTests", location: .package("XcodeGen")))])