fix(process): add an opt-in Swift module cache (#2252)
* fix(process): add an opt-in Swift module cache Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com> * fix(process): preserve caller-owned Swift module caches Fold the complementary implementation from #2260 into the earlier #2252 proposal, retaining the original contribution history. Co-authored-by: NIU-123370 <191000457+NIU-123370@users.noreply.github.com> * fix(process): bypass xcrun lookup for explicit Swift toolchains --------- Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> Co-authored-by: NIU-123370 <191000457+NIU-123370@users.noreply.github.com>
This commit is contained in:
co-authored by
morluto
NIU-123370
parent
f941968eb1
commit
47a51b08f4
@@ -4,7 +4,10 @@ import { AnalysisCapabilityUnavailableError } from "../domain/analysisErrorCore.
|
||||
import { launcherIdentityFailure } from "./ProcessOwnershipIdentity.js";
|
||||
import { descendantsOf, liveProcesses } from "./ProcessOwnershipProcessTree.js";
|
||||
import { execFileOutput } from "./ExecFileOutput.js";
|
||||
import { createDarwinProcessRunTokenReader } from "./DarwinProcessRunTokenReader.js";
|
||||
import {
|
||||
createDarwinProcessRunTokenReader,
|
||||
type DarwinProcessReaderCompiler,
|
||||
} from "./DarwinProcessRunTokenReader.js";
|
||||
import { readProcessRunTokens } from "./ProcessRunTokenObservations.js";
|
||||
import type {
|
||||
OwnedProcessGroup,
|
||||
@@ -219,16 +222,32 @@ export const createSystemProcessOwnershipHost = (
|
||||
hostEnvironment: NodeJS.ProcessEnv = process.env,
|
||||
options: {
|
||||
/** Override the compiler executable used by the Darwin native reader. */
|
||||
readonly darwinXcrun?: string;
|
||||
readonly darwinCompiler?: DarwinProcessReaderCompiler;
|
||||
/** Override the caller-owned module cache used compiling that helper. */
|
||||
readonly darwinModuleCachePath?: string;
|
||||
} = {},
|
||||
): ProcessOwnershipHost => {
|
||||
const darwinModuleCachePath =
|
||||
options.darwinModuleCachePath ??
|
||||
hostEnvironment.REA_DARWIN_MODULE_CACHE_PATH;
|
||||
const swiftcPath = hostEnvironment.REA_DARWIN_SWIFTC_PATH;
|
||||
const darwinCompiler =
|
||||
options.darwinCompiler ??
|
||||
(swiftcPath === undefined || swiftcPath === ""
|
||||
? undefined
|
||||
: {
|
||||
kind: "swiftc" as const,
|
||||
executable: swiftcPath,
|
||||
sdkRoot: hostEnvironment.SDKROOT ?? "",
|
||||
});
|
||||
const darwinTokens =
|
||||
platform === "darwin"
|
||||
? createDarwinProcessRunTokenReader(
|
||||
options.darwinXcrun === undefined
|
||||
? createDarwinProcessRunTokenReader({
|
||||
...(darwinCompiler === undefined ? {} : { compiler: darwinCompiler }),
|
||||
...(darwinModuleCachePath === undefined
|
||||
? {}
|
||||
: { xcrun: options.darwinXcrun },
|
||||
)
|
||||
: { moduleCachePath: darwinModuleCachePath }),
|
||||
})
|
||||
: undefined;
|
||||
const listProcesses = async (signal?: AbortSignal) => {
|
||||
if (platform === "win32") return [];
|
||||
|
||||
Reference in New Issue
Block a user