Improve version check for reports.

This commit is contained in:
Fabio Niephaus 2023-06-17 16:17:01 +02:00
parent 8f41000162
commit 04ca584c1b
No known key found for this signature in database
GPG Key ID: F21CF5275F31DFD6
4 changed files with 15 additions and 11 deletions

4
dist/cleanup/index.js generated vendored
View File

@ -70221,7 +70221,7 @@ const INPUT_NI_JOB_REPORTS = 'native-image-job-reports';
const INPUT_NI_PR_REPORTS = 'native-image-pr-reports';
const NATIVE_IMAGE_CONFIG_FILE = (0, path_1.join)((0, os_1.tmpdir)(), 'native-image-options.properties');
const NATIVE_IMAGE_CONFIG_FILE_ENV = 'NATIVE_IMAGE_CONFIG_FILE';
function setUpNativeImageBuildReports(graalVMVersion) {
function setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion) {
return __awaiter(this, void 0, void 0, function* () {
const isRequired = areJobReportsEnabled() || arePRReportsEnabled();
if (!isRequired) {
@ -70229,7 +70229,7 @@ function setUpNativeImageBuildReports(graalVMVersion) {
}
const isSupported = graalVMVersion === c.VERSION_LATEST ||
graalVMVersion === c.VERSION_DEV ||
graalVMVersion.length === 0 ||
isGraalVMforJDK17OrLater ||
(!graalVMVersion.startsWith(c.MANDREL_NAMESPACE) &&
(0, semver_1.gte)((0, utils_1.toSemVer)(graalVMVersion), '22.2.0'));
if (!isSupported) {

11
dist/main/index.js generated vendored
View File

@ -70339,7 +70339,7 @@ const INPUT_NI_JOB_REPORTS = 'native-image-job-reports';
const INPUT_NI_PR_REPORTS = 'native-image-pr-reports';
const NATIVE_IMAGE_CONFIG_FILE = (0, path_1.join)((0, os_1.tmpdir)(), 'native-image-options.properties');
const NATIVE_IMAGE_CONFIG_FILE_ENV = 'NATIVE_IMAGE_CONFIG_FILE';
function setUpNativeImageBuildReports(graalVMVersion) {
function setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion) {
return __awaiter(this, void 0, void 0, function* () {
const isRequired = areJobReportsEnabled() || arePRReportsEnabled();
if (!isRequired) {
@ -70347,7 +70347,7 @@ function setUpNativeImageBuildReports(graalVMVersion) {
}
const isSupported = graalVMVersion === c.VERSION_LATEST ||
graalVMVersion === c.VERSION_DEV ||
graalVMVersion.length === 0 ||
isGraalVMforJDK17OrLater ||
(!graalVMVersion.startsWith(c.MANDREL_NAMESPACE) &&
(0, semver_1.gte)((0, utils_1.toSemVer)(graalVMVersion), '22.2.0'));
if (!isSupported) {
@ -71136,9 +71136,10 @@ function run() {
if (enableNativeImageMusl) {
yield (0, musl_1.setUpNativeImageMusl)();
}
// Download or build GraalVM
// Download GraalVM JDK
const isGraalVMforJDK17OrLater = distribution.length > 0 || graalvmVersion.length == 0;
let graalVMHome;
if (distribution.length > 0 || graalvmVersion.length == 0) {
if (isGraalVMforJDK17OrLater) {
switch (distribution) {
case c.DISTRIBUTION_GRAALVM:
graalVMHome = yield graalvm.setUpGraalVMJDK(javaVersion);
@ -71211,7 +71212,7 @@ function run() {
if (cache && (0, cache_1.isFeatureAvailable)()) {
yield (0, cache_2.restore)(cache);
}
(0, reports_1.setUpNativeImageBuildReports)(graalvmVersion);
(0, reports_1.setUpNativeImageBuildReports)(isGraalVMforJDK17OrLater, graalvmVersion);
}
catch (error) {
if (error instanceof Error)

View File

@ -79,6 +79,7 @@ interface BuildOutput {
}
export async function setUpNativeImageBuildReports(
isGraalVMforJDK17OrLater: boolean,
graalVMVersion: string
): Promise<void> {
const isRequired = areJobReportsEnabled() || arePRReportsEnabled()
@ -88,7 +89,7 @@ export async function setUpNativeImageBuildReports(
const isSupported =
graalVMVersion === c.VERSION_LATEST ||
graalVMVersion === c.VERSION_DEV ||
graalVMVersion.length === 0 ||
isGraalVMforJDK17OrLater ||
(!graalVMVersion.startsWith(c.MANDREL_NAMESPACE) &&
gte(toSemVer(graalVMVersion), '22.2.0'))
if (!isSupported) {

View File

@ -38,9 +38,11 @@ async function run(): Promise<void> {
await setUpNativeImageMusl()
}
// Download or build GraalVM
// Download GraalVM JDK
const isGraalVMforJDK17OrLater =
distribution.length > 0 || graalvmVersion.length == 0
let graalVMHome
if (distribution.length > 0 || graalvmVersion.length == 0) {
if (isGraalVMforJDK17OrLater) {
switch (distribution) {
case c.DISTRIBUTION_GRAALVM:
graalVMHome = await graalvm.setUpGraalVMJDK(javaVersion)
@ -132,7 +134,7 @@ async function run(): Promise<void> {
if (cache && isCacheAvailable()) {
await restore(cache)
}
setUpNativeImageBuildReports(graalvmVersion)
setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalvmVersion)
} catch (error) {
if (error instanceof Error) core.setFailed(error.message)
}