-
Notifications
You must be signed in to change notification settings - Fork 80
Description
Is your feature request related to a problem?
Some build args are only supported on certain platforms like --gc=G1 is supported on linux but not macos.
This forces apps using native-maven-plugin , that want to build on multiple platforms to use maven profiles to override the build args. Although this works:
- it is fairly verbose solution
- means a lot of build args are copy n paste to multiple locations.
Describe the solution you'd like
I'd like to be able to use platform prefixes like linux:, macos:, windows: with build args such that they are then only applied and used if the current build platform matches the prefix.
Example:
<buildArgs>
<buildArg>linux:--gc=G1</buildArg> <!-- only use on linux-->
<buildArg>linux:-R:MaxGCPauseMillis=50</buildArg> <!-- only use on linux-->
<buildArg>-R:MaxHeapSize=400m</buildArg>
<buildArg>--emit build-report</buildArg>
<buildArg>--no-fallback</buildArg>
<buildArg>-march=compatibility</buildArg>
<buildArg>--allow-incomplete-classpath</buildArg>
<buildArg>--static-nolibc</buildArg>
</buildArgs>
Describe alternatives you've considered
The current maven approach is to use maven profiles like:
<profile>
<id>mac</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<!-- specify the buildArgs for mac -->... which has the 2 issues of being verbose and introducing a decent amount of copy n paste.
Another approach would involve changing the xml schema in order to group build args by platform
like the linuxBuildArgs element below:
<configuration>
<linuxBuildArgs>
<buildArg>--gc=G1</buildArg>
<buildArg>-R:MaxGCPauseMillis=50</buildArg>
</linuxBuildArgs>
<buildArgs>
<buildArg>-R:MaxHeapSize=400m</buildArg>
<buildArg>--emit build-report</buildArg>
<buildArg>--no-fallback</buildArg>
<buildArg>-march=compatibility</buildArg>
<buildArg>--allow-incomplete-classpath</buildArg>
<buildArg>--static-nolibc</buildArg>
</buildArgs>
</configuration>Additional context
Often we have the situation where we have developers building locally (using say macos)
and a CICD build pipeline on linux.
We want the local developer build on macos to work and we are mostly just looking to
filter out the [linux] platform specific args.