mirror of
https://github.com/graalvm/setup-graalvm.git
synced 2025-01-31 19:26:36 +08:00
Set up GraalVM components with gu.
This commit is contained in:
parent
c26d35376d
commit
b7dfeb8214
38
src/gu.ts
Normal file
38
src/gu.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import {GRAALVM_PLATFORM} from './constants'
|
||||||
|
import {exec} from '@actions/exec'
|
||||||
|
import {join} from 'path'
|
||||||
|
|
||||||
|
const COMPONENT_TO_POST_INSTALL_HOOK = new Map<string, Map<string, string>>([
|
||||||
|
[
|
||||||
|
'linux',
|
||||||
|
new Map<string, string>([
|
||||||
|
['ruby', 'languages/ruby/lib/truffle/post_install_hook.sh']
|
||||||
|
// ['R', 'languages/R/bin/configure_fastr'] (GR-36105: cannot be run non-interactively)
|
||||||
|
])
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'darwin',
|
||||||
|
new Map<string, string>([
|
||||||
|
['ruby', 'languages/ruby/lib/truffle/post_install_hook.sh']
|
||||||
|
// ['R', 'languages/R/bin/configure_fastr'] (GR-36105: cannot be run non-interactively)
|
||||||
|
])
|
||||||
|
]
|
||||||
|
// No post install hooks for Windows (yet)
|
||||||
|
])
|
||||||
|
|
||||||
|
export async function setUpGUComponents(
|
||||||
|
graalVMHome: string,
|
||||||
|
components: string[]
|
||||||
|
): Promise<void> {
|
||||||
|
await exec('gu', ['install', '--no-progress'].concat(components))
|
||||||
|
|
||||||
|
const platformHooks = COMPONENT_TO_POST_INSTALL_HOOK.get(GRAALVM_PLATFORM)
|
||||||
|
if (platformHooks) {
|
||||||
|
for (const component of components) {
|
||||||
|
const postInstallHook = platformHooks.get(component)
|
||||||
|
if (postInstallHook) {
|
||||||
|
await exec(`"${join(graalVMHome, postInstallHook)}"`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
src/main.ts
10
src/main.ts
@ -4,6 +4,7 @@ import * as graalvm from './graalvm'
|
|||||||
import {join} from 'path'
|
import {join} from 'path'
|
||||||
import {mkdirP} from '@actions/io'
|
import {mkdirP} from '@actions/io'
|
||||||
import {setUpDependencies} from './dependencies'
|
import {setUpDependencies} from './dependencies'
|
||||||
|
import {setUpGUComponents} from './gu'
|
||||||
import {setUpGraalVMTrunk} from './graalvm-trunk'
|
import {setUpGraalVMTrunk} from './graalvm-trunk'
|
||||||
import {setUpWindowsEnvironment} from './msvc'
|
import {setUpWindowsEnvironment} from './msvc'
|
||||||
|
|
||||||
@ -50,6 +51,15 @@ async function run(): Promise<void> {
|
|||||||
if (setJavaHome) {
|
if (setJavaHome) {
|
||||||
core.exportVariable('JAVA_HOME', graalVMHome)
|
core.exportVariable('JAVA_HOME', graalVMHome)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set up GraalVM components (if any)
|
||||||
|
if (components.length > 0) {
|
||||||
|
if (graalvmVersion === c.VERSION_TRUNK) {
|
||||||
|
// components built from source, nothing to do
|
||||||
|
} else {
|
||||||
|
await setUpGUComponents(graalVMHome, components)
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error) core.setFailed(error.message)
|
if (error instanceof Error) core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user