Skip to content

Commit e5ecfef

Browse files
committed
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 spring-projects#1064
1 parent 2b18de0 commit e5ecfef

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

buildSrc/src/main/java/org/springframework/shell/gradle/SamplePlugin.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022-2023 the original author or authors.
2+
* Copyright 2022-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
1515
*/
1616
package org.springframework.shell.gradle;
1717

18+
import java.util.ArrayList;
19+
1820
import org.graalvm.buildtools.gradle.NativeImagePlugin;
1921
import org.graalvm.buildtools.gradle.dsl.GraalVMExtension;
2022
import org.gradle.api.Plugin;
@@ -74,10 +76,14 @@ private void customizeNative(Project project) {
7476

7577
private void configureGraalVmExtension(Project project) {
7678
GraalVMExtension extension = project.getExtensions().getByType(GraalVMExtension.class);
79+
ArrayList<String> options = new ArrayList<String>();
7780
if (isEnabled(project, MUSL)) {
78-
extension.getBinaries().getByName(NativeImagePlugin.NATIVE_MAIN_EXTENSION).buildArgs("--static",
79-
"--libc=musl");
81+
options.add("--static");
82+
options.add("--libc=musl");
8083
}
84+
// force compatibility as detection i.e. in macos runners is flaky
85+
options.add("-march=compatibility");
86+
extension.getBinaries().getByName(NativeImagePlugin.NATIVE_MAIN_EXTENSION).buildArgs(options.toArray());
8187
}
8288

8389
private boolean isEnabled(Project project, String property) {

0 commit comments

Comments
 (0)