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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user