Skip to content

Commit a3ca58c

Browse files
authored
Unconditionally build and test MMIOInterposable (#99)
Hopefully improve CI times by building and testing MMIO and MMIOInterposable in one invocation of swift-test instead of two. This should avoid invalidating the cache due to manifest changes.
1 parent e684692 commit a3ca58c

6 files changed

Lines changed: 21 additions & 34 deletions

File tree

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ test: build
4949
--configuration $(CONFIGURATION) \
5050
--parallel \
5151
--explicit-target-dependency-import-check error
52-
@SWIFT_MMIO_FEATURE_INTERPOSABLE=1 swift test \
53-
--configuration $(CONFIGURATION) \
54-
--parallel \
55-
--explicit-target-dependency-import-check error
5652

5753
clean:
5854
@echo "cleaning..."

Package.swift

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,26 @@ var package = Package(
3838
name: "MMIO",
3939
dependencies: ["MMIOMacros", "MMIOVolatile"]),
4040
.testTarget(
41-
name: "MMIOFileCheckTests",
42-
dependencies: ["MMIOUtilities"],
43-
exclude: ["Tests"]),
41+
name: "MMIOTests",
42+
dependencies: ["MMIO", "MMIOUtilities"]),
43+
44+
// FIXME: feature flag
45+
// Ideally this would be represented as MMIO + Feature: Interposable
46+
// MMIOInterposable would have a dependency on MMIO with this feature
47+
// enabled.
48+
.target(
49+
name: "MMIOInterposable",
50+
dependencies: ["MMIOMacros", "MMIOVolatile"],
51+
swiftSettings: [.define("FEATURE_INTERPOSABLE")]),
4452
.testTarget(
4553
name: "MMIOInterposableTests",
46-
dependencies: ["MMIO", "MMIOUtilities"]),
54+
dependencies: ["MMIOInterposable", "MMIOUtilities"],
55+
swiftSettings: [.define("FEATURE_INTERPOSABLE")]),
56+
4757
.testTarget(
48-
name: "MMIOTests",
49-
dependencies: ["MMIO", "MMIOUtilities"]),
58+
name: "MMIOFileCheckTests",
59+
dependencies: ["MMIOUtilities"],
60+
exclude: ["Tests"]),
5061

5162
.macro(
5263
name: "MMIOMacros",
@@ -128,27 +139,6 @@ var package = Package(
128139
]),
129140
])
130141

131-
// Replace this with a native SPM feature flag if/when supported.
132-
let interposable = "FEATURE_INTERPOSABLE"
133-
if featureIsEnabled(named: interposable, override: nil) {
134-
package.products = package.products.filter { $0.name.hasPrefix("MMIO") }
135-
let allowedTargets = Set([
136-
"MMIO", "MMIOVolatile", "MMIOMacros", "MMIOUtilities",
137-
"MMIOInterposableTests",
138-
])
139-
package.targets = package.targets.filter {
140-
allowedTargets.contains($0.name)
141-
}
142-
for target in package.targets where target.type != .system {
143-
target.swiftDefine(interposable)
144-
}
145-
} else {
146-
let disallowedTargets = Set(["MMIOInterposableTests"])
147-
package.targets = package.targets.filter {
148-
!disallowedTargets.contains($0.name)
149-
}
150-
}
151-
152142
func featureIsEnabled(named featureName: String, override: Bool?) -> Bool {
153143
let key = "SWIFT_MMIO_\(featureName)"
154144
let environment = ProcessInfo.processInfo.environment[key] != nil

Sources/MMIOInterposable

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MMIO

Tests/MMIOInterposableTests/MMIOInterposableTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import XCTest
1313

14-
@testable import MMIO
14+
@testable import MMIOInterposable
1515

1616
final class MMIOInterposableTests: XCTestCase {
1717
@RegisterBlock

Tests/MMIOInterposableTests/MMIOTracingInterposer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
import MMIO
12+
import MMIOInterposable
1313
import MMIOUtilities
1414
import XCTest
1515

Tests/MMIOInterposableTests/MMIOTracingInterposerEvent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
import MMIO
12+
import MMIOInterposable
1313
import MMIOUtilities
1414

1515
struct MMIOTracingInterposerEvent {

0 commit comments

Comments
 (0)