Skip to content

Commit 4a0abc0

Browse files
committed
Reverted 27f444f (leaving conflicts marked).
1 parent 1ab1ede commit 4a0abc0

File tree

9 files changed

+14
-75
lines changed

9 files changed

+14
-75
lines changed

Sources/PackageGraph/DependencyResolutionNode.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public enum DependencyResolutionNode {
7878

7979
/// Assembles the product filter to use on the manifest for this node to determine its dependencies.
8080
public var productFilter: ProductFilter {
81-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
8281
switch self {
8382
case .empty:
8483
return .specific([])
@@ -87,9 +86,6 @@ public enum DependencyResolutionNode {
8786
case .root:
8887
return .everything
8988
}
90-
#else
91-
return .everything
92-
#endif
9389
}
9490

9591
/// Returns the dependency that a product has on its own package, if relevant.

Sources/PackageModel/Manifest.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ public final class Manifest: ObjectIdentifierProtocol {
131131

132132
/// Returns the targets required for a particular product filter.
133133
public func targetsRequired(for productFilter: ProductFilter) -> [TargetDescription] {
134-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
135134
// If we have already calcualted it, returned the cached value.
136135
if let targets = _requiredTargets[productFilter] {
137136
return targets
@@ -148,9 +147,6 @@ public final class Manifest: ObjectIdentifierProtocol {
148147
_requiredTargets[productFilter] = targets
149148
return targets
150149
}
151-
#else
152-
return self.targets
153-
#endif
154150
}
155151

156152
/// Returns the package dependencies required for a particular products filter.
@@ -216,7 +212,6 @@ public final class Manifest: ObjectIdentifierProtocol {
216212
}
217213

218214
return dependencies.compactMap { dependency in
219-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
220215
if let filter = associations[dependency.name] {
221216
return dependency.filtered(by: filter)
222217
} else if keepUnused {
@@ -226,9 +221,12 @@ public final class Manifest: ObjectIdentifierProtocol {
226221
// Dependencies known to not have any relevant products are discarded.
227222
return nil
228223
}
224+
<<<<<<< HEAD
229225
#else
230226
return dependency.filtered(by: .everything)
231227
#endif
228+
=======
229+
>>>>>>> parent of 27f444f6... Temporarily disable target-based dependency resolution (#2998)
232230
}
233231
}
234232

Tests/BuildTests/BuildPlanTests.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,25 +1316,18 @@ final class BuildPlanTests: XCTestCase {
13161316
]
13171317
)
13181318

1319-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
13201319
XCTAssertEqual(diagnostics.diagnostics.count, 1)
13211320
let firstDiagnostic = diagnostics.diagnostics.first.map({ $0.message.text })
13221321
XCTAssert(
13231322
firstDiagnostic == "dependency 'C' is not used by any target",
13241323
"Unexpected diagnostic: " + (firstDiagnostic ?? "[none]")
13251324
)
1326-
#endif
13271325

13281326
let graphResult = PackageGraphResult(graph)
13291327
graphResult.check(reachableProducts: "aexec", "BLibrary")
13301328
graphResult.check(reachableTargets: "ATarget", "BTarget1")
1331-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
13321329
graphResult.check(products: "aexec", "BLibrary")
13331330
graphResult.check(targets: "ATarget", "BTarget1")
1334-
#else
1335-
graphResult.check(products: "BLibrary", "bexec", "aexec", "cexec")
1336-
graphResult.check(targets: "ATarget", "BTarget1", "BTarget2", "CTarget")
1337-
#endif
13381331

13391332
let planResult = BuildPlanResult(plan: try BuildPlan(
13401333
buildParameters: mockBuildParameters(),
@@ -1343,13 +1336,8 @@ final class BuildPlanTests: XCTestCase {
13431336
fileSystem: fileSystem
13441337
))
13451338

1346-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
13471339
planResult.checkProductsCount(2)
13481340
planResult.checkTargetsCount(2)
1349-
#else
1350-
planResult.checkProductsCount(4)
1351-
planResult.checkTargetsCount(4)
1352-
#endif
13531341
}
13541342

13551343
func testReachableBuildProductsAndTargets() throws {

Tests/PackageGraphTests/PackageGraphTests.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -739,9 +739,7 @@ class PackageGraphTests: XCTestCase {
739739

740740
DiagnosticsEngineTester(diagnostics) { result in
741741
result.check(diagnostic: "dependency 'Baz' is not used by any target", behavior: .warning)
742-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
743742
result.check(diagnostic: "dependency 'Biz' is not used by any target", behavior: .warning)
744-
#endif
745743
}
746744
}
747745

@@ -1079,12 +1077,7 @@ class PackageGraphTests: XCTestCase {
10791077
}
10801078
}
10811079

1082-
func testUnreachableProductsSkipped() throws {
1083-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
1084-
#else
1085-
try XCTSkipIf(true)
1086-
#endif
1087-
1080+
func testUnreachableProductsSkipped() {
10881081
let fs = InMemoryFileSystem(emptyFiles:
10891082
"/Root/Sources/Root/Root.swift",
10901083
"/Immediate/Sources/ImmediateUsed/ImmediateUsed.swift",

Tests/PackageGraphTests/PubgrubTests.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,12 +1058,7 @@ final class PubgrubTests: XCTestCase {
10581058
])
10591059
}
10601060

1061-
func testUnreachableProductsSkipped() throws {
1062-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
1063-
#else
1064-
try XCTSkipIf(true)
1065-
#endif
1066-
1061+
func testUnreachableProductsSkipped() {
10671062
builder.serve("root", at: .unversioned, with: [
10681063
"root": ["immediate": (.versionSet(v1Range), .specific(["ImmediateUsed"]))]
10691064
])

Tests/PackageGraphTests/RepositoryPackageContainerProviderTests.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,6 @@ class RepositoryPackageContainerProviderTests: XCTestCase {
360360
}
361361

362362
func testDependencyConstraints() throws {
363-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
364-
#else
365-
try XCTSkipIf(true)
366-
#endif
367-
368363
let dependencies = [
369364
PackageDependencyDescription(name: "Bar1", url: "/Bar1", requirement: .upToNextMajor(from: "1.0.0")),
370365
PackageDependencyDescription(name: "Bar2", url: "/Bar2", requirement: .upToNextMajor(from: "1.0.0")),

Tests/PackageModelTests/ManifestTests.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,11 @@ class ManifestTests: XCTestCase {
5656
targets: targets
5757
)
5858

59-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
6059
XCTAssertEqual(manifest.targetsRequired(for: .specific(["Foo", "Bar"])).map({ $0.name }).sorted(), [
6160
"Bar",
6261
"Baz",
6362
"Foo",
6463
])
65-
#endif
6664
}
6765
}
6866

@@ -152,13 +150,16 @@ class ManifestTests: XCTestCase {
152150
targets: targets
153151
)
154152

153+
<<<<<<< HEAD
155154
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
156155
XCTAssertEqual(manifest.dependenciesRequired(for: .specific(["Foo"])).map({ $0.name }).sorted(), [
156+
=======
157+
XCTAssertEqual(manifest.dependenciesRequired(for: .specific(["Foo"])).map({ $0.declaration.name }).sorted(), [
158+
>>>>>>> parent of 27f444f6... Temporarily disable target-based dependency resolution (#2998)
157159
"Bar1", // Foo → Foo1 → Bar1
158160
"Bar2", // Foo → Foo1 → Foo2 → Bar2
159161
// (Bar3 is unreachable.)
160162
])
161-
#endif
162163
}
163164
}
164165
}

Tests/WorkspaceTests/WorkspaceTests.swift

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,15 +1528,11 @@ final class WorkspaceTests: XCTestCase {
15281528
// Run update.
15291529
workspace.checkUpdateDryRun(roots: ["Root"]) { changes, diagnostics in
15301530
XCTAssertNoDiagnostics(diagnostics)
1531-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
1532-
let stateChange = Workspace.PackageStateChange.updated(.init(requirement: .version(Version("1.5.0")), products: .specific(["Foo"])))
1533-
#else
1534-
let stateChange = Workspace.PackageStateChange.updated(.init(requirement: .version(Version("1.5.0")), products: .everything))
1535-
#endif
1536-
15371531
let expectedChange = (
15381532
PackageReference(identity: "foo", path: "/tmp/ws/pkgs/Foo"),
1539-
stateChange
1533+
Workspace.PackageStateChange.updated(
1534+
.init(requirement: .version(Version("1.5.0")), products: .specific(["Foo"]))
1535+
)
15401536
)
15411537
guard let change = changes?.first, changes?.count == 1 else {
15421538
XCTFail()
@@ -2092,13 +2088,11 @@ final class WorkspaceTests: XCTestCase {
20922088
]
20932089
)
20942090

2095-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
20962091
workspace.checkPackageGraph(roots: ["Root"]) { (graph, diagnostics) in
20972092
DiagnosticsEngineTester(diagnostics) { result in
20982093
result.check(diagnostic: .contains("Foo[Foo] 1.0.0..<2.0.0"), behavior: .error)
20992094
}
21002095
}
2101-
#endif
21022096
}
21032097

21042098
func testToolsVersionRootPackages() throws {
@@ -2931,11 +2925,9 @@ final class WorkspaceTests: XCTestCase {
29312925
result.check(packages: "Foo")
29322926
result.check(targets: "Foo")
29332927
}
2934-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
29352928
DiagnosticsEngineTester(diagnostics) { result in
29362929
result.check(diagnostic: .contains("Bar[Bar] {1.0.0..<1.5.0, 1.5.1..<2.0.0} is forbidden"), behavior: .error)
29372930
}
2938-
#endif
29392931
}
29402932
}
29412933

@@ -4064,11 +4056,6 @@ final class WorkspaceTests: XCTestCase {
40644056
}
40654057

40664058
func testTargetBasedDependency() throws {
4067-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
4068-
#else
4069-
try XCTSkipIf(true)
4070-
#endif
4071-
40724059
let sandbox = AbsolutePath("/tmp/ws/")
40734060
let fs = InMemoryFileSystem()
40744061

Tests/XCBuildSupportTests/PIFBuilderTests.swift

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,11 @@ class PIFBuilderTests: XCTestCase {
8686
let targetAExeDependencies = pif.workspace.projects[0].targets[0].dependencies
8787
XCTAssertEqual(targetAExeDependencies.map{ $0.targetGUID }, ["PACKAGE-PRODUCT:blib", "PACKAGE-TARGET:A2", "PACKAGE-TARGET:A3"])
8888
let projectBTargetNames = pif.workspace.projects[1].targets.map({ $0.name })
89-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
9089
XCTAssertEqual(projectBTargetNames, ["blib", "B2"])
91-
#else
92-
XCTAssertEqual(projectBTargetNames, ["bexe", "blib", "B2"])
93-
#endif
9490
}
9591
}
9692

97-
func testProject() throws {
98-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
99-
#else
100-
try XCTSkipIf(true)
101-
#endif
102-
93+
func testProject() {
10394
let fs = InMemoryFileSystem(emptyFiles:
10495
"/Foo/Sources/foo/main.swift",
10596
"/Foo/Tests/FooTests/tests.swift",
@@ -684,12 +675,7 @@ class PIFBuilderTests: XCTestCase {
684675
}
685676
}
686677

687-
func testTestProducts() throws {
688-
#if ENABLE_TARGET_BASED_DEPENDENCY_RESOLUTION
689-
#else
690-
try XCTSkipIf(true)
691-
#endif
692-
678+
func testTestProducts() {
693679
let fs = InMemoryFileSystem(emptyFiles:
694680
"/Foo/Sources/FooTests/FooTests.swift",
695681
"/Foo/Sources/CFooTests/CFooTests.m",

0 commit comments

Comments
 (0)