Force compatibility machine target

- We're mostly getting issues with macos runners
  where -march=compatibility looks to work better
  but is not automatically set depending which
  cpu arch is in use.
- Relates #1064
This commit is contained in:
Janne Valkealahti
2024-05-07 09:16:21 +01:00
parent 2b18de0ffb
commit b742264718
2 changed files with 19 additions and 3 deletions

View File

@@ -25,6 +25,11 @@ jobs:
musl: true
name: Compile ${{ matrix.nickname }}
steps:
- name: macos info
if: runner.os == 'macOS'
shell: bash
run: |
sysctl machdep.cpu
- uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
with:
@@ -79,6 +84,11 @@ jobs:
nickname: linux
name: E2E ${{ matrix.os }}
steps:
- name: macos info
if: runner.os == 'macOS'
shell: bash
run: |
sysctl machdep.cpu
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2022-2023 the original author or authors.
* Copyright 2022-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
*/
package org.springframework.shell.gradle;
import java.util.ArrayList;
import org.graalvm.buildtools.gradle.NativeImagePlugin;
import org.graalvm.buildtools.gradle.dsl.GraalVMExtension;
import org.gradle.api.Plugin;
@@ -74,10 +76,14 @@ class SamplePlugin implements Plugin<Project> {
private void configureGraalVmExtension(Project project) {
GraalVMExtension extension = project.getExtensions().getByType(GraalVMExtension.class);
ArrayList<String> options = new ArrayList<String>();
if (isEnabled(project, MUSL)) {
extension.getBinaries().getByName(NativeImagePlugin.NATIVE_MAIN_EXTENSION).buildArgs("--static",
"--libc=musl");
options.add("--static");
options.add("--libc=musl");
}
// force compatibility as detection i.e. in macos runners is flaky
options.add("-march=compatibility");
extension.getBinaries().getByName(NativeImagePlugin.NATIVE_MAIN_EXTENSION).buildArgs(options.toArray());
}
private boolean isEnabled(Project project, String property) {