Skip to content

Use -Isystem and -Fsystem for swift-api-digester #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ public final class SwiftABICheckerToolSpec : GenericCommandLineToolSpec, SpecIde
for searchPath in SwiftCompilerSpec.collectInputSearchPaths(cbc, toolInfo: toolSpecInfo) {
commandLine += ["-I", searchPath]
}
// swift-api-digester doesn't support -Isystem or -Fsystem.
commandLine += cbc.scope.evaluate(BuiltinMacros.SWIFT_SYSTEM_INCLUDE_PATHS).flatMap { ["-I", $0] }
commandLine += cbc.scope.evaluate(BuiltinMacros.SYSTEM_FRAMEWORK_SEARCH_PATHS).flatMap { ["-F", $0] }
delegate.createTask(type: self,
payload: ABICheckerPayload(serializedDiagnosticsPath: serializedDiagsPath),
ruleInfo: defaultRuleInfo(cbc, delegate),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@ public final class SwiftABIGenerationToolSpec : GenericCommandLineToolSpec, Spec

var commandLine = await commandLineFromTemplate(cbc, delegate, optionContext: discoveredCommandLineToolSpecInfo(cbc.producer, cbc.scope, delegate)).map(\.asString)
commandLine += ["-o", baselineFile.normalize().str]
// swift-api-digester doesn't support -Fsystem or -Isystem.
commandLine += cbc.scope.evaluate(BuiltinMacros.SYSTEM_FRAMEWORK_SEARCH_PATHS).flatMap { ["-F", $0] }
// Add import search paths
for searchPath in SwiftCompilerSpec.collectInputSearchPaths(cbc, toolInfo: toolSpecInfo) {
commandLine += ["-I", searchPath]
}
commandLine += cbc.scope.evaluate(BuiltinMacros.SWIFT_SYSTEM_INCLUDE_PATHS).flatMap { ["-I", $0] }
delegate.createTask(type: self,
ruleInfo: defaultRuleInfo(cbc, delegate),
commandLine: commandLine,
Expand Down
28 changes: 28 additions & 0 deletions Sources/SWBUniversalPlatform/Specs/Swift.xcspec
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,20 @@
FlattenRecursiveSearchPathsInValue = YES;
CommandLineFlag = "-F";
},
{
Name = SYSTEM_FRAMEWORK_SEARCH_PATHS;
Type = PathList;
DefaultValue = "$(SYSTEM_FRAMEWORK_SEARCH_PATHS)";
FlattenRecursiveSearchPathsInValue = YES;
CommandLineFlag = "-Fsystem";
},
{
Name = SWIFT_SYSTEM_INCLUDE_PATHS;
Type = PathList;
DefaultValue = "$(SWIFT_SYSTEM_INCLUDE_PATHS)";
FlattenRecursiveSearchPathsInValue = YES;
CommandLineFlag = "-Isystem";
},
{
Name = SDKROOT;
Type = Path;
Expand Down Expand Up @@ -1477,6 +1491,20 @@
FlattenRecursiveSearchPathsInValue = YES;
CommandLineFlag = "-F";
},
{
Name = SYSTEM_FRAMEWORK_SEARCH_PATHS;
Type = PathList;
DefaultValue = "$(SYSTEM_FRAMEWORK_SEARCH_PATHS)";
FlattenRecursiveSearchPathsInValue = YES;
CommandLineFlag = "-Fsystem";
},
{
Name = SWIFT_SYSTEM_INCLUDE_PATHS;
Type = PathList;
DefaultValue = "$(SWIFT_SYSTEM_INCLUDE_PATHS)";
FlattenRecursiveSearchPathsInValue = YES;
CommandLineFlag = "-Isystem";
},
{
Name = SDKROOT;
Type = Path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ fileprivate struct SwiftABICheckerTaskConstructionTests: CoreBasedTests {
"-diagnose-sdk",
"-target", "\(arch)-apple-ios\(core.loadSDK(.iOS).defaultDeploymentTarget)",
"-F", "/TEST/build/Debug-iphoneos",
"-Fsystem", "/Target/System/Framework/Search/Path/A",
"-Isystem", "/Target/System/Import/Search/Path/A",
"-module", "Fwk",
"-I", "/Target/Import/Search/Path/A",
"-I", "/Target/System/Import/Search/Path/A",
"-F", "/Target/System/Framework/Search/Path/A"
])
}
}
Expand Down Expand Up @@ -125,8 +125,8 @@ fileprivate struct SwiftABICheckerTaskConstructionTests: CoreBasedTests {
"swift-api-digester",
"-dump-sdk", "-target", "\(arch)-apple-ios\(core.loadSDK(.iOS).defaultDeploymentTarget)",
"-F", "/TEST/build/Debug-iphoneos",
"-Fsystem", "/Target/System/Framework/Search/Path/A",
"-module", "Fwk", "-o",
"/Target/System/Framework/Search/Path/A",
])
// Ensure SWIFT_ABI_GENERATION_TOOL_OUTPUT_DIR is used.
task.checkOutputs([
Expand Down
Loading