Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
AMatecki committed Oct 21, 2024
1 parent 29ff7fa commit f605c3d
Showing 2 changed files with 65 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Tests/XcodeGenKitTests/PBXProjGeneratorTests.swift
Original file line number Diff line number Diff line change
@@ -618,6 +618,44 @@ class PBXProjGeneratorTests: XCTestCase {
try expect(testTarget?.frameworksBuildPhase()?.files?.count) == 1
try expect(testTarget?.frameworksBuildPhase()?.files?[0].platformFilter) == "ios"
}

$0.it("places resources before sources buildPhase") {
let directories = """
Sources:
- MainScreen:
- Entities:
- file.swift
- image.jpg
"""
try createDirectories(directories)
let target1 = Target(
name: "TestAll",
type: .application,
platform: .iOS,
sources: ["Sources"],
putResourcesBeforeSourcesBuildPhase: true
)
let target2 = Target(
name: "TestiOS",
type: .application,
platform: .iOS,
sources: ["Sources"],
putResourcesBeforeSourcesBuildPhase: false
)

let project = Project(basePath: directoryPath, name: "Test", targets: [target1, target2])

let pbxProj = try project.generatePbxProj()

let targets = pbxProj.projects.first?.targets
try expect(targets?.count) == 2
try expect(targets?.first?.buildPhases.first).to.beOfType(PBXResourcesBuildPhase.self)
try expect(targets?.first?.buildPhases.last).to.beOfType(PBXSourcesBuildPhase.self)

try expect(targets?.last?.buildPhases.first).to.beOfType(PBXSourcesBuildPhase.self)
try expect(targets?.last?.buildPhases.last).to.beOfType(PBXResourcesBuildPhase.self)
}
}
}

}
27 changes: 27 additions & 0 deletions Tests/XcodeGenKitTests/SchemeGeneratorTests.swift
Original file line number Diff line number Diff line change
@@ -479,6 +479,33 @@ class SchemeGeneratorTests: XCTestCase {
try expect(xcscheme.testAction?.macroExpansion?.buildableName) == "MyApp.app"
try expect(xcscheme.launchAction?.macroExpansion?.buildableName) == "MyApp.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")))])
let app = Target(
name: "MyApp",
type: .application,
platform: .iOS,
dependencies: [
Dependency(type: .package(product: nil), reference: "XcodeGen")
],
scheme: targetScheme
)
let project = Project(
name: "ios_test",
targets: [app],
packages: ["XcodeGen": .local(path: "../", group: nil)]
)
let xcodeProject = try project.generateXcodeProject()
let xcscheme = try unwrap(xcodeProject.sharedData?.schemes.first)
let buildableReference = try unwrap(xcscheme.testAction?.testables.first?.buildableReference)

try expect(buildableReference.blueprintIdentifier) == "XcodeGenKitTests"
try expect(buildableReference.blueprintName) == "XcodeGenKitTests"
try expect(buildableReference.buildableName) == "XcodeGenKitTests"
try expect(buildableReference.referencedContainer) == "container:../"
}

$0.it("allows to override test macroExpansion") {
let app = Target(

0 comments on commit f605c3d

Please sign in to comment.