From 67d37016a4334de7ecbdaa36ca9d043316385f4a Mon Sep 17 00:00:00 2001 From: Xi Ge Date: Mon, 19 Apr 2021 22:47:33 -0700 Subject: [PATCH] PrebuiltModuleGen: add an option for skipping the job execution --- Sources/swift-build-sdk-interfaces/main.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/swift-build-sdk-interfaces/main.swift b/Sources/swift-build-sdk-interfaces/main.swift index f17c083bc..8d61815f9 100644 --- a/Sources/swift-build-sdk-interfaces/main.swift +++ b/Sources/swift-build-sdk-interfaces/main.swift @@ -44,6 +44,9 @@ let coreMode = CommandLine.arguments.contains("-core") /// Verbose to print more info let verbose = CommandLine.arguments.contains("-v") +/// Skip executing the jobs +let skipExecution = CommandLine.arguments.contains("-n") + do { let sdkPath = try VirtualPath(path: sdkPathRaw).absolutePath! if !localFileSystem.exists(sdkPath) { @@ -117,6 +120,15 @@ do { executor: executor, compilerExecutableDir: swiftcPath.parentDirectory) let (jobs, danglingJobs) = try driver.generatePrebuitModuleGenerationJobs(with: inputMap, into: outputDir, exhaustive: !coreMode) + if verbose { + Driver.stdErrQueue.sync { + stderrStream <<< "job count: \(jobs.count + danglingJobs.count)\n" + stderrStream.flush() + } + } + if skipExecution { + exit(0) + } let delegate = PrebuitModuleGenerationDelegate(jobs, diagnosticsEngine, verbose) do { try executor.execute(workload: DriverExecutorWorkload.init(jobs, nil, continueBuildingAfterErrors: true),