2026-07-29 17:53:33 -04:00
export const id = 557 ;
export const ids = [ 557 ] ;
export const modules = {
/***/ 7557 :
/***/ ( ( _ _unused _webpack _module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) => {
/* harmony export */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
/* harmony export */ SapMachineDistribution : ( ) => ( /* binding */ SapMachineDistribution )
/* harmony export */ } ) ;
/* harmony import */ var _actions _core _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( 3838 ) ;
2026-08-04 23:05:06 -04:00
/* harmony import */ var semver _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( 2088 ) ;
/* harmony import */ var semver _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( semver _ _WEBPACK _IMPORTED _MODULE _1 _ _ ) ;
/* harmony import */ var fs _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( 9896 ) ;
/* harmony import */ var fs _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( fs _ _WEBPACK _IMPORTED _MODULE _2 _ _ ) ;
/* harmony import */ var path _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( 6928 ) ;
/* harmony import */ var path _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( path _ _WEBPACK _IMPORTED _MODULE _3 _ _ ) ;
/* harmony import */ var _util _js _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( 4527 ) ;
/* harmony import */ var _base _installer _js _ _WEBPACK _IMPORTED _MODULE _5 _ _ = _ _webpack _require _ _ ( 6242 ) ;
2026-08-05 18:45:11 +02:00
/* harmony import */ var _platform _types _js _ _WEBPACK _IMPORTED _MODULE _6 _ _ = _ _webpack _require _ _ ( 7444 ) ;
2026-07-29 17:53:33 -04:00
2026-08-04 23:05:06 -04:00
class SapMachineDistribution extends _base _installer _js _ _WEBPACK _IMPORTED _MODULE _5 _ _ /* .JavaBase */ . O {
2026-07-29 17:53:33 -04:00
constructor ( installerOptions ) {
super ( 'SapMachine' , installerOptions ) ;
}
async findPackageForDownload ( version ) {
_actions _core _ _WEBPACK _IMPORTED _MODULE _0 _ _ /* .debug */ . Yz ( ` Only stable versions: ${ this . stable } ` ) ;
if ( ! [ 'jdk' , 'jre' ] . includes ( this . packageType ) ) {
throw new Error ( 'SapMachine provides only the `jdk` and `jre` package type' ) ;
}
const availableVersions = await this . getAvailableVersions ( ) ;
const matchedVersions = availableVersions
. filter ( item => {
2026-08-04 23:05:06 -04:00
return ( 0 , _util _js _ _WEBPACK _IMPORTED _MODULE _4 _ _ /* .isVersionSatisfies */ . y ) ( version , item . version ) ;
2026-07-29 17:53:33 -04:00
} )
. map ( item => {
return {
version : item . version ,
url : item . downloadLink
} ;
} ) ;
if ( ! matchedVersions . length ) {
const availableVersionStrings = availableVersions . map ( item => item . version ) ;
throw this . createVersionNotFoundError ( version , availableVersionStrings ) ;
}
const resolvedVersion = matchedVersions [ 0 ] ;
const checksumUrl = resolvedVersion . url . replace ( /\.(?:tar\.gz|zip)$/ , '.sha256.txt' ) ;
return {
... resolvedVersion ,
checksum : await this . fetchChecksum ( checksumUrl , 'sha256' )
} ;
}
async getAvailableVersions ( ) {
const platform = this . getPlatformOption ( ) ;
const arch = this . distributionArchitecture ( ) ;
let fetchedReleasesJson = await this . fetchReleasesFromUrl ( 'https://sapmachine.io/assets/data/sapmachine-releases-all.json' ) ;
if ( ! fetchedReleasesJson ) {
fetchedReleasesJson = await this . fetchReleasesFromUrl ( 'https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json' ) ;
}
if ( ! fetchedReleasesJson ) {
throw new Error ( ` Couldn't fetch SapMachine versions information from both primary and backup urls ` ) ;
}
_actions _core _ _WEBPACK _IMPORTED _MODULE _0 _ _ /* .debug */ . Yz ( 'Successfully fetched information about available SapMachine versions' ) ;
const availableVersions = this . parseVersions ( platform , arch , fetchedReleasesJson ) ;
if ( _actions _core _ _WEBPACK _IMPORTED _MODULE _0 _ _ /* .isDebug */ . _o ( ) ) {
_actions _core _ _WEBPACK _IMPORTED _MODULE _0 _ _ /* .startGroup */ . Oh ( 'Print information about available versions' ) ;
_actions _core _ _WEBPACK _IMPORTED _MODULE _0 _ _ /* .debug */ . Yz ( availableVersions . map ( item => item . version ) . join ( ', ' ) ) ;
_actions _core _ _WEBPACK _IMPORTED _MODULE _0 _ _ /* .endGroup */ . N4 ( ) ;
}
return availableVersions ;
}
async downloadTool ( javaRelease ) {
_actions _core _ _WEBPACK _IMPORTED _MODULE _0 _ _ /* .info */ . pq ( ` Downloading Java ${ javaRelease . version } ( ${ this . distribution } ) from ${ javaRelease . url } ... ` ) ;
let javaArchivePath = await this . downloadAndVerify ( javaRelease ) ;
_actions _core _ _WEBPACK _IMPORTED _MODULE _0 _ _ /* .info */ . pq ( ` Extracting Java archive... ` ) ;
2026-08-04 23:05:06 -04:00
const extension = ( 0 , _util _js _ _WEBPACK _IMPORTED _MODULE _4 _ _ /* .getDownloadArchiveExtension */ . ag ) ( ) ;
2026-07-29 17:53:33 -04:00
if ( process . platform === 'win32' ) {
2026-08-04 23:05:06 -04:00
javaArchivePath = ( 0 , _util _js _ _WEBPACK _IMPORTED _MODULE _4 _ _ /* .renameWinArchive */ . n2 ) ( javaArchivePath ) ;
2026-07-29 17:53:33 -04:00
}
2026-08-04 23:05:06 -04:00
const extractedJavaPath = await ( 0 , _util _js _ _WEBPACK _IMPORTED _MODULE _4 _ _ /* .extractJdkFile */ . PE ) ( javaArchivePath , extension ) ;
const archiveName = fs _ _WEBPACK _IMPORTED _MODULE _2 _ _ _default ( ) . readdirSync ( extractedJavaPath ) [ 0 ] ;
const archivePath = path _ _WEBPACK _IMPORTED _MODULE _3 _ _ _default ( ) . join ( extractedJavaPath , archiveName ) ;
2026-07-29 17:53:33 -04:00
const version = this . getToolcacheVersionName ( javaRelease . version ) ;
2026-08-04 23:05:06 -04:00
const javaPath = await ( 0 , _util _js _ _WEBPACK _IMPORTED _MODULE _4 _ _ /* .cacheJdkDir */ . Vj ) ( archivePath , this . toolcacheFolderName , version , this . architecture ) ;
2026-07-29 17:53:33 -04:00
return { version : javaRelease . version , path : javaPath } ;
}
parseVersions ( platform , arch , versions ) {
const eligibleVersions = [ ] ;
for ( const [ , majorVersionMap ] of Object . entries ( versions ) ) {
for ( const [ , jdkVersionMap ] of Object . entries ( majorVersionMap . updates ) ) {
for ( const [ buildVersion , buildVersionMap ] of Object . entries ( jdkVersionMap ) ) {
let buildVersionWithoutPrefix = buildVersion . replace ( 'sapmachine-' , '' ) ;
if ( ! buildVersionWithoutPrefix . includes ( '.' ) ) {
// replace major version with major.minor.patch and keep the remaining build identifier after the + as is with regex
buildVersionWithoutPrefix = buildVersionWithoutPrefix . replace ( /(\d+)(\+.*)?/ , '$1.0.0$2' ) ;
}
// replace + with . to convert to semver format if we have more than 3 version digits
if ( buildVersionWithoutPrefix . split ( '.' ) . length > 3 ) {
buildVersionWithoutPrefix = buildVersionWithoutPrefix . replace ( '+' , '.' ) ;
}
2026-08-04 23:05:06 -04:00
buildVersionWithoutPrefix = ( 0 , _util _js _ _WEBPACK _IMPORTED _MODULE _4 _ _ /* .convertVersionToSemver */ . ZY ) ( buildVersionWithoutPrefix ) ;
2026-07-29 17:53:33 -04:00
// ignore invalid version
2026-08-04 23:05:06 -04:00
if ( ! semver _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) . valid ( buildVersionWithoutPrefix ) ) {
2026-07-29 17:53:33 -04:00
_actions _core _ _WEBPACK _IMPORTED _MODULE _0 _ _ /* .debug */ . Yz ( ` Invalid version: ${ buildVersionWithoutPrefix } ` ) ;
continue ;
}
2026-08-05 18:59:08 +02:00
const isEarlyAccess = buildVersionMap . ea === true || buildVersionMap . ea === 'true' ;
if ( this . stable === isEarlyAccess ) {
2026-07-29 17:53:33 -04:00
continue ;
}
for ( const [ edition , editionAssets ] of Object . entries ( buildVersionMap . assets ) ) {
if ( this . packageType !== edition ) {
continue ;
}
for ( const [ archAndPlatForm , archAssets ] of Object . entries ( editionAssets ) ) {
let expectedArchAndPlatform = ` ${ platform } - ${ arch } ` ;
if ( platform === 'linux-musl' ) {
expectedArchAndPlatform = ` linux- ${ arch } -musl ` ;
}
if ( archAndPlatForm !== expectedArchAndPlatform ) {
continue ;
}
for ( const [ contentType , contentTypeAssets ] of Object . entries ( archAssets ) ) {
// skip if not tar.gz and zip files
if ( contentType !== 'tar.gz' && contentType !== 'zip' ) {
continue ;
}
eligibleVersions . push ( {
os : platform ,
architecture : arch ,
version : buildVersionWithoutPrefix ,
checksum : contentTypeAssets . checksum ,
downloadLink : contentTypeAssets . url ,
packageType : edition
} ) ;
}
}
}
}
}
}
const sortedVersions = this . sortParsedVersions ( eligibleVersions ) ;
return sortedVersions ;
}
// Sorts versions in descending order as by default data in JSON isn't sorted
sortParsedVersions ( eligibleVersions ) {
const sortedVersions = eligibleVersions . sort ( ( versionObj1 , versionObj2 ) => {
const version1 = versionObj1 . version ;
const version2 = versionObj2 . version ;
2026-08-04 23:05:06 -04:00
return semver _ _WEBPACK _IMPORTED _MODULE _1 _ _ _default ( ) . compareBuild ( version1 , version2 ) ;
2026-07-29 17:53:33 -04:00
} ) ;
return sortedVersions . reverse ( ) ;
}
getPlatformOption ( ) {
switch ( process . platform ) {
case 'win32' :
return 'windows' ;
case 'darwin' :
return 'macos' ;
case 'linux' :
// figure out if alpine/musl
2026-08-05 18:45:11 +02:00
if ( ( 0 , _platform _types _js _ _WEBPACK _IMPORTED _MODULE _6 _ _ /* .isAlpineLinux */ . G6 ) ( ) ) {
2026-07-29 17:53:33 -04:00
return 'linux-musl' ;
}
return 'linux' ;
default :
return process . platform ;
}
}
async fetchReleasesFromUrl ( url , headers = { } ) {
try {
_actions _core _ _WEBPACK _IMPORTED _MODULE _0 _ _ /* .debug */ . Yz ( ` Trying to fetch available SapMachine versions info from the primary url: ${ url } ` ) ;
const releases = ( await this . http . getJson ( url , headers ) ) . result ;
return releases ;
}
catch ( err ) {
_actions _core _ _WEBPACK _IMPORTED _MODULE _0 _ _ /* .debug */ . Yz ( ` Fetching SapMachine versions info from the link: ${ url } ended up with the error: ${ err . message } ` ) ;
return null ;
}
}
}
/***/ } )
} ;