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. - Backport #1064
This commit is contained in:
10
.github/workflows/e2e.yml
vendored
10
.github/workflows/e2e.yml
vendored
@@ -25,6 +25,11 @@ jobs:
|
|||||||
musl: true
|
musl: true
|
||||||
name: Compile ${{ matrix.nickname }}
|
name: Compile ${{ matrix.nickname }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: macos info
|
||||||
|
if: runner.os == 'macOS'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sysctl machdep.cpu
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: graalvm/setup-graalvm@v1
|
- uses: graalvm/setup-graalvm@v1
|
||||||
with:
|
with:
|
||||||
@@ -76,6 +81,11 @@ jobs:
|
|||||||
nickname: linux
|
nickname: linux
|
||||||
name: E2E ${{ matrix.os }}
|
name: E2E ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: macos info
|
||||||
|
if: runner.os == 'macOS'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sysctl machdep.cpu
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.shell.gradle;
|
package org.springframework.shell.gradle;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.graalvm.buildtools.gradle.NativeImagePlugin;
|
import org.graalvm.buildtools.gradle.NativeImagePlugin;
|
||||||
import org.graalvm.buildtools.gradle.dsl.GraalVMExtension;
|
import org.graalvm.buildtools.gradle.dsl.GraalVMExtension;
|
||||||
import org.gradle.api.Plugin;
|
import org.gradle.api.Plugin;
|
||||||
@@ -74,10 +76,14 @@ class SamplePlugin implements Plugin<Project> {
|
|||||||
|
|
||||||
private void configureGraalVmExtension(Project project) {
|
private void configureGraalVmExtension(Project project) {
|
||||||
GraalVMExtension extension = project.getExtensions().getByType(GraalVMExtension.class);
|
GraalVMExtension extension = project.getExtensions().getByType(GraalVMExtension.class);
|
||||||
|
ArrayList<String> options = new ArrayList<String>();
|
||||||
if (isEnabled(project, MUSL)) {
|
if (isEnabled(project, MUSL)) {
|
||||||
extension.getBinaries().getByName(NativeImagePlugin.NATIVE_MAIN_EXTENSION).buildArgs("--static",
|
options.add("--static");
|
||||||
"--libc=musl");
|
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) {
|
private boolean isEnabled(Project project, String property) {
|
||||||
|
|||||||
Reference in New Issue
Block a user