From fe9c44bfd3c1aeed59932c529fd314b7faf0baef Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Sun, 19 May 2024 22:22:23 -0700 Subject: [PATCH 1/3] Update options for new package-related options --- Sources/SwiftOptions/Options.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Sources/SwiftOptions/Options.swift b/Sources/SwiftOptions/Options.swift index 71ce912ff..1df74b1dc 100644 --- a/Sources/SwiftOptions/Options.swift +++ b/Sources/SwiftOptions/Options.swift @@ -642,8 +642,11 @@ extension Option { public static let outputFilelist: Option = Option("-output-filelist", .separate, attributes: [.frontend, .noDriver, .cacheInvariant], helpText: "Specify outputs in a file rather than on the command line") public static let O: Option = Option("-O", .flag, attributes: [.frontend, .moduleInterface], helpText: "Compile with optimizations", group: .O) public static let o: Option = Option("-o", .joinedOrSeparate, attributes: [.frontend, .noInteractive, .autolinkExtract, .moduleWrap, .indent, .argumentIsPath, .cacheInvariant], metaVar: "", helpText: "Write output to ") + public static let packageAvailableModules: Option = Option("-package-available-modules", .separate, attributes: [.frontend], helpText: "JSON file describing the modules that are available within the enclosing package") public static let packageDescriptionVersion: Option = Option("-package-description-version", .separate, attributes: [.helpHidden, .frontend, .moduleInterface], metaVar: "", helpText: "The version number to be applied on the input for the PackageDescription availability kind") + public static let packageManifest: Option = Option("-package-manifest", .separate, attributes: [.frontend, .argumentIsPath], helpText: "The path to the package manifest in which this source file resides") public static let packageName: Option = Option("-package-name", .separate, attributes: [.frontend, .moduleInterface], helpText: "Name of the package the module belongs to") + public static let packageTargetName: Option = Option("-package-target-name", .separate, attributes: [.frontend], helpText: "The name of the target corresponding to this module within the enclosing package") public static let parallelScan: Option = Option("-parallel-scan", .flag, attributes: [.frontend, .noDriver], helpText: "Perform dependency scanning in-parallel.") public static let parseAsLibrary: Option = Option("-parse-as-library", .flag, attributes: [.frontend, .noInteractive], helpText: "Parse the input file(s) as libraries, not scripts") public static let parseSil: Option = Option("-parse-sil", .flag, attributes: [.frontend, .noInteractive], helpText: "Parse the input file as SIL code, not Swift source") @@ -771,7 +774,6 @@ extension Option { public static let suppressStaticExclusivitySwap: Option = Option("-suppress-static-exclusivity-swap", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Suppress static violations of exclusive access with swap()") public static let suppressWarnings: Option = Option("-suppress-warnings", .flag, attributes: [.frontend], helpText: "Suppress all warnings") public static let swiftAsyncFramePointerEQ: Option = Option("-swift-async-frame-pointer=", .joined, attributes: [.helpHidden, .frontend, .noDriver], helpText: "One of 'auto', 'always' or 'never'") - public static let swiftModuleCrossImport: Option = Option("-swift-module-cross-import", .multiArg, attributes: [.frontend, .noDriver], metaVar: " ", helpText: "Specify the cross import module", numArgs: 2) public static let swiftModuleFile: Option = Option("-swift-module-file=", .joined, attributes: [.frontend, .noDriver], metaVar: "=", helpText: "Specify Swift module input explicitly built from textual interface") public static let swiftOnly: Option = Option("-swift-only", .flag, attributes: [.noDriver], helpText: "Only include APIs defined from Swift source") public static let swiftOnly_: Option = Option("--swift-only", .flag, alias: Option.swiftOnly, attributes: [.noDriver], helpText: "Only include APIs defined from Swift source") @@ -1495,8 +1497,11 @@ extension Option { Option.outputFilelist, Option.O, Option.o, + Option.packageAvailableModules, Option.packageDescriptionVersion, + Option.packageManifest, Option.packageName, + Option.packageTargetName, Option.parallelScan, Option.parseAsLibrary, Option.parseSil, @@ -1624,7 +1629,6 @@ extension Option { Option.suppressStaticExclusivitySwap, Option.suppressWarnings, Option.swiftAsyncFramePointerEQ, - Option.swiftModuleCrossImport, Option.swiftModuleFile, Option.swiftOnly, Option.swiftOnly_, From 137cc189728e545de155e5e2cdca8d0e0a35545e Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Sun, 19 May 2024 22:28:00 -0700 Subject: [PATCH 2/3] Pass through package manifest and available modules options when frontend allows --- Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift b/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift index 338f78172..d7951803f 100644 --- a/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift +++ b/Sources/SwiftDriver/Jobs/FrontendJobHelpers.swift @@ -287,6 +287,12 @@ extension Driver { .experimentalClangImporterDirectCc1Scan, from: &parsedOptions) } + if isFrontendArgSupported(.packageAvailableModules) { + try commandLine.appendAll(.packageManifest, from: &parsedOptions) + try commandLine.appendAll(.packageTargetName, from: &parsedOptions) + try commandLine.appendAll(.packageAvailableModules, from: &parsedOptions) + } + // Expand the -experimental-hermetic-seal-at-link flag if parsedOptions.hasArgument(.experimentalHermeticSealAtLink) { commandLine.appendFlag("-enable-llvm-vfe") From 54296388bd7769f13f8710fab2b6743962bece0e Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Mon, 20 May 2024 08:37:45 -0700 Subject: [PATCH 3/3] Regenerate with new options --- Sources/SwiftOptions/Options.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/SwiftOptions/Options.swift b/Sources/SwiftOptions/Options.swift index 1df74b1dc..fa6263924 100644 --- a/Sources/SwiftOptions/Options.swift +++ b/Sources/SwiftOptions/Options.swift @@ -642,11 +642,11 @@ extension Option { public static let outputFilelist: Option = Option("-output-filelist", .separate, attributes: [.frontend, .noDriver, .cacheInvariant], helpText: "Specify outputs in a file rather than on the command line") public static let O: Option = Option("-O", .flag, attributes: [.frontend, .moduleInterface], helpText: "Compile with optimizations", group: .O) public static let o: Option = Option("-o", .joinedOrSeparate, attributes: [.frontend, .noInteractive, .autolinkExtract, .moduleWrap, .indent, .argumentIsPath, .cacheInvariant], metaVar: "", helpText: "Write output to ") - public static let packageAvailableModules: Option = Option("-package-available-modules", .separate, attributes: [.frontend], helpText: "JSON file describing the modules that are available within the enclosing package") + public static let packageAvailableModules: Option = Option("-package-available-modules", .separate, attributes: [.frontend, .doesNotAffectIncrementalBuild, .argumentIsPath], helpText: "JSON file describing the modules that are available within the enclosing package") public static let packageDescriptionVersion: Option = Option("-package-description-version", .separate, attributes: [.helpHidden, .frontend, .moduleInterface], metaVar: "", helpText: "The version number to be applied on the input for the PackageDescription availability kind") - public static let packageManifest: Option = Option("-package-manifest", .separate, attributes: [.frontend, .argumentIsPath], helpText: "The path to the package manifest in which this source file resides") + public static let packageManifest: Option = Option("-package-manifest", .separate, attributes: [.frontend, .doesNotAffectIncrementalBuild, .argumentIsPath], helpText: "The path to the package manifest in which this source file resides") public static let packageName: Option = Option("-package-name", .separate, attributes: [.frontend, .moduleInterface], helpText: "Name of the package the module belongs to") - public static let packageTargetName: Option = Option("-package-target-name", .separate, attributes: [.frontend], helpText: "The name of the target corresponding to this module within the enclosing package") + public static let packageTargetName: Option = Option("-package-target-name", .separate, attributes: [.frontend, .doesNotAffectIncrementalBuild], helpText: "The name of the target corresponding to this module within the enclosing package") public static let parallelScan: Option = Option("-parallel-scan", .flag, attributes: [.frontend, .noDriver], helpText: "Perform dependency scanning in-parallel.") public static let parseAsLibrary: Option = Option("-parse-as-library", .flag, attributes: [.frontend, .noInteractive], helpText: "Parse the input file(s) as libraries, not scripts") public static let parseSil: Option = Option("-parse-sil", .flag, attributes: [.frontend, .noInteractive], helpText: "Parse the input file as SIL code, not Swift source")