@@ -244,17 +244,27 @@ async function getLLVMPackageInfo(version: string, platform: NodeJS.Platform, _a
244
244
}
245
245
246
246
export async function setupLLVM ( version : string , setupDir : string , arch : string ) : Promise < InstallationInfo > {
247
- const installationInfo = await setupBin ( "llvm" , version , getLLVMPackageInfo , setupDir , arch )
247
+ const installationInfo = await _setupLLVM ( version , setupDir , arch )
248
248
await activateLLVM ( installationInfo . installDir ?? setupDir , version )
249
249
return installationInfo
250
250
}
251
251
252
- export async function activateLLVM ( directory : string , versionGiven : string ) {
253
- if ( process . platform === "linux" ) {
254
- // install llvm build dependencies
255
- await setupAptPack ( "build-essential" ) // TODO(question) llvm needs ld. But does it need all the build-essential?
252
+ let didInit = false
253
+ async function _setupLLVM ( version : string , setupDir : string , arch : string ) {
254
+ const installationInfo = await setupBin ( "llvm" , version , getLLVMPackageInfo , setupDir , arch )
255
+ if ( ! didInit ) {
256
+ if ( process . platform === "linux" ) {
257
+ // install llvm build dependencies
258
+ await setupAptPack ( "build-essential" ) // TODO(question) llvm needs ld. But does it need all the build-essential?
259
+ await setupAptPack ( "libtinfo-dev" )
260
+ }
261
+ // eslint-disable-next-line require-atomic-updates
262
+ didInit = true
256
263
}
264
+ return installationInfo
265
+ }
257
266
267
+ export async function activateLLVM ( directory : string , versionGiven : string ) {
258
268
const version = semverCoerceIfInvalid ( versionGiven )
259
269
260
270
const lib = path . join ( directory , "lib" )
@@ -295,7 +305,7 @@ export function setupClangTools(version: string, setupDir: string, arch: string)
295
305
if ( isGitHubCI ( ) ) {
296
306
addLLVMLoggingMatcher ( )
297
307
}
298
- return setupBin ( "llvm" , version , getLLVMPackageInfo , setupDir , arch )
308
+ return _setupLLVM ( version , setupDir , arch )
299
309
}
300
310
301
311
function addLLVMLoggingMatcher ( ) {
0 commit comments