Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/XcodeGraph/Models/Target.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@ public struct Target: Equatable, Hashable, Comparable, Codable, Sendable {
}
}

/// Returns true if the target supports having sources.
@available(*, deprecated, message: """
Whether a target supports sources or not is not as binary decision as we originally assumed and codified in this getter.
Because it's something that depends on other variables, we decided to pull this logic out of tuist/XcodeGraph into tuist/tuist.
If you are interested in having a similar logic in your XcodeGraph-dependent project, you might want to check out tuist/tuist.
""")
/// Returns true if the target supports having sources.
public var supportsSources: Bool {
switch product {
case .stickerPackExtension, .watch2App:
Expand All @@ -241,6 +241,7 @@ public struct Target: Equatable, Hashable, Comparable, Codable, Sendable {
switch product {
case .app,
.framework,
.staticFramework,
.unitTests,
.uiTests,
.bundle,
Expand All @@ -259,7 +260,6 @@ public struct Target: Equatable, Hashable, Comparable, Codable, Sendable {
.macro,
.dynamicLibrary,
.staticLibrary,
.staticFramework,
.xpc:
return false
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/XcodeGraph/Models/Workspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ extension Workspace {
let allSchemes = schemes + projects.flatMap(\.schemes)
var resultTargets = Set<TargetReference>()

allSchemes.forEach { scheme in
for scheme in allSchemes {
// try to add code coverage targets only if code coverage is enabled
guard let testAction = scheme.testAction, testAction.coverage else { return }
guard let testAction = scheme.testAction, testAction.coverage else { continue }

let schemeCoverageTargets = testAction.codeCoverageTargets

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct XcodeGraphMapperTests {
private let fileSystem = FileSystem()

@Test("Maps a single project into a workspace graph")
func testSingleProjectGraph() async throws {
func singleProjectGraph() async throws {
// Given
let pbxProj = PBXProj()
let debug: XCBuildConfiguration = .testDebug().add(to: pbxProj)
Expand Down Expand Up @@ -63,7 +63,7 @@ struct XcodeGraphMapperTests {
}

@Test("Maps a project with sanitizable target names")
func testProjectWithSanitizableTargetNames() async throws {
func projectWithSanitizableTargetNames() async throws {
// Given
let pbxProj = PBXProj()

Expand Down Expand Up @@ -113,7 +113,7 @@ struct XcodeGraphMapperTests {
}

@Test("Maps a project with custom target product names")
func testProjectWithCustomTargetProductNames() async throws {
func projectWithCustomTargetProductNames() async throws {
// Given
let pbxProj = PBXProj()

Expand Down Expand Up @@ -164,7 +164,7 @@ struct XcodeGraphMapperTests {
}

@Test("Maps a workspace with multiple projects into a single graph")
func testWorkspaceGraphMultipleProjects() async throws {
func workspaceGraphMultipleProjects() async throws {
// Given
let pbxProjA = PBXProj()
let pbxProjB = PBXProj()
Expand Down Expand Up @@ -254,7 +254,7 @@ struct XcodeGraphMapperTests {
}

@Test("Maps a workspace with multiple projects in different directories into a single graph")
func testWorkspaceGraphMultipleProjectsInDifferentDirectories() async throws {
func workspaceGraphMultipleProjectsInDifferentDirectories() async throws {
// Given
//
// A project structure like this:
Expand Down Expand Up @@ -329,7 +329,7 @@ struct XcodeGraphMapperTests {
}

@Test("Maps a project graph with dependencies between targets")
func testGraphWithDependencies() async throws {
func graphWithDependencies() async throws {
// Given
let pbxProj = PBXProj()
let debug: XCBuildConfiguration = .testDebug().add(to: pbxProj)
Expand Down Expand Up @@ -395,7 +395,7 @@ struct XcodeGraphMapperTests {
}

@Test("Maps a project graph with local packages")
func testGraphWithLocalPackages() async throws {
func graphWithLocalPackages() async throws {
// Given
let pbxProj = PBXProj()
let debug: XCBuildConfiguration = .testDebug().add(to: pbxProj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct PackageMapperTests: Sendable {
private let fileSystem = FileSystem()

@Test
func test_map_package() async throws {
func map_package() async throws {
try await fileSystem.runInTemporaryDirectory(prefix: "PackageMapperTests") { path in
// Given
let subject = PackageMapper()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct XCPackageMapperTests {
}

@Test("Maps a remote package with a valid URL and up-to-next-major requirement")
func testMapPackageWithValidURL() async throws {
func mapPackageWithValidURL() async throws {
// Given
let package = XCRemoteSwiftPackageReference(
repositoryURL: "https://github.com/example/package.git",
Expand All @@ -34,7 +34,7 @@ struct XCPackageMapperTests {
}

@Test("Maps an up-to-next-major version requirement correctly")
func testMapRequirementUpToNextMajor() async throws {
func mapRequirementUpToNextMajor() async throws {
// Given
let package = XCRemoteSwiftPackageReference(
repositoryURL: "https://github.com/example/package.git",
Expand All @@ -48,7 +48,7 @@ struct XCPackageMapperTests {
}

@Test("Maps an up-to-next-minor version requirement correctly")
func testMapRequirementUpToNextMinor() async throws {
func mapRequirementUpToNextMinor() async throws {
// Given
let package = XCRemoteSwiftPackageReference(
repositoryURL: "https://github.com/example/package.git",
Expand All @@ -63,7 +63,7 @@ struct XCPackageMapperTests {
}

@Test("Maps an exact version requirement correctly")
func testMapRequirementExact() async throws {
func mapRequirementExact() async throws {
// Given
let package = XCRemoteSwiftPackageReference(
repositoryURL: "https://github.com/example/package.git",
Expand All @@ -78,7 +78,7 @@ struct XCPackageMapperTests {
}

@Test("Maps a range version requirement correctly")
func testMapRequirementRange() async throws {
func mapRequirementRange() async throws {
// Given
let package = XCRemoteSwiftPackageReference(
repositoryURL: "https://github.com/example/package.git",
Expand All @@ -93,7 +93,7 @@ struct XCPackageMapperTests {
}

@Test("Maps a branch-based version requirement correctly")
func testMapRequirementBranch() async throws {
func mapRequirementBranch() async throws {
// Given
let package = XCRemoteSwiftPackageReference(
repositoryURL: "https://github.com/example/package.git",
Expand All @@ -108,7 +108,7 @@ struct XCPackageMapperTests {
}

@Test("Maps a revision-based version requirement correctly")
func testMapRequirementRevision() async throws {
func mapRequirementRevision() async throws {
// Given
let package = XCRemoteSwiftPackageReference(
repositoryURL: "https://github.com/example/package.git",
Expand All @@ -123,7 +123,7 @@ struct XCPackageMapperTests {
}

@Test("Maps a missing version requirement to up-to-next-major(0.0.0)")
func testMapRequirementNoVersionRequirement() async throws {
func mapRequirementNoVersionRequirement() async throws {
// Given
let package = XCRemoteSwiftPackageReference(
repositoryURL: "https://github.com/example/package.git",
Expand All @@ -138,7 +138,7 @@ struct XCPackageMapperTests {
}

@Test("Maps a local package reference correctly")
func testMapLocalPackage() async throws {
func mapLocalPackage() async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let localPackage = XCLocalSwiftPackageReference(relativePath: "Packages/Example")
Expand All @@ -154,7 +154,7 @@ struct XCPackageMapperTests {
}

@Test("Throws an error if remote package has no repository URL")
func testMapPackageWithoutURL() async throws {
func mapPackageWithoutURL() async throws {
// Given
let package = XCRemoteSwiftPackageReference(
repositoryURL: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import XcodeProj
@Suite
struct PBXCopyFilesBuildPhaseMapperTests {
@Test("Maps copy files actions, verifying code-sign-on-copy attributes")
func testMapCopyFiles() async throws {
func mapCopyFiles() async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let pbxProj = xcodeProj.pbxproj
Expand Down Expand Up @@ -64,7 +64,7 @@ struct PBXCopyFilesBuildPhaseMapperTests {
}

@Test("Maps copy files actions with a synchronized group")
func testMapCopyFilesWithSynchronizedGroup() async throws {
func mapCopyFilesWithSynchronizedGroup() async throws {
// Given
let xcodeProj = try await XcodeProj.test(
path: "/tmp/TestProject/Project.xcodeproj"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import XcodeProj
@Suite
struct PBXCoreDataModelsBuildPhaseMapperTests {
@Test("Maps CoreData models from version groups within resources phase")
func testMapCoreDataModels() async throws {
func mapCoreDataModels() async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let pbxProj = xcodeProj.pbxproj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import XcodeProj
@Suite
struct PBXFrameworksBuildPhaseMapperTests {
@Test("Maps frameworks from frameworks phase")
func testMapFrameworks() async throws {
func mapFrameworks() async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let pbxProj = xcodeProj.pbxproj
Expand Down Expand Up @@ -139,7 +139,7 @@ struct PBXFrameworksBuildPhaseMapperTests {
}

@Test("Maps SDK frameworks")
func testMapSDKFrameworks() async throws {
func mapSDKFrameworks() async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let pbxProj = xcodeProj.pbxproj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import XcodeProj
@Suite
struct PBXHeadersBuildPhaseMapperTests {
@Test("Maps public, private, and project headers from headers phase")
func testMapHeaders() async throws {
func mapHeaders() async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let pbxProj = xcodeProj.pbxproj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import XcodeProj
@Suite
struct PBXResourcesBuildPhaseMapperTests {
@Test("Maps resources (like xcassets) from resources phase")
func testMapResources() async throws {
func mapResources() async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let pbxProj = xcodeProj.pbxproj
Expand Down Expand Up @@ -48,7 +48,7 @@ struct PBXResourcesBuildPhaseMapperTests {
}

@Test("Maps resource bundle target dependencies from resources phase")
func testMapResourceBundleTargets() async throws {
func mapResourceBundleTargets() async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let pbxProj = xcodeProj.pbxproj
Expand Down Expand Up @@ -127,7 +127,7 @@ struct PBXResourcesBuildPhaseMapperTests {
}

@Test("Maps localized variant groups from resources")
func testMapVariantGroup() async throws {
func mapVariantGroup() async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let pbxProj = xcodeProj.pbxproj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import XcodeProj
@Suite
struct PBXScriptsBuildPhaseMapperTests {
@Test("Maps embedded run scripts with specified input/output paths")
func testMapScripts() async throws {
func mapScripts() async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let pbxProj = xcodeProj.pbxproj
Expand Down Expand Up @@ -44,7 +44,7 @@ struct PBXScriptsBuildPhaseMapperTests {
}

@Test("Maps raw script build phases not covered by other categories")
func testMapRawScriptBuildPhases() async throws {
func mapRawScriptBuildPhases() async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let pbxProj = xcodeProj.pbxproj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import XcodeProj
@Suite
struct PBXSourcesBuildPhaseMapperTests {
@Test("Maps Swift source files with compiler flags from sources phase")
func testMapSources() async throws {
func mapSources() async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let pbxProj = xcodeProj.pbxproj
Expand Down Expand Up @@ -53,7 +53,7 @@ struct PBXSourcesBuildPhaseMapperTests {
}

@Test("Handles source files without file references gracefully")
func testMapSourceFile_missingFileRef() async throws {
func mapSourceFile_missingFileRef() async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let pbxProj = xcodeProj.pbxproj
Expand All @@ -75,7 +75,7 @@ struct PBXSourcesBuildPhaseMapperTests {
}

@Test("Gracefully handles non-existent file paths for source files")
func testMapSourceFile_unresolvableFullPath() async throws {
func mapSourceFile_unresolvableFullPath() async throws {
// Given
// Use a provider with an invalid source directory to simulate missing files.
let xcodeProj = try await XcodeProj.test(
Expand Down Expand Up @@ -107,7 +107,7 @@ struct PBXSourcesBuildPhaseMapperTests {
"Correctly identifies code generation attributes for source files",
arguments: [FileCodeGen.public, .private, .project, .disabled]
)
func testCodeGenAttributes(_ fileCodeGen: FileCodeGen) async throws {
func codeGenAttributes(_ fileCodeGen: FileCodeGen) async throws {
// Given
let xcodeProj = try await XcodeProj.test()
let pbxProj = xcodeProj.pbxproj
Expand Down
Loading