Skip to content

Commit 1757341

Browse files
Use -Isystem and -Fsystem for swift-api-digester
swift-api-digester now supports -Isystem and -Fsystem in the driver and tool. Use those arguments instead of -I and -F so that system paths are used for both baselines and checks. rdar://152747822
1 parent 62bd4c6 commit 1757341

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

Sources/SWBCore/SpecImplementations/Tools/SwiftABICheckerTool.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ public final class SwiftABICheckerToolSpec : GenericCommandLineToolSpec, SpecIde
8282
for searchPath in SwiftCompilerSpec.collectInputSearchPaths(cbc, toolInfo: toolSpecInfo) {
8383
commandLine += ["-I", searchPath]
8484
}
85-
// swift-api-digester doesn't support -Isystem or -Fsystem.
86-
commandLine += cbc.scope.evaluate(BuiltinMacros.SWIFT_SYSTEM_INCLUDE_PATHS).flatMap { ["-I", $0] }
87-
commandLine += cbc.scope.evaluate(BuiltinMacros.SYSTEM_FRAMEWORK_SEARCH_PATHS).flatMap { ["-F", $0] }
8885
delegate.createTask(type: self,
8986
payload: ABICheckerPayload(serializedDiagnosticsPath: serializedDiagsPath),
9087
ruleInfo: defaultRuleInfo(cbc, delegate),

Sources/SWBCore/SpecImplementations/Tools/SwiftABIGenerationTool.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,10 @@ public final class SwiftABIGenerationToolSpec : GenericCommandLineToolSpec, Spec
4040

4141
var commandLine = await commandLineFromTemplate(cbc, delegate, optionContext: discoveredCommandLineToolSpecInfo(cbc.producer, cbc.scope, delegate)).map(\.asString)
4242
commandLine += ["-o", baselineFile.normalize().str]
43-
// swift-api-digester doesn't support -Fsystem or -Isystem.
44-
commandLine += cbc.scope.evaluate(BuiltinMacros.SYSTEM_FRAMEWORK_SEARCH_PATHS).flatMap { ["-F", $0] }
4543
// Add import search paths
4644
for searchPath in SwiftCompilerSpec.collectInputSearchPaths(cbc, toolInfo: toolSpecInfo) {
4745
commandLine += ["-I", searchPath]
4846
}
49-
commandLine += cbc.scope.evaluate(BuiltinMacros.SWIFT_SYSTEM_INCLUDE_PATHS).flatMap { ["-I", $0] }
5047
delegate.createTask(type: self,
5148
ruleInfo: defaultRuleInfo(cbc, delegate),
5249
commandLine: commandLine,

Sources/SWBUniversalPlatform/Specs/Swift.xcspec

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,20 @@
14271427
FlattenRecursiveSearchPathsInValue = YES;
14281428
CommandLineFlag = "-F";
14291429
},
1430+
{
1431+
Name = SYSTEM_FRAMEWORK_SEARCH_PATHS;
1432+
Type = PathList;
1433+
DefaultValue = "$(SYSTEM_FRAMEWORK_SEARCH_PATHS)";
1434+
FlattenRecursiveSearchPathsInValue = YES;
1435+
CommandLineFlag = "-Fsystem";
1436+
},
1437+
{
1438+
Name = SWIFT_SYSTEM_INCLUDE_PATHS;
1439+
Type = PathList;
1440+
DefaultValue = "$(SWIFT_SYSTEM_INCLUDE_PATHS)";
1441+
FlattenRecursiveSearchPathsInValue = YES;
1442+
CommandLineFlag = "-Isystem";
1443+
},
14301444
{
14311445
Name = SDKROOT;
14321446
Type = Path;
@@ -1477,6 +1491,20 @@
14771491
FlattenRecursiveSearchPathsInValue = YES;
14781492
CommandLineFlag = "-F";
14791493
},
1494+
{
1495+
Name = SYSTEM_FRAMEWORK_SEARCH_PATHS;
1496+
Type = PathList;
1497+
DefaultValue = "$(SYSTEM_FRAMEWORK_SEARCH_PATHS)";
1498+
FlattenRecursiveSearchPathsInValue = YES;
1499+
CommandLineFlag = "-Fsystem";
1500+
},
1501+
{
1502+
Name = SWIFT_SYSTEM_INCLUDE_PATHS;
1503+
Type = PathList;
1504+
DefaultValue = "$(SWIFT_SYSTEM_INCLUDE_PATHS)";
1505+
FlattenRecursiveSearchPathsInValue = YES;
1506+
CommandLineFlag = "-Isystem";
1507+
},
14801508
{
14811509
Name = SDKROOT;
14821510
Type = Path;

Tests/SWBTaskConstructionTests/SwiftABICheckerTaskConstructionTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ fileprivate struct SwiftABICheckerTaskConstructionTests: CoreBasedTests {
6969
"-diagnose-sdk",
7070
"-target", "\(arch)-apple-ios\(core.loadSDK(.iOS).defaultDeploymentTarget)",
7171
"-F", "/TEST/build/Debug-iphoneos",
72+
"-Fsystem", "/Target/System/Framework/Search/Path/A",
73+
"-Isystem", "/Target/System/Import/Search/Path/A",
7274
"-module", "Fwk",
7375
"-I", "/Target/Import/Search/Path/A",
74-
"-I", "/Target/System/Import/Search/Path/A",
75-
"-F", "/Target/System/Framework/Search/Path/A"
7676
])
7777
}
7878
}
@@ -125,8 +125,8 @@ fileprivate struct SwiftABICheckerTaskConstructionTests: CoreBasedTests {
125125
"swift-api-digester",
126126
"-dump-sdk", "-target", "\(arch)-apple-ios\(core.loadSDK(.iOS).defaultDeploymentTarget)",
127127
"-F", "/TEST/build/Debug-iphoneos",
128+
"-Fsystem", "/Target/System/Framework/Search/Path/A",
128129
"-module", "Fwk", "-o",
129-
"/Target/System/Framework/Search/Path/A",
130130
])
131131
// Ensure SWIFT_ABI_GENERATION_TOOL_OUTPUT_DIR is used.
132132
task.checkOutputs([

0 commit comments

Comments
 (0)