Skip to content

Commit f61904c

Browse files
committed
Make -library-level a driver argument and pass it to the frontend
rdar://82458987
1 parent a0a9f84 commit f61904c

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ extension Driver {
193193
try commandLine.appendLast(.localizationPath, from: &parsedOptions)
194194
try commandLine.appendLast(.requireExplicitAvailability, from: &parsedOptions)
195195
try commandLine.appendLast(.requireExplicitAvailabilityTarget, from: &parsedOptions)
196+
try commandLine.appendLast(.libraryLevel, from: &parsedOptions)
196197
try commandLine.appendLast(.lto, from: &parsedOptions)
197198
try commandLine.appendLast(.accessNotesPath, from: &parsedOptions)
198199
try commandLine.appendLast(.enableActorDataRaceChecks, .disableActorDataRaceChecks, from: &parsedOptions)

Sources/SwiftOptions/Options.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ extension Option {
377377
public static let j: Option = Option("-j", .joinedOrSeparate, attributes: [.doesNotAffectIncrementalBuild], metaVar: "<n>", helpText: "Number of commands to execute in parallel")
378378
public static let LEQ: Option = Option("-L=", .joined, alias: Option.L, attributes: [.frontend, .doesNotAffectIncrementalBuild, .argumentIsPath], group: .linkerOption)
379379
public static let libc: Option = Option("-libc", .separate, helpText: "libc runtime library to use")
380-
public static let libraryLevel: Option = Option("-library-level", .separate, attributes: [.helpHidden, .frontend, .noDriver], metaVar: "<level>", helpText: "Library distribution level 'api', 'spi' or 'other' (the default)")
380+
public static let libraryLevel: Option = Option("-library-level", .separate, attributes: [.helpHidden, .frontend, .moduleInterface], metaVar: "<level>", helpText: "Library distribution level 'api', 'spi' or 'other' (the default)")
381381
public static let lineRange: Option = Option("-line-range", .separate, attributes: [.noInteractive, .noBatch, .indent], metaVar: "<n:n>", helpText: "<start line>:<end line>. Formats a range of lines (1-based). Can only be used with one input file.", group: .codeFormatting)
382382
public static let linkObjcRuntime: Option = Option("-link-objc-runtime", .flag, attributes: [.doesNotAffectIncrementalBuild])
383383
public static let lldbRepl: Option = Option("-lldb-repl", .flag, attributes: [.helpHidden, .noBatch], helpText: "LLDB-enhanced REPL mode", group: .modes)

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4853,6 +4853,15 @@ final class SwiftDriverTests: XCTestCase {
48534853
}
48544854
}
48554855

4856+
func testLibraryLevel() throws {
4857+
do {
4858+
var driver = try Driver(args: ["swiftc", "-library-level", "spi", "foo.swift"])
4859+
let plannedJobs = try driver.planBuild()
4860+
let job = plannedJobs[0]
4861+
XCTAssertTrue(job.commandLine.contains(subsequence: [.flag("-library-level"), .flag("spi")]))
4862+
}
4863+
}
4864+
48564865
func testRelativeResourceDir() throws {
48574866
do {
48584867
var driver = try Driver(args: ["swiftc",

0 commit comments

Comments
 (0)