Compare commits

...

4 Commits

Author SHA1 Message Date
Yonas Kolb
3327c44ad7 Update to 2.33.0 2022-12-09 21:35:49 +11:00
Yonas Kolb
fd24307120 add a dependency test case 2022-12-09 21:35:17 +11:00
Kazumasa Shimomura
a607d0a0d2
Delete ignored try keyword. (#1298) 2022-12-09 18:11:20 +11:00
Kazumasa Shimomura
b142998dbb
Update Yams to 5.0.1 (#1297)
* Update yams

* Update CHANGELOG.md
2022-12-09 18:10:33 +11:00
11 changed files with 60 additions and 20 deletions

View File

@ -2,6 +2,8 @@
## Next Version
## 2.33.0
### Added
- Added support for `enableGPUFrameCaptureMode` #1251 @bsudekum
@ -15,6 +17,10 @@
- Fix recursive include path when relativePath is not set #1275 @ma-oli
- Include projectRoot in include paths #1275 @ma-oli
### Internal
- Updated to Yams 5.0.1 #1297 @s2mr
- Delete ignored `try` keyword #1298 @s2mr
## 2.32.0
### Added

View File

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

View File

@ -87,8 +87,8 @@
"repositoryURL": "https://github.com/jpsim/Yams.git",
"state": {
"branch": null,
"revision": "9ff1cc9327586db4e0c8f46f064b6a82ec1566fa",
"version": "4.0.6"
"revision": "01835dc202670b5bb90d07f3eae41867e9ed29f6",
"version": "5.0.1"
}
}
]

View File

@ -12,7 +12,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/kylef/PathKit.git", from: "1.0.1"),
.package(url: "https://github.com/jpsim/Yams.git", from: "4.0.0"),
.package(url: "https://github.com/jpsim/Yams.git", from: "5.0.0"),
.package(url: "https://github.com/yonaskolb/JSONUtilities.git", from: "4.2.0"),
.package(url: "https://github.com/kylef/Spectre.git", from: "0.9.2"),
.package(url: "https://github.com/onevcat/Rainbow.git", from: "3.0.0"),

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.32.0"),
.package(url: "https://github.com/yonaskolb/XcodeGen.git", from: "2.33.0"),
```
And then import wherever needed: `import XcodeGenKit`

View File

@ -13,7 +13,7 @@ public struct Config: Hashable {
public static var defaultConfigs: [Config] = [Config(name: ConfigType.debug.name, type: .debug), Config(name: ConfigType.release.name, type: .release)]
}
public enum ConfigType: String {
public enum ConfigType: String, Hashable {
case debug
case release

View File

@ -83,6 +83,7 @@ extension Dependency {
extension Dependency: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(reference)
hasher.combine(type)
}
}

View File

@ -9,7 +9,7 @@ public struct SpecValidationError: Error, CustomStringConvertible {
self.errors = errors
}
public enum ValidationError: Error, CustomStringConvertible {
public enum ValidationError: Hashable, Error, CustomStringConvertible {
case invalidXcodeGenVersion(minimumVersion: Version, version: Version)
case invalidSDKDependency(target: String, dependency: String)
case invalidTargetDependency(target: String, dependency: String)

View File

@ -1,7 +1,7 @@
import Foundation
import JSONUtilities
public struct TestPlan: Equatable {
public struct TestPlan: Hashable {
public var path: String
public var defaultPlan: Bool

View File

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

View File

@ -149,19 +149,21 @@ class ProjectSpecTests: XCTestCase {
name: "target1",
type: .application,
platform: .iOS,
settings: invalidSettings,
dependencies: [
Dependency(type: .target, reference: "dependency1"),
Dependency(type: .target, reference: "dependency1"),
Dependency(type: .framework, reference: "dependency2"),
Dependency(type: .framework, reference: "dependency2"),
// multiple package dependencies with different products should be allowed
Dependency(type: .package(product: "one"), reference: "package1"),
Dependency(type: .package(product: "two"), reference: "package1"),
]
),
Target(
name: "target2",
type: .framework,
platform: .iOS,
settings: invalidSettings,
dependencies: [
Dependency(type: .framework, reference: "dependency3"),
Dependency(type: .target, reference: "dependency3"),
@ -170,10 +172,11 @@ class ProjectSpecTests: XCTestCase {
]
)
]
try expectValidationError(project, .duplicateDependencies(target: "target1", dependencyReference: "dependency1"))
try expectValidationError(project, .duplicateDependencies(target: "target1", dependencyReference: "dependency2"))
try expectValidationError(project, .duplicateDependencies(target: "target2", dependencyReference: "dependency4"))
try expectNoValidationError(project, .duplicateDependencies(target: "target1", dependencyReference: "package1"))
}
$0.it("allows non-existent configurations") {
@ -409,7 +412,7 @@ class ProjectSpecTests: XCTestCase {
platform: .iOS
)]
let testPlan = try TestPlan(path: "does-not-exist.xctestplan")
let testPlan = TestPlan(path: "does-not-exist.xctestplan")
let scheme = Scheme(
name: "xctestplan-scheme",
@ -437,8 +440,8 @@ class ProjectSpecTests: XCTestCase {
platform: .iOS
)]
let testPlan1 = try TestPlan(path: "\(fixturePath.string)/TestProject/App_iOS/App_iOS.xctestplan", defaultPlan: true)
let testPlan2 = try TestPlan(path: "\(fixturePath.string)/TestProject/App_iOS/App_iOS.xctestplan", defaultPlan: true)
let testPlan1 = TestPlan(path: "\(fixturePath.string)/TestProject/App_iOS/App_iOS.xctestplan", defaultPlan: true)
let testPlan2 = TestPlan(path: "\(fixturePath.string)/TestProject/App_iOS/App_iOS.xctestplan", defaultPlan: true)
let scheme = Scheme(
name: "xctestplan-scheme",
@ -734,17 +737,47 @@ class ProjectSpecTests: XCTestCase {
}
}
private func expectValidationError(_ project: Project, _ expectedError: SpecValidationError.ValidationError, file: String = #file, line: Int = #line) throws {
private func expectValidationErrors(_ project: Project, _ expectedErrors: Set<SpecValidationError.ValidationError>, file: String = #file, line: Int = #line) throws {
let expectedErrorString = expectedErrors
.map { $0.description }
.sorted()
.joined(separator: "\n")
do {
try project.validate()
if !expectedErrors.isEmpty {
throw failure("Supposed to fail with:\n\(expectedErrorString)", file: file, line: line)
}
} catch let error as SpecValidationError {
if !error.errors
.contains(where: { $0.description == expectedError.description }) {
throw failure("Supposed to fail with:\n\(expectedError)\nbut got:\n\(error.errors.map { $0.description }.joined(separator: "\n"))", file: file, line: line)
if Set(error.errors) != expectedErrors {
throw failure("Supposed to fail with:\n\(expectedErrorString)\nbut got:\n\(error.errors.map { $0.description }.sorted().joined(separator: "\n"))", file: file, line: line)
}
return
} catch {
throw failure("Supposed to fail with:\n\(expectedErrorString)", file: file, line: line)
}
}
private func expectValidationError(_ project: Project, _ expectedError: SpecValidationError.ValidationError, file: String = #file, line: Int = #line) throws {
do {
try project.validate()
throw failure("Supposed to fail with \"\(expectedError)\"", file: file, line: line)
} catch let error as SpecValidationError {
if !error.errors.contains(expectedError) {
throw failure("Supposed to fail with:\n\(expectedError)\nbut got:\n\(error.errors.map { $0.description }.joined(separator: "\n"))", file: file, line: line)
}
} catch {
throw failure("Supposed to fail with \"\(expectedError)\"", file: file, line: line)
}
throw failure("Supposed to fail with \"\(expectedError)\"", file: file, line: line)
}
private func expectNoValidationError(_ project: Project, _ error: SpecValidationError.ValidationError, file: String = #file, line: Int = #line) throws {
do {
try project.validate()
} catch let validationError as SpecValidationError {
if validationError.errors.contains(error) {
throw failure("Failed with:\n\(error.description)", file: file, line: line)
}
} catch {
throw failure("Failed with:\n\(error)", file: file, line: line)
}
}