Skip to content

Commit

Permalink
re-enable native builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoayyed committed Dec 19, 2023
1 parent e1ed6ab commit 1d415de
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
26 changes: 15 additions & 11 deletions app/src/main/resources/common/gradle/build.gradle.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,6 @@ bootBuildImage {
{{/dockerSupported}}

{{#nativeImageSupported}}
configurations {
nativeImageClasspath.extendsFrom(graalImplementation)
}

if (nativeImage) {
sourceSets {
graal {
Expand All @@ -203,6 +199,10 @@ if (nativeImage) {
}
}

configurations {
nativeImageClasspath.extendsFrom(graalImplementation)
}

graalvmNative {
metadataRepository {
enabled = true
Expand Down Expand Up @@ -231,23 +231,27 @@ graalvmNative {
buildArgs.add('-H:+TraceSecurityServices')
buildArgs.add('-H:+UnlockExperimentalVMOptions')
buildArgs.add('--trace-class-initialization=true')
buildArgs.add('-J-Xmx12G')
buildArgs.add('-J-Xms4G')
buildArgs.add('--native-image-info')
buildArgs.add('-march=native')
buildArgs.add('--initialize-at-build-time=org.hibernate.internal.util.ReflectHelper')
buildArgs.add('--trace-class-initialization=true')
buildArgs.add('--initialize-at-build-time=java.beans.Introspector')
buildArgs.add('--initialize-at-build-time=java.beans')
buildArgs.add('--initialize-at-build-time=com.sun.beans')
buildArgs.add('--initialize-at-build-time=groovyjarjarantlr4.v4.runtime')
buildArgs.add('--initialize-at-build-time=org.codehaus.groovy')
buildArgs.add('--initialize-at-build-time=org.apache.groovy')
buildArgs.add('--initialize-at-build-time=groovy.lang')
buildArgs.add('--initialize-at-run-time=com.sun.xml.ws,org.codehaus.groovy.control.XStreamUtils,org.codehaus.groovy.vmplugin.v8.Java8\$LookupHolder,groovy.grape.GrapeIvy')
buildArgs.add("--initialize-at-run-time=org.bouncycastle.jcajce.provider.drbg.DRBG\$Default,org.bouncycastle.jcajce.provider.drbg.DRBG\$NonceAndIV")
buildArgs.add('--initialize-at-run-time=com.sun.xml.ws')
buildArgs.add('--initialize-at-run-time=groovy.grape.GrapeIvy')
buildArgs.add("--initialize-at-run-time=org.bouncycastle.jcajce.provider.drbg.DRBG\$Default")
buildArgs.add("--initialize-at-run-time=org.bouncycastle.jcajce.provider.drbg.DRBG\$NonceAndIV")
buildArgs.add('--features=org.apereo.cas.nativex.features.DefaultNativeImageFeature')
buildArgs.add('--enable-url-protocols=jar')
buildArgs.add('--enable-url-protocols=jar,file,resource,http,https')
/*
buildArgs.add("-g")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@ bootRun {
def nativeImage = project.hasProperty("nativeImage") && Boolean.valueOf(project.getProperty("nativeImage"))
{{/nativeImageSupported}}
springBoot {
buildInfo()
{{#casServer}}
{{#nativeImageSupported}}
if (nativeImage) {
{{mainClass}} = "org.apereo.cas.nativex.CasNativeWebApplication"
} else {
{{mainClass}} = "org.apereo.cas.web.CasWebApplication"
buildInfo()
bootBuildInfo.mustRunAfter(compileJava)
}
{{/nativeImageSupported}}
{{^nativeImageSupported}}{{mainClass}} = "org.apereo.cas.web.CasWebApplication"{{/nativeImageSupported}}
Expand Down Expand Up @@ -163,5 +164,3 @@ if (!nativeImage) {
{{#nativeImageSupported}}
}
{{/nativeImageSupported}}

bootBuildInfo.mustRunAfter(compileJava)
2 changes: 1 addition & 1 deletion ci/validate-cas-native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if [[ -d /tmp ]] ; then
fi

printgreen "Building CAS Native Image. This may take several minutes..."
./gradlew clean build nativeCompile -PnativeImage=true --warning-mode all --no-daemon
./gradlew clean build nativeCompile -PnativeImage=true --warning-mode all --no-daemon --no-configuration-cache

if [[ $? -ne 0 ]]; then
printred "CAS native image build failed"
Expand Down

0 comments on commit 1d415de

Please sign in to comment.