Merge branch 'master' into katei/support-SWIFT_INSTALL_OBJC_HEADER

This commit is contained in:
Yuta Saito 2020-03-20 11:50:05 +09:00 committed by GitHub
commit b7d658157e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 181 additions and 31 deletions

View File

@ -2,7 +2,12 @@
## Next Version
#### Added
- Add support non-mirrored local Swift Packages in `localPackages`. [#796](https://github.com/yonaskolb/XcodeGen/pull/796) @freddi-kit
#### Fixed
- Fixed resolving path to local Swift Packages [#796](https://github.com/yonaskolb/XcodeGen/pull/796) @freddi-kit
- Added ability to stop on every main thread checker issue on Run schemes and TargetSchemes [#799](https://github.com/yonaskolb/XcodeGen/pull/799) @ionutivan
- Avoid copying ObjC interface header when SWIFT_INSTALL_OBJC_HEADER=false. [#805](https://github.com/yonaskolb/XcodeGen/pull/805) @kateinoigakukun
## 2.14.0

View File

@ -25,6 +25,7 @@
- [Scheme](#scheme)
- [Scheme Template](#scheme-template)
- [Swift Package](#swift-package)
- [Local Swift Package](#local-swift-package)
## General
@ -49,7 +50,7 @@ You can also use environment variables in your configuration file, by using `${S
- [ ] **schemes**: **[Scheme](#scheme)** - A list of schemes by name. This allows more control over what is found in [Target Scheme](#target-scheme)
- [ ] **targetTemplates**: **[String: [Target Template](#target-template)]** - a list of targets that can be used as templates for actual targets which reference them via a `template` property. They can be used to extract common target settings. Works great in combination with `include`.
- [ ] **packages**: **[String: [Swift Package](#swift-package)]** - a map of Swift packages by name
- [ ] **localPackages**: **[String]** - A list of paths to local Swift Packages. The paths must be directories with a `Package.swift` file in them. This is used to override `packages` with a local version for development purposes. For now local packages that don't mirror remote packages aren't able to be linked to
- [ ] **localPackages**: **[String: [Local Swift Package](#local-swift-package)]** - a map of local Swift packages by name. The paths must be directories with a `Package.swift` file in them. If same name remote repo is listed in `packages`, remote repo will be overridden to a local version in `localPackages` for development purposes.
- [ ] **projectReferences**: **[String: [Project Reference](#project-reference)]** - a map of project references by name
### Include
@ -597,6 +598,7 @@ This is a convenience used to automatically generate schemes for a target based
- [ ] **testTargets**: **[[Test Target](#test-target)]** - a list of test targets that should be included in the scheme. These will be added to the build targets and the test entries. Each entry can either be a simple string, or a [Test Target](#test-target)
- [ ] **gatherCoverageData**: **Bool** - a boolean that indicates if this scheme should gather coverage data. This defaults to false
- [ ] **disableMainThreadChecker**: **Bool** - a boolean that indicates if this scheme should disable disable the Main Thread Checker. This defaults to false
- [ ] **stopOnEveryMainThreadCheckerIssue**: **Bool** - a boolean that indicates if this scheme should stop at every Main Thread Checker issue. This defaults to false
- [ ] **language**: **String** - a String that indicates the language used for running and testing. This defaults to nil
- [ ] **region**: **String** - a String that indicates the region used for running and testing. This defaults to nil
- [ ] **commandLineArguments**: **[String:Bool]** - a dictionary from the argument name (`String`) to if it is enabled (`Bool`). These arguments will be added to the Test, Profile and Run scheme actions
@ -732,6 +734,7 @@ The different actions share some properties:
- [ ] **postActions**: **[[Execution Action](#execution-action)]** - Scripts that are run *after* the action
- [ ] **environmentVariables**: **[[Environment Variable](#environment-variable)]** or **[String:String]** - `run`, `test` and `profile` actions can define the environment variables. When passing a dictionary, every key-value entry maps to a corresponding variable that is enabled.
- [ ] **disableMainThreadChecker**: **Bool** - `run` and `test` actions can define a boolean that indicates that this scheme should disable the Main Thread Checker. This defaults to false
- [ ] **stopOnEveryMainThreadCheckerIssue**: **Bool** - a boolean that indicates if this scheme should stop at every Main Thread Checker issue. This defaults to false
- [ ] **language**: **String** - `run` and `test` actions can define a language that is used for Application Language
- [ ] **region**: **String** - `run` and `test` actions can define a language that is used for Application Region
- [ ] **debugEnabled**: **Bool** - `run` and `test` actions can define a whether debugger should be used. This defaults to true.
@ -894,6 +897,23 @@ targets:
- package: Yams
```
## Local Swift Package
Swift packages in local are defined at a project level, and then linked to individual targets via a [Dependency](#dependency).
> Note that Swift Packages don't work in projects with configurations other than `Debug` and `Release`. That limitation is tracked here bugs.swift.org/browse/SR-10927
- [x] **path**: **String** - the url to the package in local
```yml
localPackages:
RxClient:
path: Packages/RxClient
targets:
App:
dependencies:
- package: RxClient
```
## Project Reference

View File

@ -178,16 +178,26 @@ If you want to check in the `Package.resolved` file so that everyone is on the s
> Note that Swift Packages don't work in projects with configurations other than `Debug` and `Release`. That limitation is tracked here bugs.swift.org/browse/SR-10927
You can also include local Swift Packages by referencing them by paths in `localPackages`. When these have the same name as `packages` they will be used instead of the remote repos. This is useful for local development.
You can also include local Swift Packages by referencing them by paths in `localPackages` and you can use them as `dependencies` same with `packages`. When these local packages in `localPackages` have the same name as remote repos in `packages`, they will be used instead of the remote repos. This is useful for local development.
```yml
packages:
Yams:
url: https://github.com/jpsim/Yams
from: 2.0.0
localPackages:
- ../../Yams
- ~/Developer/MyPackage
```
These local packages get put into a `Packages` group in the root of the project by default. This can be changed with `options.localPackagesGroup`
MyPackage:
path: Package/MyPackage
Yams:
path: ../Yams
targets:
App:
dependencies:
- package: MyPackage
- package: Yams # Yams in local will be used instead of Yams from remote repos
> For now local packages that don't mirror remote packages aren't able to be linked to
```
These local packages get put into a `Packages` group in the root of the project by default. This can be changed with `options.localPackagesGroup`.
### SDK
System frameworks and libs can be linked by using the `sdk` dependency type. You can either specify frameworks or libs by using a `.framework`, `.tbd` or `dylib` filename, respectively

View File

@ -0,0 +1,27 @@
import Foundation
import XcodeProj
import JSONUtilities
import Version
public struct LocalSwiftPackage: Equatable {
public let path: String
public init(path: String) {
self.path = path
}
}
extension LocalSwiftPackage: JSONObjectConvertible {
public init(jsonDictionary: JSONDictionary) throws {
path = try jsonDictionary.json(atKeyPath: "path")
}
}
extension LocalSwiftPackage: JSONEncodable {
public func toJSONValue() -> Any {
var dictionary: JSONDictionary = [:]
dictionary["path"] = path
return dictionary
}
}

View File

@ -20,7 +20,7 @@ public struct Project: BuildSettingsContainer {
}
public var packages: [String: SwiftPackage]
public var localPackages: [String]
public var localPackages: [String: LocalSwiftPackage]
public var settings: Settings
public var settingGroups: [String: Settings]
@ -51,7 +51,7 @@ public struct Project: BuildSettingsContainer {
settingGroups: [String: Settings] = [:],
schemes: [Scheme] = [],
packages: [String: SwiftPackage] = [:],
localPackages: [String] = [],
localPackages: [String: LocalSwiftPackage] = [:],
options: SpecOptions = SpecOptions(),
fileGroups: [String] = [],
configFiles: [String: String] = [:],
@ -188,7 +188,13 @@ extension Project {
} else {
packages = [:]
}
localPackages = jsonDictionary.json(atKeyPath: "localPackages") ?? []
if let localPackages: [String: LocalSwiftPackage] = jsonDictionary.json(atKeyPath: "localPackages") {
self.localPackages = localPackages
} else if let localPackages: [String] = jsonDictionary.json(atKeyPath: "localPackages") {
self.localPackages = localPackages.reduce(into: [String: LocalSwiftPackage](), { $0[$1] = LocalSwiftPackage(path: $1) })
} else {
self.localPackages = [:]
}
if jsonDictionary["options"] != nil {
options = try jsonDictionary.json(atKeyPath: "options")
} else {
@ -285,7 +291,7 @@ extension Project: JSONEncodable {
dictionary["include"] = include
dictionary["attributes"] = attributes
dictionary["packages"] = packages.mapValues { $0.toJSONValue() }
dictionary["localPackages"] = localPackages
dictionary["localPackages"] = localPackages.mapValues { $0.toJSONValue() }
dictionary["targets"] = Dictionary(uniqueKeysWithValues: targetPairs)
dictionary["configs"] = Dictionary(uniqueKeysWithValues: configsPairs)
dictionary["aggregateTargets"] = Dictionary(uniqueKeysWithValues: aggregateTargetsPairs)

View File

@ -95,6 +95,7 @@ public struct Scheme: Equatable {
public struct Run: BuildAction {
public static let disableMainThreadCheckerDefault = false
public static let stopOnEveryMainThreadCheckerIssueDefault = false
public static let debugEnabledDefault = true
public var config: String?
@ -103,6 +104,7 @@ public struct Scheme: Equatable {
public var postActions: [ExecutionAction]
public var environmentVariables: [XCScheme.EnvironmentVariable]
public var disableMainThreadChecker: Bool
public var stopOnEveryMainThreadCheckerIssue: Bool
public var language: String?
public var region: String?
public var debugEnabled: Bool
@ -115,6 +117,7 @@ public struct Scheme: Equatable {
postActions: [ExecutionAction] = [],
environmentVariables: [XCScheme.EnvironmentVariable] = [],
disableMainThreadChecker: Bool = disableMainThreadCheckerDefault,
stopOnEveryMainThreadCheckerIssue: Bool = stopOnEveryMainThreadCheckerIssueDefault,
language: String? = nil,
region: String? = nil,
debugEnabled: Bool = debugEnabledDefault,
@ -126,6 +129,7 @@ public struct Scheme: Equatable {
self.postActions = postActions
self.environmentVariables = environmentVariables
self.disableMainThreadChecker = disableMainThreadChecker
self.stopOnEveryMainThreadCheckerIssue = stopOnEveryMainThreadCheckerIssue
self.language = language
self.region = region
self.debugEnabled = debugEnabled
@ -340,6 +344,7 @@ extension Scheme.Run: JSONObjectConvertible {
postActions = jsonDictionary.json(atKeyPath: "postActions") ?? []
environmentVariables = try XCScheme.EnvironmentVariable.parseAll(jsonDictionary: jsonDictionary)
disableMainThreadChecker = jsonDictionary.json(atKeyPath: "disableMainThreadChecker") ?? Scheme.Run.disableMainThreadCheckerDefault
stopOnEveryMainThreadCheckerIssue = jsonDictionary.json(atKeyPath: "stopOnEveryMainThreadCheckerIssue") ?? Scheme.Run.stopOnEveryMainThreadCheckerIssueDefault
language = jsonDictionary.json(atKeyPath: "language")
region = jsonDictionary.json(atKeyPath: "region")
debugEnabled = jsonDictionary.json(atKeyPath: "debugEnabled") ?? Scheme.Run.debugEnabledDefault
@ -362,6 +367,10 @@ extension Scheme.Run: JSONEncodable {
if disableMainThreadChecker != Scheme.Run.disableMainThreadCheckerDefault {
dict["disableMainThreadChecker"] = disableMainThreadChecker
}
if stopOnEveryMainThreadCheckerIssue != Scheme.Run.stopOnEveryMainThreadCheckerIssueDefault {
dict["stopOnEveryMainThreadCheckerIssue"] = stopOnEveryMainThreadCheckerIssue
}
if debugEnabled != Scheme.Run.debugEnabledDefault {
dict["debugEnabled"] = debugEnabled

View File

@ -53,9 +53,9 @@ extension Project {
}
}
for package in localPackages {
if !(basePath + Path(package).normalize()).exists {
errors.append(.invalidLocalPackage(package))
for (name, package) in localPackages {
if !(basePath + Path(package.path).normalize()).exists {
errors.append(.invalidLocalPackage(name))
}
}
@ -173,7 +173,7 @@ extension Project {
}
}
case .package:
if packages[dependency.reference] == nil {
if packages[dependency.reference] == nil, localPackages[dependency.reference] == nil {
errors.append(.invalidSwiftPackage(name: dependency.reference, target: target.name))
}
default: break

View File

@ -5,6 +5,7 @@ import XcodeProj
public struct TargetScheme: Equatable {
public static let gatherCoverageDataDefault = false
public static let disableMainThreadCheckerDefault = false
public static let stopOnEveryMainThreadCheckerIssueDefault = false
public var testTargets: [Scheme.Test.TestTarget]
public var configVariants: [String]
@ -12,6 +13,7 @@ public struct TargetScheme: Equatable {
public var language: String?
public var region: String?
public var disableMainThreadChecker: Bool
public var stopOnEveryMainThreadCheckerIssue: Bool
public var commandLineArguments: [String: Bool]
public var environmentVariables: [XCScheme.EnvironmentVariable]
public var preActions: [Scheme.ExecutionAction]
@ -24,6 +26,7 @@ public struct TargetScheme: Equatable {
language: String? = nil,
region: String? = nil,
disableMainThreadChecker: Bool = disableMainThreadCheckerDefault,
stopOnEveryMainThreadCheckerIssue: Bool = stopOnEveryMainThreadCheckerIssueDefault,
commandLineArguments: [String: Bool] = [:],
environmentVariables: [XCScheme.EnvironmentVariable] = [],
preActions: [Scheme.ExecutionAction] = [],
@ -35,6 +38,7 @@ public struct TargetScheme: Equatable {
self.language = language
self.region = region
self.disableMainThreadChecker = disableMainThreadChecker
self.stopOnEveryMainThreadCheckerIssue = stopOnEveryMainThreadCheckerIssue
self.commandLineArguments = commandLineArguments
self.environmentVariables = environmentVariables
self.preActions = preActions
@ -63,6 +67,7 @@ extension TargetScheme: JSONObjectConvertible {
language = jsonDictionary.json(atKeyPath: "language")
region = jsonDictionary.json(atKeyPath: "region")
disableMainThreadChecker = jsonDictionary.json(atKeyPath: "disableMainThreadChecker") ?? TargetScheme.disableMainThreadCheckerDefault
stopOnEveryMainThreadCheckerIssue = jsonDictionary.json(atKeyPath: "stopOnEveryMainThreadCheckerIssue") ?? TargetScheme.stopOnEveryMainThreadCheckerIssueDefault
commandLineArguments = jsonDictionary.json(atKeyPath: "commandLineArguments") ?? [:]
environmentVariables = try XCScheme.EnvironmentVariable.parseAll(jsonDictionary: jsonDictionary)
preActions = jsonDictionary.json(atKeyPath: "preActions") ?? []
@ -88,6 +93,10 @@ extension TargetScheme: JSONEncodable {
if disableMainThreadChecker != TargetScheme.disableMainThreadCheckerDefault {
dict["disableMainThreadChecker"] = disableMainThreadChecker
}
if stopOnEveryMainThreadCheckerIssue != TargetScheme.stopOnEveryMainThreadCheckerIssueDefault {
dict["stopOnEveryMainThreadCheckerIssue"] = stopOnEveryMainThreadCheckerIssue
}
if let language = language {
dict["language"] = language

View File

@ -56,10 +56,9 @@ public class PBXProjGenerator {
try sourceGenerator.getFileGroups(path: group)
}
let localPackages = Set(project.localPackages)
for package in localPackages {
let path = project.basePath + Path(package).normalize()
try sourceGenerator.createLocalPackage(path: path)
let sortedlocalPackages = project.localPackages.sorted { $0.key < $1.key }
for (_, package) in sortedlocalPackages {
try sourceGenerator.createLocalPackage(path: Path(package.path))
}
let buildConfigs: [XCBuildConfiguration] = project.configs.map { config in
@ -799,8 +798,12 @@ public class PBXProjGenerator {
}
// Embedding handled by iterating over `carthageDependencies` below
case .package(let product):
guard let packageReference = packageReferences[dependency.reference] else {
return
let packageReference = packageReferences[dependency.reference]
// If package's reference is none and there is no specified package in localPackages,
// then ignore the package specified as dependency.
if packageReference == nil, !project.localPackages.keys.contains(dependency.reference) {
continue
}
let productName = product ?? dependency.reference

View File

@ -235,6 +235,7 @@ public class SchemeGenerator {
allowLocationSimulation: allowLocationSimulation,
locationScenarioReference: locationScenarioReference,
disableMainThreadChecker: scheme.run?.disableMainThreadChecker ?? Scheme.Run.disableMainThreadCheckerDefault,
stopOnEveryMainThreadCheckerIssue: scheme.run?.stopOnEveryMainThreadCheckerIssue ?? Scheme.Run.stopOnEveryMainThreadCheckerIssueDefault,
commandlineArguments: launchCommandLineArgs,
environmentVariables: launchVariables,
language: scheme.run?.language,
@ -302,6 +303,7 @@ extension Scheme {
postActions: targetScheme.postActions,
environmentVariables: targetScheme.environmentVariables,
disableMainThreadChecker: targetScheme.disableMainThreadChecker,
stopOnEveryMainThreadCheckerIssue: targetScheme.stopOnEveryMainThreadCheckerIssue,
language: targetScheme.language,
region: targetScheme.region
),

View File

@ -60,12 +60,18 @@ class SourceGenerator {
localPackageGroup = addObject(PBXGroup(sourceTree: .sourceRoot, name: groupName))
rootGroups.insert(localPackageGroup!)
}
let absolutePath = project.basePath + path.normalize()
// Get the local package's relative path from the project root
let fileReferencePath = try? absolutePath.relativePath(from: projectDirectory ?? project.basePath).string
let fileReference = addObject(
PBXFileReference(
sourceTree: .sourceRoot,
name: path.lastComponent,
name: absolutePath.lastComponent,
lastKnownFileType: "folder",
path: try path.relativePath(from: project.basePath).string
path: fileReferencePath
)
)
localPackageGroup!.children.append(fileReference)

View File

@ -127,11 +127,13 @@
dependencies = (
D85FFB99444DD260A72DDDA7 /* PBXTargetDependency */,
DDD17C561AD5065DF4FA4072 /* PBXTargetDependency */,
C6360997FFC102F6725099D4 /* PBXTargetDependency */,
);
name = StaticLibrary;
packageProductDependencies = (
AF233B61592982A7F6431FC6 /* Codability */,
C816AEB28ED71C3C47F31B98 /* SwiftRoaringDynamic */,
5A36E2FE69703FCAC0BE8064 /* XcodeGen */,
);
productName = StaticLibrary;
productReference = 3F7AFEF8ECCC678519EA643C /* StaticLibrary.a */;
@ -247,6 +249,10 @@
target = 3F8D94C4EFC431F646AAFB28 /* StaticLibrary */;
targetProxy = 29147E1DDAEB1AAC20CB0CF9 /* PBXContainerItemProxy */;
};
C6360997FFC102F6725099D4 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = 5A36E2FE69703FCAC0BE8064 /* XcodeGen */;
};
D85FFB99444DD260A72DDDA7 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = AF233B61592982A7F6431FC6 /* Codability */;
@ -489,6 +495,10 @@
package = 5BA91390AE78D2EE15C60091 /* XCRemoteSwiftPackageReference "Codability" */;
productName = Codability;
};
5A36E2FE69703FCAC0BE8064 /* XcodeGen */ = {
isa = XCSwiftPackageProductDependency;
productName = XcodeGen;
};
AF233B61592982A7F6431FC6 /* Codability */ = {
isa = XCSwiftPackageProductDependency;
package = 5BA91390AE78D2EE15C60091 /* XCRemoteSwiftPackageReference "Codability" */;

View File

@ -7,7 +7,8 @@ packages:
url: https://github.com/piotte13/SwiftRoaring
majorVersion: 1.0.4
localPackages:
- ../../.. #XcodeGen itself
XcodeGen:
path: ../../.. #XcodeGen itself
targets:
App:
type: application
@ -28,3 +29,4 @@ targets:
- package: Codability
- package: SwiftRoaring
product: SwiftRoaringDynamic
- package: XcodeGen

View File

@ -86,7 +86,8 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
disableMainThreadChecker = "YES">
disableMainThreadChecker = "YES"
stopOnEveryMainThreadCheckerIssue = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference

View File

@ -86,7 +86,8 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
disableMainThreadChecker = "YES">
disableMainThreadChecker = "YES"
stopOnEveryMainThreadCheckerIssue = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference

View File

@ -86,7 +86,8 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
disableMainThreadChecker = "YES">
disableMainThreadChecker = "YES"
stopOnEveryMainThreadCheckerIssue = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference

View File

@ -116,6 +116,7 @@ targets:
- App_iOS_UITests
gatherCoverageData: true
disableMainThreadChecker: true
stopOnEveryMainThreadCheckerIssue: true
configVariants:
- Test
- Staging

View File

@ -19,6 +19,7 @@ extension Project {
configVariants: ["Test", "Staging", "Prod"],
gatherCoverageData: true,
disableMainThreadChecker: true,
stopOnEveryMainThreadCheckerIssue: false,
commandLineArguments: [
"--command": true,
"--command2": false,

View File

@ -97,7 +97,7 @@ class ProjectSpecTests: XCTestCase {
project.settings = invalidSettings
project.configFiles = ["invalidConfig": "invalidConfigFile"]
project.fileGroups = ["invalidFileGroup"]
project.localPackages = ["invalidLocalPackage"]
project.localPackages = ["invalidLocalPackage" : LocalSwiftPackage(path: "invalidLocalPackage")]
project.settingGroups = ["settingGroup1": Settings(
configSettings: ["invalidSettingGroupConfig": [:]],
groups: ["invalidSettingGroupSettingGroup"]
@ -394,6 +394,7 @@ class ProjectSpecTests: XCTestCase {
configVariants: ["foo"],
gatherCoverageData: true,
disableMainThreadChecker: true,
stopOnEveryMainThreadCheckerIssue: false,
commandLineArguments: ["foo": true],
environmentVariables: [XCScheme.EnvironmentVariable(variable: "environmentVariable",
value: "bar",
@ -520,7 +521,7 @@ class ProjectSpecTests: XCTestCase {
versionRequirement: .upToNextMajorVersion("2.0.0")
),
],
localPackages: ["../../Package"],
localPackages: ["../../Package" : LocalSwiftPackage(path: "../../Package")],
options: SpecOptions(minimumXcodeGenVersion: Version(major: 3, minor: 4, patch: 5),
carthageBuildPath: "carthageBuildPath",
carthageExecutablePath: "carthageExecutablePath",
@ -560,6 +561,7 @@ class ProjectSpecTests: XCTestCase {
try expect(proj.settingGroups) == restoredProj.settingGroups
try expect(proj.targets) == restoredProj.targets
try expect(proj.packages) == restoredProj.packages
try expect(proj.localPackages) == restoredProj.localPackages
try expect(proj) == restoredProj
}

View File

@ -712,6 +712,7 @@ class SpecLoadingTests: XCTestCase {
"language": "en",
"region": "US",
"disableMainThreadChecker": true,
"stopOnEveryMainThreadCheckerIssue": true,
"environmentVariables": [
"TEST_VAR": "TEST_VAL",
],
@ -738,6 +739,7 @@ class SpecLoadingTests: XCTestCase {
language: "en",
region: "US",
disableMainThreadChecker: true,
stopOnEveryMainThreadCheckerIssue: true,
commandLineArguments: ["ENV1": true],
environmentVariables: [XCScheme.EnvironmentVariable(variable: "TEST_VAR", value: "TEST_VAL", enabled: true)],
preActions: [.init(name: "Do Thing", script: "dothing", settingsTarget: "test")],
@ -782,6 +784,7 @@ class SpecLoadingTests: XCTestCase {
],
"gatherCoverageData": true,
"disableMainThreadChecker": true,
"stopOnEveryMainThreadCheckerIssue": true,
],
]
let scheme = try Scheme(name: "Scheme", jsonDictionary: schemeDictionary)
@ -931,6 +934,7 @@ class SpecLoadingTests: XCTestCase {
],
"gatherCoverageData": true,
"disableMainThreadChecker": true,
"stopOnEveryMainThreadCheckerIssue": false,
],
],
],
@ -1104,7 +1108,7 @@ class SpecLoadingTests: XCTestCase {
"package7": SwiftPackage(url: "package.git", versionRequirement: .exact("1.2.2")),
"package8": SwiftPackage(url: "package.git", versionRequirement: .upToNextMajorVersion("4.0.0-beta.5")),
],
localPackages: ["../../Package"],
localPackages: ["../../Package" : LocalSwiftPackage(path: "../../Package")],
options: .init(localPackagesGroup: "MyPackages"))
let dictionary: [String: Any] = [

View File

@ -1000,7 +1000,7 @@ class ProjectGeneratorTests: XCTestCase {
let project = Project(name: "test", targets: [app], packages: [
"XcodeGen": SwiftPackage(url: "http://github.com/yonaskolb/XcodeGen", versionRequirement: .branch("master")),
"Codability": SwiftPackage(url: "http://github.com/yonaskolb/Codability", versionRequirement: .exact("1.0.0")),
], localPackages: ["../XcodeGen"], options: .init(localPackagesGroup: "MyPackages"))
], localPackages: ["XcodeGen" : LocalSwiftPackage(path: "../XcodeGen")], options: .init(localPackagesGroup: "MyPackages"))
let pbxProject = try project.generatePbxProj(specValidate: false)
let nativeTarget = try unwrap(pbxProject.nativeTargets.first(where: { $0.name == app.name }))
@ -1022,6 +1022,36 @@ class ProjectGeneratorTests: XCTestCase {
try expect(localPackagesGroup.children.contains(localPackageFile)) == true
try expect(localPackageFile.lastKnownFileType) == "folder"
}
$0.it("generates local swift packages") {
let app = Target(
name: "MyApp",
type: .application,
platform: .iOS,
dependencies: [
Dependency(type: .package(product: nil), reference: "XcodeGen"),
]
)
let project = Project(name: "test", targets: [app], localPackages: ["XcodeGen" : LocalSwiftPackage(path: "../XcodeGen")])
let pbxProject = try project.generatePbxProj(specValidate: false)
let nativeTarget = try unwrap(pbxProject.nativeTargets.first(where: { $0.name == app.name }))
let localPackageFile = try unwrap(pbxProject.fileReferences.first(where: { $0.path == "../XcodeGen" }))
try expect(localPackageFile.lastKnownFileType) == "folder"
let frameworkPhases = nativeTarget.buildPhases.compactMap { $0 as? PBXFrameworksBuildPhase }
guard let frameworkPhase = frameworkPhases.first else {
return XCTFail("frameworkPhases should have more than one")
}
guard let file = frameworkPhase.files?.first else {
return XCTFail("frameworkPhase should have file")
}
try expect(file.product?.productName) == "XcodeGen"
}
$0.it("generates info.plist") {
let plist = Plist(path: "Info.plist", attributes: ["UISupportedInterfaceOrientations": ["UIInterfaceOrientationPortrait", "UIInterfaceOrientationLandscapeLeft"]])