rename includeCarthageRelatedDependencies to findCarthageFrameworks and includeRelated to findFrameworks

This commit is contained in:
yonaskolb
2019-03-24 22:31:47 +11:00
parent 5accd0e095
commit bcbc83dd75
12 changed files with 43 additions and 43 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
#### Added
- Added `missingConfigFiles` to `options.disabledValidations` to optionally skip checking for the existence of config files.
- Added ability to automatically include Carthage related dependencies via `includeRelated: true` [#506](https://github.com/yonaskolb/XcodeGen/pull/506) @rpassis
- Added ability to automatically include Carthage related dependencies via `findFrameworks: true` [#506](https://github.com/yonaskolb/XcodeGen/pull/506) @rpassis
- Added ability to define a per-platform `deploymentTarget` for Multi-Platform targets. [#510](https://github.com/yonaskolb/XcodeGen/pull/510) @ainopara
- Added support for nested target templates [#534](https://github.com/yonaskolb/XcodeGen/pull/534) @tomquist
- Added ability to define `templateAttributes` within a target to be able to parameterize templates. [#533](https://github.com/yonaskolb/XcodeGen/pull/533) @tomquist
+3 -3
View File
@@ -111,7 +111,7 @@ Note that target names can also be changed by adding a `name` property to a targ
- `bottom` (default) - at the bottom, after other files
- [ ] **transitivelyLinkDependencies**: **Bool** - If this is `true` then targets will link to the dependencies of their target dependencies. If a target should embed its dependencies, such as application and test bundles, it will embed these transitive dependencies as well. Some complex setups might want to set this to `false` and explicitly specify dependencies at every level. Targets can override this with [Target](#target).transitivelyLinkDependencies. Defaults to `false`.
- [ ] **generateEmptyDirectories**: **Bool** - If this is `true` then empty directories will be added to project too else will be missed. Defaults to `false`.
- [ ] **includeCarthageRelatedDependencies**: **Bool** - When this is set to `true`, any carthage dependency with related dependencies will be included automatically. This flag can be overriden individually for each carthage dependency - for more details see See **includeRelated** in the [Dependency](#dependency) section. Defaults to `false`.
- [ ] **findCarthageFrameworks**: **Bool** - When this is set to `true`, any carthage dependency with related dependencies will be included automatically. This flag can be overriden individually for each carthage dependency - for more details see See **findFrameworks** in the [Dependency](#dependency) section. Defaults to `false`.
```yaml
options:
@@ -383,7 +383,7 @@ Carthage frameworks are expected to be in `CARTHAGE_BUILD_PATH/PLATFORM/FRAMEWOR
- `PLATFORM` = the target's platform
- `FRAMEWORK` = the specified name.
If any of the Carthage dependencies has related dependencies, they can be automatically included using the `includeRelated: true` flag.
If any of the Carthage dependencies has related dependencies, they can be automatically included using the `findFrameworks: true` flag.
Xcodegen uses `.version` files generated by Carthage so in order for this to work the dependencies will need to be built / available in the specified Carthage build folder.
If any applications contain carthage dependencies within itself or any dependent targets, a carthage copy files script is automatically added to the application containing all the relevant frameworks. A `FRAMEWORK_SEARCH_PATHS` setting is also automatically added
@@ -395,7 +395,7 @@ targets:
- target: MyFramework
- framework: path/to/framework.framework
- carthage: Result
includeRelated: true
findFrameworks: true
- sdk: Contacts.framework
- sdk: libc++.tbd
MyFramework:
+3 -3
View File
@@ -33,7 +33,7 @@ public struct Dependency: Equatable {
public enum DependencyType: Equatable {
case target
case framework
case carthage(includeRelated: Bool?)
case carthage(findFrameworks: Bool?)
case sdk
}
}
@@ -54,8 +54,8 @@ extension Dependency: JSONObjectConvertible {
type = .framework
reference = framework
} else if let carthage: String = jsonDictionary.json(atKeyPath: "carthage") {
let includeRelated: Bool? = jsonDictionary.json(atKeyPath: "includeRelated")
type = .carthage(includeRelated: includeRelated)
let findFrameworks: Bool? = jsonDictionary.json(atKeyPath: "findFrameworks")
type = .carthage(findFrameworks: findFrameworks)
reference = carthage
} else if let sdk: String = jsonDictionary.json(atKeyPath: "sdk") {
type = .sdk
+4 -4
View File
@@ -20,7 +20,7 @@ public struct SpecOptions: Equatable {
public var transitivelyLinkDependencies: Bool
public var groupSortPosition: GroupSortPosition
public var generateEmptyDirectories: Bool
public var includeCarthageRelatedDependencies: Bool
public var findCarthageFrameworks: Bool
public enum ValidationType: String {
case missingConfigs
@@ -76,7 +76,7 @@ public struct SpecOptions: Equatable {
transitivelyLinkDependencies: Bool = false,
groupSortPosition: GroupSortPosition = .bottom,
generateEmptyDirectories: Bool = false,
includeCarthageRelatedDependencies: Bool = false
findCarthageFrameworks: Bool = false
) {
self.minimumXcodeGenVersion = minimumXcodeGenVersion
self.carthageBuildPath = carthageBuildPath
@@ -95,7 +95,7 @@ public struct SpecOptions: Equatable {
self.transitivelyLinkDependencies = transitivelyLinkDependencies
self.groupSortPosition = groupSortPosition
self.generateEmptyDirectories = generateEmptyDirectories
self.includeCarthageRelatedDependencies = includeCarthageRelatedDependencies
self.findCarthageFrameworks = findCarthageFrameworks
}
}
@@ -122,7 +122,7 @@ extension SpecOptions: JSONObjectConvertible {
transitivelyLinkDependencies = jsonDictionary.json(atKeyPath: "transitivelyLinkDependencies") ?? false
groupSortPosition = jsonDictionary.json(atKeyPath: "groupSortPosition") ?? .bottom
generateEmptyDirectories = jsonDictionary.json(atKeyPath: "generateEmptyDirectories") ?? false
includeCarthageRelatedDependencies = jsonDictionary.json(atKeyPath: "includeCarthageRelatedDependencies") ?? false
findCarthageFrameworks = jsonDictionary.json(atKeyPath: "findCarthageFrameworks") ?? false
}
}
@@ -53,9 +53,9 @@ public class CarthageDependencyResolver {
let nonExistentDependencies = target.dependencies.filter { !frameworks.contains($0) }
for dependency in nonExistentDependencies {
switch dependency.type {
case .carthage(let includeRelated):
let includeRelated = includeRelated ?? project.options.includeCarthageRelatedDependencies
if includeRelated {
case .carthage(let findFrameworks):
let findFrameworks = findFrameworks ?? project.options.findCarthageFrameworks
if findFrameworks {
relatedDependencies(for: dependency, in: target.platform)
.filter { !frameworks.contains($0) }
.forEach { frameworks.insert($0) }
+3 -3
View File
@@ -576,9 +576,9 @@ public class PBXProjGenerator {
)
targetFrameworkBuildFiles.append(buildFile)
case .carthage(let includeRelated):
let includeRelated = includeRelated ?? project.options.includeCarthageRelatedDependencies
let allDependencies = includeRelated
case .carthage(let findFrameworks):
let findFrameworks = findFrameworks ?? project.options.findCarthageFrameworks
let allDependencies = findFrameworks
? carthageResolver.relatedDependencies(for: dependency, in: target.platform) : [dependency]
allDependencies.forEach { dependency in
// Static libraries can't link or embed dynamic frameworks
+1 -1
View File
@@ -1,6 +1,6 @@
name: Project
options:
includeCarthageRelatedDependencies: true
findCarthageFrameworks: true
targets:
Framework:
type: framework
+5 -5
View File
@@ -38,8 +38,8 @@ extension Project {
dependencies: [
Dependency(type: .target, reference: "Framework_\(platform)"),
Dependency(type: .target, reference: "Framework2_\(platform)"),
Dependency(type: .carthage(includeRelated: false), reference: "Alamofire"),
Dependency(type: .carthage(includeRelated: false), reference: "BrightFutures"),
Dependency(type: .carthage(findFrameworks: false), reference: "Alamofire"),
Dependency(type: .carthage(findFrameworks: false), reference: "BrightFutures"),
],
scheme: scheme
)
@@ -73,7 +73,7 @@ extension Project {
TargetSource(path: "Framework_\(platform)"),
],
dependencies: [
Dependency(type: .carthage(includeRelated: false), reference: "Alamofire"),
Dependency(type: .carthage(findFrameworks: false), reference: "Alamofire"),
],
scheme: scheme
)
@@ -89,8 +89,8 @@ extension Project {
sources: [TargetSource(path: "Framework2_\(platform)")],
dependencies: [
Dependency(type: .target, reference: "Framework_\(platform)"),
Dependency(type: .carthage(includeRelated: false), reference: "Alamofire"),
Dependency(type: .carthage(includeRelated: false), reference: "BrightFutures"),
Dependency(type: .carthage(findFrameworks: false), reference: "Alamofire"),
Dependency(type: .carthage(findFrameworks: false), reference: "BrightFutures"),
],
scheme: scheme
)
@@ -70,7 +70,7 @@ class CarthageDependencyResolverTests: XCTestCase {
let options = SpecOptions(carthageBuildPath: carthageBuildPath.string)
let resolver = CarthageDependencyResolver(project: makeTestProject(options: options))
let dependency = Dependency(type: .carthage(includeRelated: true), reference: "CarthageTestFixture")
let dependency = Dependency(type: .carthage(findFrameworks: true), reference: "CarthageTestFixture")
let expectedDependencies: [Platform: [String]] = [
.macOS: ["DependencyFixtureB", "DependencyFixtureA", "CarthageTestFixture"],
.watchOS: ["DependencyFixtureA", "DependencyFixtureB", "CarthageTestFixture"],
@@ -87,7 +87,7 @@ class CarthageDependencyResolverTests: XCTestCase {
$0.it("returns the main dependency when no related dependencies are found") {
let resolver = CarthageDependencyResolver(project: makeTestProject())
let dependency = Dependency(type: .carthage(includeRelated: true), reference: "RandomDependency")
let dependency = Dependency(type: .carthage(findFrameworks: true), reference: "RandomDependency")
let related = resolver.relatedDependencies(for: dependency, in: .iOS)
@@ -96,7 +96,7 @@ class CarthageDependencyResolverTests: XCTestCase {
$0.it("de-duplicates dependencies") {
let resolver = CarthageDependencyResolver(project: makeTestProject())
let dependency = Dependency(type: .carthage(includeRelated: true), reference: "ReactiveSwift")
let dependency = Dependency(type: .carthage(findFrameworks: true), reference: "ReactiveSwift")
let related = resolver.relatedDependencies(for: dependency, in: .iOS)
@@ -112,9 +112,9 @@ class CarthageDependencyResolverTests: XCTestCase {
describe {
$0.it("overrides the includeRelated dependency global flag when specified") {
let options = SpecOptions(carthageBuildPath: carthageBuildPath.string, includeCarthageRelatedDependencies: true)
let dependency = Dependency(type: .carthage(includeRelated: false), reference: dependencyFixtureName)
$0.it("overrides the findFrameworks dependency global flag when specified") {
let options = SpecOptions(carthageBuildPath: carthageBuildPath.string, findCarthageFrameworks: true)
let dependency = Dependency(type: .carthage(findFrameworks: false), reference: dependencyFixtureName)
let resolver = CarthageDependencyResolver(project: makeTestProject(options: options))
let target = Target(name: "1", type: .application, platform: .iOS, dependencies: [dependency])
@@ -126,7 +126,7 @@ class CarthageDependencyResolverTests: XCTestCase {
$0.it("fetches all carthage dependencies for a given target, sorted alphabetically") {
let unsortedDependencyReferences = ["RxSwift", "RxCocoa", "RxBlocking", "RxTest", "RxAtomic"]
let dependencies = unsortedDependencyReferences.map {
Dependency(type: .carthage(includeRelated: false), reference: $0)
Dependency(type: .carthage(findFrameworks: false), reference: $0)
}
let nonCarthageDependencies = unsortedDependencyReferences.map { Dependency(type: .target, reference: $0) }
let target = Target(name: "1", type: .application, platform: .iOS, dependencies: dependencies + nonCarthageDependencies)
@@ -437,7 +437,7 @@ class ProjectGeneratorTests: XCTestCase {
dependencies: [
Dependency(type: .target, reference: iosFrameworkZ.name),
Dependency(type: .framework, reference: "FrameworkZ.framework"),
Dependency(type: .carthage(includeRelated: false), reference: "CarthageZ"),
Dependency(type: .carthage(findFrameworks: false), reference: "CarthageZ"),
]
)
expectedResourceFiles[staticLibrary.name] = Set()
@@ -461,10 +461,10 @@ class ProjectGeneratorTests: XCTestCase {
dependencies: [
Dependency(type: .target, reference: resourceBundle.name),
Dependency(type: .framework, reference: "FrameworkC.framework"),
Dependency(type: .carthage(includeRelated: false), reference: "CarthageA"),
Dependency(type: .carthage(findFrameworks: false), reference: "CarthageA"),
// Statically linked, so don't embed into test
Dependency(type: .target, reference: staticLibrary.name),
Dependency(type: .carthage(includeRelated: false), reference: "CarthageB", embed: false),
Dependency(type: .carthage(findFrameworks: false), reference: "CarthageB", embed: false),
]
)
expectedResourceFiles[iosFrameworkA.name] = Set()
@@ -487,7 +487,7 @@ class ProjectGeneratorTests: XCTestCase {
Dependency(type: .framework, reference: "FrameworkD.framework"),
// Embedded into framework, so don't embed into test
Dependency(type: .framework, reference: "FrameworkE.framework", embed: true),
Dependency(type: .carthage(includeRelated: false), reference: "CarthageC", embed: true),
Dependency(type: .carthage(findFrameworks: false), reference: "CarthageC", embed: true),
// Statically linked, so don't embed into test
Dependency(type: .framework, reference: "FrameworkF.framework", embed: false),
]
@@ -517,7 +517,7 @@ class ProjectGeneratorTests: XCTestCase {
dependencies: [
Dependency(type: .target, reference: app.name),
Dependency(type: .target, reference: iosFrameworkB.name),
Dependency(type: .carthage(includeRelated: false), reference: "CarthageD"),
Dependency(type: .carthage(findFrameworks: false), reference: "CarthageD"),
],
directlyEmbedCarthageDependencies: false
)
@@ -528,9 +528,9 @@ class SourceGeneratorTests: XCTestCase {
"""
try createDirectories(directories)
let watchTarget = Target(name: "Watch", type: .watch2App, platform: .watchOS, sources: ["A"], dependencies: [Dependency(type: .carthage(includeRelated: false), reference: "Alamofire_watch")])
let watchTarget = Target(name: "Watch", type: .watch2App, platform: .watchOS, sources: ["A"], dependencies: [Dependency(type: .carthage(findFrameworks: false), reference: "Alamofire_watch")])
let watchDependency = Dependency(type: .target, reference: "Watch")
let target = Target(name: "Test", type: .application, platform: .iOS, sources: ["A"], dependencies: [Dependency(type: .carthage(includeRelated: false), reference: "Alamofire"), watchDependency])
let target = Target(name: "Test", type: .application, platform: .iOS, sources: ["A"], dependencies: [Dependency(type: .carthage(findFrameworks: false), reference: "Alamofire"), watchDependency])
let project = Project(basePath: directoryPath, name: "Test", targets: [target, watchTarget])
let pbxProj = try project.generatePbxProj()
@@ -549,7 +549,7 @@ class SourceGeneratorTests: XCTestCase {
"""
try createDirectories(directories)
let target = Target(name: "Test", type: .application, platform: .iOS, sources: ["A", "P", "S"], dependencies: [Dependency(type: .carthage(includeRelated: false), reference: "Alamofire")])
let target = Target(name: "Test", type: .application, platform: .iOS, sources: ["A", "P", "S"], dependencies: [Dependency(type: .carthage(findFrameworks: false), reference: "Alamofire")])
let project = Project(basePath: directoryPath, name: "Test", targets: [target])
let pbxProj = try project.generatePbxProj()
@@ -572,7 +572,7 @@ class SourceGeneratorTests: XCTestCase {
"""
try createDirectories(directories)
let target = Target(name: "Test", type: .application, platform: .iOS, sources: ["Sources"], dependencies: [Dependency(type: .carthage(includeRelated: false), reference: "Alamofire")])
let target = Target(name: "Test", type: .application, platform: .iOS, sources: ["Sources"], dependencies: [Dependency(type: .carthage(findFrameworks: false), reference: "Alamofire")])
let project = Project(basePath: directoryPath, name: "Test", targets: [target])
let pbxProj = try project.generatePbxProj()
@@ -343,14 +343,14 @@ class SpecLoadingTests: XCTestCase {
var targetDictionary = validTarget
targetDictionary["dependencies"] = [
["target": "name", "embed": false],
["carthage": "name", "includeRelated": true],
["carthage": "name", "findFrameworks": true],
["framework": "path", "weak": true],
["sdk": "Contacts.framework"],
]
let target = try Target(name: "test", jsonDictionary: targetDictionary)
try expect(target.dependencies.count) == 4
try expect(target.dependencies[0]) == Dependency(type: .target, reference: "name", embed: false)
try expect(target.dependencies[1]) == Dependency(type: .carthage(includeRelated: true), reference: "name")
try expect(target.dependencies[1]) == Dependency(type: .carthage(findFrameworks: true), reference: "name")
try expect(target.dependencies[2]) == Dependency(type: .framework, reference: "path", weakLink: true)
try expect(target.dependencies[3]) == Dependency(type: .sdk, reference: "Contacts.framework")
}
@@ -900,7 +900,7 @@ class SpecLoadingTests: XCTestCase {
watchOS: "3.0",
macOS: "10.12.1"
),
includeCarthageRelatedDependencies: true
findCarthageFrameworks: true
)
let expected = Project(name: "test", options: options)
let dictionary: [String: Any] = ["options": [
@@ -910,7 +910,7 @@ class SpecLoadingTests: XCTestCase {
"createIntermediateGroups": true,
"developmentLanguage": "ja",
"deploymentTarget": ["iOS": 11.1, "tvOS": 10.0, "watchOS": "3", "macOS": "10.12.1"],
"includeCarthageRelatedDependencies": true
"findCarthageFrameworks": true
]]
let parsedSpec = try getProjectSpec(dictionary)
try expect(parsedSpec) == expected