Merge pull request #1 from yonaskolb/master

Update fork
This commit is contained in:
Eric Rabil 2022-03-14 15:13:41 -04:00 committed by GitHub
commit c442558e73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 99 additions and 14 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ xcuserdata
*.xcuserstate
XcodeGen.xcodeproj
xcodegen.zip
.vscode/launch.json

View File

@ -2,10 +2,22 @@
## Next Version
### Fixed
- Fixed crash caused by a simultaneous write during a glob processing [#1177](https://github.com/yonaskolb/XcodeGen/issues/1177) @tr1ckyf0x
## 2.26.0
### Added
- Added the option to specify a `location` in a test target [#1150](https://github.com/yonaskolb/XcodeGen/issues/1150) @KrisRJack
### Changed
- Speed up source inclusion checking for big projects [#1122](https://github.com/yonaskolb/XcodeGen/pull/1122) @PaulTaykalo
[Commits](https://github.com/yonaskolb/XcodeGen/compare/2.25.0...2.26.0)
## 2.25.0
### Added

View File

@ -834,6 +834,7 @@ A multiline script can be written using the various YAML multiline methods, for
- [x] **name**: **String** - The name of the target
- [ ] **parallelizable**: **Bool** - Whether to run tests in parallel. Defaults to false
- [ ] **randomExecutionOrder**: **Bool** - Whether to run tests in a random order. Defaults to false
- [ ] **location**: **String** - GPX file or predefined value for simulating location. See [Simulate Location](#simulate-location) for location examples.
- [ ] **skipped**: **Bool** - Whether to skip all of the test target tests. Defaults to false
- [ ] **skippedTests**: **[String]** - List of tests in the test target to skip. Defaults to empty
- [ ] **selectedTests**: **[String]** - List of tests in the test target to whitelist and select. Defaults to empty. This will override `skippedTests` if provided

View File

@ -1,6 +1,6 @@
TOOL_NAME = XcodeGen
export EXECUTABLE_NAME = xcodegen
VERSION = 2.25.0
VERSION = 2.26.0
PREFIX = /usr/local
INSTALL_PATH = $(PREFIX)/bin/$(EXECUTABLE_NAME)
@ -46,4 +46,4 @@ brew:
brew bump-formula-pr --url=$(RELEASE_TAR) XcodeGen
archive: build
./scripts/archive.sh $(EXECUTABLE_PATH)
./scripts/archive.sh "$(EXECUTABLE_PATH)"

View File

@ -78,8 +78,8 @@
"repositoryURL": "https://github.com/tuist/XcodeProj.git",
"state": {
"branch": null,
"revision": "446f3a0db73e141c7f57e26fcdb043096b1db52c",
"version": "8.3.1"
"revision": "aa2a42c7a744ca18b5918771fdd6cf40f9753db5",
"version": "8.6.0"
}
},
{

View File

@ -16,7 +16,7 @@ let package = Package(
.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"),
.package(url: "https://github.com/tuist/XcodeProj.git", from: "8.3.1"),
.package(url: "https://github.com/tuist/XcodeProj.git", from: "8.6.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")),

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

View File

@ -184,6 +184,7 @@ public struct Scheme: Equatable {
public var deleteScreenshotsWhenEachTestSucceeds: Bool
public struct TestTarget: Equatable, ExpressibleByStringLiteral {
public static let randomExecutionOrderDefault = false
public static let parallelizableDefault = false
@ -191,6 +192,7 @@ public struct Scheme: Equatable {
public let targetReference: TargetReference
public var randomExecutionOrder: Bool
public var parallelizable: Bool
public var location: String?
public var skipped: Bool
public var skippedTests: [String]
public var selectedTests: [String]
@ -199,6 +201,7 @@ public struct Scheme: Equatable {
targetReference: TargetReference,
randomExecutionOrder: Bool = randomExecutionOrderDefault,
parallelizable: Bool = parallelizableDefault,
location: String? = nil,
skipped: Bool = false,
skippedTests: [String] = [],
selectedTests: [String] = []
@ -206,6 +209,7 @@ public struct Scheme: Equatable {
self.targetReference = targetReference
self.randomExecutionOrder = randomExecutionOrder
self.parallelizable = parallelizable
self.location = location
self.skipped = skipped
self.skippedTests = skippedTests
self.selectedTests = selectedTests
@ -216,6 +220,7 @@ public struct Scheme: Equatable {
targetReference = try TargetReference(value)
randomExecutionOrder = false
parallelizable = false
location = nil
skipped = false
skippedTests = []
selectedTests = []
@ -536,6 +541,7 @@ extension Scheme.Test.TestTarget: JSONObjectConvertible {
targetReference = try TargetReference(jsonDictionary.json(atKeyPath: "name"))
randomExecutionOrder = jsonDictionary.json(atKeyPath: "randomExecutionOrder") ?? Scheme.Test.TestTarget.randomExecutionOrderDefault
parallelizable = jsonDictionary.json(atKeyPath: "parallelizable") ?? Scheme.Test.TestTarget.parallelizableDefault
location = jsonDictionary.json(atKeyPath: "location") ?? nil
skipped = jsonDictionary.json(atKeyPath: "skipped") ?? false
skippedTests = jsonDictionary.json(atKeyPath: "skippedTests") ?? []
selectedTests = jsonDictionary.json(atKeyPath: "selectedTests") ?? []
@ -559,6 +565,9 @@ extension Scheme.Test.TestTarget: JSONEncodable {
if parallelizable != Scheme.Test.TestTarget.parallelizableDefault {
dict["parallelizable"] = parallelizable
}
if let location = location {
dict["location"] = location
}
if skipped {
dict["skipped"] = skipped
}

View File

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

View File

@ -0,0 +1,27 @@
//
// Atomic.swift
//
//
// Created by Vladislav Lisianskii on 23.02.2022.
//
import Foundation
@propertyWrapper
struct Atomic<Value> {
private let queue = DispatchQueue(label: "com.xcodegencore.atomic")
private var value: Value
init(wrappedValue: Value) {
self.value = wrappedValue
}
var wrappedValue: Value {
get {
return queue.sync { value }
}
set {
queue.sync { value = newValue }
}
}
}

View File

@ -57,7 +57,7 @@ public class Glob: Collection {
public static let defaultBlacklistedDirectories = ["node_modules", "Pods"]
private var isDirectoryCache = [String: Bool]()
@Atomic private var isDirectoryCache = [String: Bool]()
public let behavior: Behavior
public let blacklistedDirectories: [String]

View File

@ -187,12 +187,28 @@ public class SchemeGenerator {
runPostActionsOnFailure: scheme.build.runPostActionsOnFailure
)
let testables = zip(testTargets, testBuildTargetEntries).map { testTarget, testBuilEntries in
XCScheme.TestableReference(
let testables: [XCScheme.TestableReference] = zip(testTargets, testBuildTargetEntries).map { testTarget, testBuildEntries in
var locationScenarioReference: XCScheme.LocationScenarioReference?
if var location = testTarget.location {
if location.contains(".gpx") {
var path = Path(components: [project.options.schemePathPrefix, location])
path = path.simplifyingParentDirectoryReferences()
location = path.string
}
let referenceType = location.contains(".gpx") ? "0" : "1"
locationScenarioReference = XCScheme.LocationScenarioReference(identifier: location, referenceType: referenceType)
}
return XCScheme.TestableReference(
skipped: testTarget.skipped,
parallelizable: testTarget.parallelizable,
randomExecutionOrdering: testTarget.randomExecutionOrder,
buildableReference: testBuilEntries.buildableReference,
buildableReference: testBuildEntries.buildableReference,
locationScenarioReference: locationScenarioReference,
skippedTests: testTarget.skippedTests.map(XCScheme.TestItem.init),
selectedTests: testTarget.selectedTests.map(XCScheme.TestItem.init),
useTestSelectionWhitelist: !testTarget.selectedTests.isEmpty ? true : nil

View File

@ -53,6 +53,10 @@
BlueprintName = "App_iOS_Tests"
ReferencedContainer = "container:Project.xcodeproj">
</BuildableReference>
<LocationScenarioReference
identifier = "New York, NY, USA"
referenceType = "1">
</LocationScenarioReference>
</TestableReference>
</Testables>
<MacroExpansion>

View File

@ -426,6 +426,7 @@ schemes:
- name: App_iOS_Tests
parallelizable: true
randomExecutionOrder: true
location: New York, NY, USA
customLLDBInit: ${SRCROOT}/.lldbinit
targetTemplates:
MyTemplate:

View File

@ -790,6 +790,7 @@ class SpecLoadingTests: XCTestCase {
"name": "ExternalProject/Target2",
"parallelizable": true,
"skipped": true,
"location": "test.gpx",
"randomExecutionOrder": true,
"skippedTests": ["Test/testExample()"],
],
@ -836,6 +837,7 @@ class SpecLoadingTests: XCTestCase {
targetReference: "ExternalProject/Target2",
randomExecutionOrder: true,
parallelizable: true,
location: "test.gpx",
skipped: true,
skippedTests: ["Test/testExample()"]
),
@ -856,6 +858,7 @@ class SpecLoadingTests: XCTestCase {
[
"name": "ExternalProject/Target2",
"parallelizable": true,
"location": "New York, NY, USA",
"randomExecutionOrder": true,
"selectedTests": ["Test/testExample()"],
],
@ -877,6 +880,7 @@ class SpecLoadingTests: XCTestCase {
targetReference: "ExternalProject/Target2",
randomExecutionOrder: true,
parallelizable: true,
location: "New York, NY, USA",
selectedTests: ["Test/testExample()"]
),
]

View File

@ -49,11 +49,14 @@ class SchemeGeneratorTests: XCTestCase {
let preAction = Scheme.ExecutionAction(name: "Script", script: "echo Starting", settingsTarget: app.name)
let simulateLocation = Scheme.SimulateLocation(allow: true, defaultLocation: "New York, NY, USA")
let storeKitConfiguration = "Configuration.storekit"
let scheme = Scheme(
let scheme = try Scheme(
name: "MyScheme",
build: Scheme.Build(targets: [buildTarget], preActions: [preAction]),
run: Scheme.Run(config: "Debug", askForAppToLaunch: true, launchAutomaticallySubstyle: "2", simulateLocation: simulateLocation, storeKitConfiguration: storeKitConfiguration, customLLDBInit: "/sample/.lldbinit"),
test: Scheme.Test(config: "Debug", customLLDBInit: "/test/.lldbinit"),
test: Scheme.Test(config: "Debug", targets: [
Scheme.Test.TestTarget(targetReference: TargetReference(framework.name), location: "test.gpx"),
Scheme.Test.TestTarget(targetReference: TargetReference(framework.name), location: "New York, NY, USA")
], customLLDBInit: "/test/.lldbinit"),
profile: Scheme.Profile(config: "Release", askForAppToLaunch: true)
)
let project = Project(
@ -109,6 +112,13 @@ class SchemeGeneratorTests: XCTestCase {
try expect(xcscheme.launchAction?.customLLDBInitFile) == "/sample/.lldbinit"
try expect(xcscheme.testAction?.customLLDBInitFile) == "/test/.lldbinit"
try expect(xcscheme.testAction?.systemAttachmentLifetime).to.beNil()
try expect(xcscheme.testAction?.testables[0].locationScenarioReference?.referenceType) == "0"
try expect(xcscheme.testAction?.testables[0].locationScenarioReference?.identifier) == "../test.gpx"
try expect(xcscheme.testAction?.testables[1].locationScenarioReference?.referenceType) == "1"
try expect(xcscheme.testAction?.testables[1].locationScenarioReference?.identifier) == "New York, NY, USA"
}
let frameworkTarget = Scheme.BuildTarget(target: .local(framework.name), buildTypes: [.archiving])

View File

@ -10,7 +10,7 @@ LICENSE=LICENSE
# copy
mkdir -p $BINDIR
cp -f $1 $BINDIR
cp -f "$1" $BINDIR
mkdir -p $SHAREDIR
cp -R SettingPresets $SHAREDIR/SettingPresets