1
0
mirror of https://github.com/graalvm/setup-graalvm.git synced 2025-03-14 23:10:11 +08:00

99 lines
2.9 KiB
TypeScript
Raw Normal View History

import * as otypes from '@octokit/types'
export const INPUT_VERSION = 'version'
export const INPUT_GDS_TOKEN = 'gds-token'
export const INPUT_JAVA_VERSION = 'java-version'
export const INPUT_DISTRIBUTION = 'distribution'
export const INPUT_COMPONENTS = 'components'
export const INPUT_GITHUB_TOKEN = 'github-token'
export const INPUT_SET_JAVA_HOME = 'set-java-home'
export const INPUT_CACHE = 'cache'
2022-11-02 14:00:51 +01:00
export const INPUT_CHECK_FOR_UPDATES = 'check-for-updates'
export const INPUT_NI_MUSL = 'native-image-musl'
2022-01-20 17:49:45 +01:00
export const IS_LINUX = process.platform === 'linux'
export const IS_MACOS = process.platform === 'darwin'
export const IS_WINDOWS = process.platform === 'win32'
export const DISTRIBUTION_GRAALVM = 'graalvm'
export const DISTRIBUTION_GRAALVM_COMMUNITY = 'graalvm-community'
export const DISTRIBUTION_MANDREL = 'mandrel'
2022-01-03 13:11:04 +01:00
export const VERSION_DEV = 'dev'
export const VERSION_LATEST = 'latest'
export const JDK_ARCH = determineJDKArchitecture()
export const JDK_PLATFORM = determineJDKPlatform()
export const JDK_HOME_SUFFIX = IS_MACOS ? '/Contents/Home' : ''
2022-03-08 10:47:41 +01:00
export const GRAALVM_ARCH = determineGraalVMArchitecture()
export const GRAALVM_FILE_EXTENSION = IS_WINDOWS ? '.zip' : '.tar.gz'
export const GRAALVM_GH_USER = 'graalvm'
export const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform
export const GRAALVM_RELEASES_REPO = 'graalvm-ce-builds'
2022-01-03 09:00:36 +01:00
export const MANDREL_NAMESPACE = 'mandrel-'
export const GDS_BASE = 'https://gds.oracle.com/api/20220101'
export const GDS_GRAALVM_PRODUCT_ID = 'D53FAE8052773FFAE0530F15000AA6C6'
export const ENV_GITHUB_EVENT_NAME = 'GITHUB_EVENT_NAME'
export const EVENT_NAME_PULL_REQUEST = 'pull_request'
export const ERROR_HINT =
'If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.'
export type LatestReleaseResponse =
otypes.Endpoints['GET /repos/{owner}/{repo}/releases/latest']['response']
2022-03-08 10:47:41 +01:00
export type MatchingRefsResponse =
otypes.Endpoints['GET /repos/{owner}/{repo}/git/matching-refs/{ref}']['response']
export type ReleasesResponse =
otypes.Endpoints['GET /repos/{owner}/{repo}/releases']['response']
function determineJDKArchitecture(): string {
switch (process.arch) {
case 'x64': {
return 'x64'
}
case 'arm64': {
return 'aarch64'
}
default: {
throw new Error(`Unsupported architecture: ${process.arch}`)
}
}
}
function determineJDKPlatform(): string {
switch (process.platform) {
case 'linux': {
return 'linux'
}
case 'darwin': {
return 'macos'
}
case 'win32': {
return 'windows'
}
default: {
throw new Error(`Unsupported platform: ${process.platform}`)
}
}
}
2022-03-08 10:47:41 +01:00
function determineGraalVMArchitecture(): string {
switch (process.arch) {
case 'x64': {
return 'amd64'
}
case 'arm64': {
return 'aarch64'
}
default: {
throw new Error(`Unsupported architecture: ${process.arch}`)
}
}
}