Skip to content

Commit 9bd972b

Browse files
committed
fix: native compilation in cli, embedded
- fix: native compilation of `cli` entrypoint - fix: errant logging for main entrypoints - fix: native optimized compilation of `embedded` module - fix: ability to build against GraalVM CE - fix: only apply wasm flags if language is supported - fix: double `detekt` call in ci jobs - fix: re-enable wasm tests in ci Signed-off-by: Sam Gammon <sam@elide.ventures>
1 parent 2d5480f commit 9bd972b

File tree

17 files changed

+214
-250
lines changed

17 files changed

+214
-250
lines changed

.github/workflows/args.test.txt

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ koverXmlReport
44
koverBinaryReport
55
koverVerify
66
copyCoverageReports
7-
-x wasmJsTest
8-
-x wasmWasiTest
9-
-x wasmWasiNodeTest
107
-x detekt
118
--scan
129
--build-cache

.github/workflows/job.test.yml

+1-9
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,7 @@ jobs:
273273
koverXmlReport
274274
koverBinaryReport
275275
koverVerify
276-
-x wasmJsTest
277-
-x wasmWasiTest
278-
-x wasmWasiNodeTest
279-
-x detekt
276+
detekt
280277
--scan
281278
--build-cache
282279
--no-daemon
@@ -309,12 +306,7 @@ jobs:
309306
wrapper
310307
yarn
311308
arguments: |
312-
detekt
313309
sonar
314-
-x wasmJsTest
315-
-x wasmWasiTest
316-
-x wasmWasiNodeTest
317-
-x detekt
318310
--scan
319311
--build-cache
320312
--no-daemon

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ elide.pluginMode = inert
3737
elide.stamp = false
3838
elide.atomicFu = true
3939
elide.lockDeps = false
40-
elide.graalvm.variant = ENTERPRISE
40+
elide.graalvm.variant = COMMUNITY
4141
elide.vm.inspect = false
4242
elide.kotlin.k2 = true
4343
publishMainHostLock = false

gradle/elide.versions.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -835,4 +835,6 @@ graalvm-python = ["graalvm-polyglot-python", "graalvm-python-resources"]
835835

836836
graalvm-ruby = ["graalvm-ruby-annotations", "graalvm-ruby-language", "graalvm-ruby-resources"]
837837

838-
graalvm-js = ["graalvm-js-isolate", "graalvm-js-language", "graalvm-polyglot-js", "graalvm-polyglot-js-isolate"]
838+
graalvm-js = ["graalvm-js-language", "graalvm-polyglot-js"]
839+
840+
graalvm-js-isolate = ["graalvm-js-isolate", "graalvm-polyglot-js-isolate"]

packages/cli/build.gradle.kts

+36-72
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,20 @@ val isRelease = !quickbuild && (
9494

9595
val entrypoint = "elide.tool.cli.ElideTool"
9696

97-
val oracleGvm = true
97+
val oracleGvm = false
9898
val enableEdge = true
9999
val enableWasm = true
100-
val enablePython = true
101-
val enableRuby = true
102-
val enableTools = true
100+
val enablePython = false
101+
val enableRuby = false
102+
val enableTools = false
103103
val enableMosaic = true
104104
val enableProguard = false
105105
val enableLlvm = false
106-
val enableEspresso = true
106+
val enableEspresso = false
107107
val enableExperimental = false
108108
val enableEmbeddedResources = false
109-
val enableResourceFilter = true
110-
val enableAuxCache = true
109+
val enableResourceFilter = false
110+
val enableAuxCache = false
111111
val enableJpms = false
112112
val enableEmbeddedBuilder = false
113113
val enableDashboard = false
@@ -122,7 +122,6 @@ val enableSbomStrict = false
122122
val enableTruffleJson = enableEdge
123123
val encloseSdk = !System.getProperty("java.vm.version").contains("jvmci")
124124
val globalExclusions = emptyList<Pair<String, String>>()
125-
126125
val moduleExclusions = listOf(
127126
"io.micronaut" to "micronaut-core-processor",
128127
)
@@ -147,6 +146,7 @@ buildscript {
147146
}
148147

149148
// @TODO(sgammon): mosaic is broken on kotlin v2
149+
150150
if (enableMosaic) apply(plugin = "com.jakewharton.mosaic")
151151

152152
val nativesRootTemplate: (String) -> String = { version ->
@@ -219,19 +219,6 @@ java {
219219
if (enableJpms) modularity.inferModulePath = true
220220
}
221221

222-
//ktlint {
223-
// debug = false
224-
// verbose = false
225-
// android = false
226-
// outputToConsole = false
227-
// ignoreFailures = true
228-
// enableExperimentalRules = true
229-
//
230-
// filter {
231-
// exclude("elide/tool/cli/ToolTypealiases.kt")
232-
// }
233-
//}
234-
235222
kapt {
236223
useBuildCache = true
237224
includeCompileClasspath = false
@@ -242,7 +229,7 @@ kapt {
242229
kotlin {
243230
target.compilations.all {
244231
kotlinOptions {
245-
allWarningsAsErrors = true
232+
allWarningsAsErrors = false
246233
freeCompilerArgs = freeCompilerArgs.plus(ktCompilerArgs).toSortedSet().toList()
247234

248235
// @TODO(sgammon): v2.0 support in this package (currently breaks mosaic)
@@ -291,6 +278,10 @@ val classpathExtras: Configuration by configurations.creating {
291278
dependencies {
292279
implementation(platform(libs.netty.bom))
293280

281+
// Fix: Missing Types
282+
implementation(libs.jetty.npn)
283+
implementation(libs.jetty.alpn)
284+
294285
kapt(mn.micronaut.inject.java)
295286
kapt(libs.picocli.codegen)
296287
classpathExtras(mn.micronaut.core.processor)
@@ -351,6 +342,7 @@ dependencies {
351342
implementation(libs.jline.console)
352343
implementation(libs.jline.terminal.core)
353344
implementation(libs.jline.terminal.jansi)
345+
implementation(libs.jline.terminal.jna)
354346
implementation(libs.jline.builtins)
355347
implementation(libs.jline.graal) {
356348
exclude(group = "org.slf4j", module = "slf4j-jdk14")
@@ -443,17 +435,7 @@ dependencies {
443435

444436
api(libs.graalvm.polyglot)
445437
api(libs.graalvm.js.language)
446-
api(libs.bundles.graalvm.tools)
447-
api(libs.graalvm.regex)
448-
compileOnly(libs.graalvm.svm)
449-
450-
if (enableEspresso) {
451-
api(libs.bundles.graalvm.espresso)
452-
}
453-
454-
api(libs.graalvm.truffle.nfi)
455-
api(libs.graalvm.truffle.nfi.libffi)
456-
// api(libs.graalvm.truffle.nfi.panama)
438+
api(libs.graalvm.truffle.api)
457439
runtimeOnly(mn.micronaut.runtime)
458440

459441
testImplementation(kotlin("test"))
@@ -646,10 +628,12 @@ tasks.withType(Test::class).configureEach {
646628
* Build: CLI Native Image
647629
*/
648630

649-
val commonGvmArgs = listOf(
650-
"-H:+UseCompressedReferences",
631+
val commonGvmArgs = listOfNotNull(
632+
if (!oracleGvm) null else "-H:+UseCompressedReferences",
651633
).plus(if (enableBuildReport) listOf("-H:+BuildReport") else emptyList())
652634

635+
val nativeImageBuildDebug = properties["nativeImageBuildDebug"] == "true"
636+
653637
val commonNativeArgs = listOfNotNull(
654638
"--no-fallback",
655639
"--enable-preview",
@@ -665,7 +649,6 @@ val commonNativeArgs = listOfNotNull(
665649
"-H:+AddAllCharsets",
666650
"-H:DeadlockWatchdogInterval=15",
667651
"-H:CLibraryPath=$nativesPath",
668-
"--trace-object-instantiation=java.nio.DirectByteBuffer",
669652
if (enableEspresso) "-H:+AllowJRTFileSystem" else null,
670653
if (enableEspresso) "-J-Djdk.image.use.jvm.map=false" else null,
671654
if (enableEspresso) "-J-Despresso.finalization.UnsafeOverride=true" else null,
@@ -686,6 +669,8 @@ val commonNativeArgs = listOfNotNull(
686669
if (oracleGvm) commonGvmArgs else emptyList()
687670
).plus(if (enableStrictHeap) listOf(
688671
"--strict-image-heap",
672+
) else emptyList()).plus(if (nativeImageBuildDebug) listOf(
673+
"--debug-attach",
689674
) else emptyList()).toList()
690675

691676
val dashboardFlags: List<String> = listOf(
@@ -772,7 +757,7 @@ val releaseFlags: List<String> = listOf(
772757
"--pgo=${profiles.joinToString(",")}",
773758
"-H:CodeSectionLayoutOptimization=ClusterByEdges",
774759
) else emptyList()).plus(listOf(
775-
if (enableSbom) listOf(
760+
if (oracleGvm && enableSbom) listOf(
776761
if (enableSbomStrict) "--enable-sbom=cyclonedx,export,strict" else "--enable-sbom=cyclonedx,export"
777762
) else emptyList(),
778763
if (enableDashboard) dashboardFlags else emptyList(),
@@ -870,37 +855,12 @@ val initializeAtBuildTime = listOf(
870855
"com.google.common.collect.MapMakerInternalMap${'$'}1",
871856
"com.google.common.base.Equivalence${'$'}Equals",
872857

873-
// SLF4J + Logback
874-
"ch.qos.logback",
875-
"org.slf4j.MarkerFactory",
876-
"org.slf4j.simple.SimpleLogger",
877-
"org.slf4j.impl.StaticLoggerBinder",
878-
879-
// Encodings, Parsers, Cryptography
880-
"com.sun.tools.doclint",
881-
"org.codehaus.stax2.typed.Base64Variants",
882-
"org.bouncycastle.util.Properties",
883-
"org.bouncycastle.util.Strings",
884-
"org.bouncycastle.crypto.macs.HMac",
885-
"org.bouncycastle.crypto.prng.drbg.Utils",
886-
"org.bouncycastle.jcajce.provider.drbg.DRBG",
887-
"org.bouncycastle.jcajce.provider.drbg.EntropyDaemon",
888-
"org.xml.sax.helpers.LocatorImpl",
889-
"org.xml.sax.helpers.AttributesImpl",
890-
"jdk.jshell.Snippet${'$'}SubKind",
891-
"com.sun.tools.javac.parser.Tokens${'$'}TokenKind",
892-
893858
// Databasing
894859
"org.sqlite.util.ProcessRunner",
895860

896-
// Micronaut
897-
"io.micronaut.http.util.HttpTypeInformationProvider",
898-
"io.micronaut.inject.provider.ProviderTypeInformationProvider",
899-
"io.micronaut.core.async.ReactiveStreamsTypeInformationProvider",
900-
"io.micronaut.inject.beans.visitor.MapperAnnotationMapper",
901-
"io.micronaut.inject.beans.visitor.JsonCreatorAnnotationMapper",
902-
"io.micronaut.inject.beans.visitor.IntrospectedToBeanPropertiesTransformer",
903-
"io.micronaut.inject.beans.visitor.persistence.JakartaMappedSuperClassIntrospectionMapper",
861+
// Logging
862+
"ch.qos.logback",
863+
"org.slf4j.MarkerFactory",
904864

905865
// --- Netty ------
906866

@@ -1100,10 +1060,13 @@ val defaultPlatformArgs = listOf(
11001060
val windowsOnlyArgs = defaultPlatformArgs.plus(listOf(
11011061
"-march=native",
11021062
"--gc=serial",
1103-
"-Delide.vm.engine.preinitialize=true",
11041063
"-H:InitialCollectionPolicy=Adaptive",
11051064
"-R:MaximumHeapSizePercent=80",
1106-
).plus(if (project.properties["elide.ci"] == "true") listOf(
1065+
).plus(if (oracleGvm) listOf(
1066+
"-Delide.vm.engine.preinitialize=true",
1067+
) else listOf(
1068+
"-Delide.vm.engine.preinitialize=false",
1069+
)).plus(if (project.properties["elide.ci"] == "true") listOf(
11071070
"-J-Xmx12g",
11081071
) else emptyList())).plus(if (oracleGvm && enableAuxCache) listOf(
11091072
"-H:-AuxiliaryEngineCache",
@@ -1112,10 +1075,13 @@ val windowsOnlyArgs = defaultPlatformArgs.plus(listOf(
11121075
val darwinOnlyArgs = defaultPlatformArgs.plus(listOf(
11131076
"-march=native",
11141077
"--gc=serial",
1115-
"-Delide.vm.engine.preinitialize=true",
11161078
"-H:InitialCollectionPolicy=Adaptive",
11171079
"-R:MaximumHeapSizePercent=80",
1118-
).plus(if (project.properties["elide.ci"] == "true") listOf(
1080+
).plus(if (oracleGvm) listOf(
1081+
"-Delide.vm.engine.preinitialize=true",
1082+
) else listOf(
1083+
"-Delide.vm.engine.preinitialize=false",
1084+
)).plus(if (project.properties["elide.ci"] == "true") listOf(
11191085
"-J-Xmx12g",
11201086
) else listOf(
11211087
"-J-Xmx24g",
@@ -1162,11 +1128,11 @@ val linuxOnlyArgs = defaultPlatformArgs.plus(
11621128
"-Delide.vm.engine.preinitialize=false",
11631129
) else listOf(
11641130
"--gc=serial",
1165-
"-Delide.vm.engine.preinitialize=true",
11661131
"-R:MaximumHeapSizePercent=80",
11671132
"-H:InitialCollectionPolicy=Adaptive",
11681133
).plus(if (oracleGvm && enableAuxCache) listOf(
11691134
"-H:+AuxiliaryEngineCache",
1135+
"-Delide.vm.engine.preinitialize=true",
11701136
) else emptyList())
11711137
).plus(if (project.properties["elide.ci"] == "true") listOf(
11721138
"-J-Xmx12g",
@@ -1191,8 +1157,6 @@ val muslArgs = listOf(
11911157

11921158
val testOnlyArgs: List<String> = emptyList()
11931159

1194-
val isEnterprise: Boolean = properties["elide.graalvm.variant"] == "ENTERPRISE"
1195-
11961160
fun nativeCliImageArgs(
11971161
platform: String = "generic",
11981162
target: String = "glibc",

packages/cli/src/main/kotlin/elide/tool/cli/cmd/repl/ToolShellCommand.kt

+34-34
Original file line numberDiff line numberDiff line change
@@ -1546,40 +1546,40 @@ import elide.tool.project.ProjectManager
15461546
jsSettings.apply(this)
15471547
}
15481548

1549-
PYTHON -> install(elide.runtime.plugins.python.Python) {
1550-
logging.debug("Configuring Python VM")
1551-
installIntrinsics(intrinsics, GraalVMGuest.PYTHON, versionProp)
1552-
}
1553-
1554-
RUBY -> install(elide.runtime.plugins.ruby.Ruby) {
1555-
logging.debug("Configuring Ruby VM")
1556-
installIntrinsics(intrinsics, GraalVMGuest.RUBY, versionProp)
1557-
}
1558-
1559-
// Secondary Engines: JVM
1560-
JVM -> {
1561-
install(elide.runtime.plugins.jvm.Jvm) {
1562-
logging.debug("Configuring JVM")
1563-
multithreading = false
1564-
}
1565-
1566-
install(elide.runtime.plugins.java.Java) {
1567-
logging.debug("Configuring Java")
1568-
}
1569-
}
1570-
1571-
GROOVY -> logging.warn("Groovy runtime plugin is not yet implemented")
1572-
1573-
KOTLIN -> install(elide.runtime.plugins.kotlin.Kotlin) {
1574-
val classpathDir = workdir.cacheDirectory()
1575-
.resolve("elide-kotlin-runtime")
1576-
.absolutePath
1577-
1578-
logging.debug("Configuring Kotlin with classpath root $classpathDir")
1579-
guestClasspathRoot = classpathDir
1580-
}
1581-
1582-
SCALA -> logging.warn("Scala runtime plugin is not yet implemented")
1549+
// PYTHON -> install(elide.runtime.plugins.python.Python) {
1550+
// logging.debug("Configuring Python VM")
1551+
// installIntrinsics(intrinsics, GraalVMGuest.PYTHON, versionProp)
1552+
// }
1553+
1554+
// RUBY -> install(elide.runtime.plugins.ruby.Ruby) {
1555+
// logging.debug("Configuring Ruby VM")
1556+
// installIntrinsics(intrinsics, GraalVMGuest.RUBY, versionProp)
1557+
// }
1558+
1559+
// // Secondary Engines: JVM
1560+
// JVM -> {
1561+
// install(elide.runtime.plugins.jvm.Jvm) {
1562+
// logging.debug("Configuring JVM")
1563+
// multithreading = false
1564+
// }
1565+
//
1566+
// install(elide.runtime.plugins.java.Java) {
1567+
// logging.debug("Configuring Java")
1568+
// }
1569+
// }
1570+
//
1571+
// GROOVY -> logging.warn("Groovy runtime plugin is not yet implemented")
1572+
//
1573+
// KOTLIN -> install(elide.runtime.plugins.kotlin.Kotlin) {
1574+
// val classpathDir = workdir.cacheDirectory()
1575+
// .resolve("elide-kotlin-runtime")
1576+
// .absolutePath
1577+
//
1578+
// logging.debug("Configuring Kotlin with classpath root $classpathDir")
1579+
// guestClasspathRoot = classpathDir
1580+
// }
1581+
//
1582+
// SCALA -> logging.warn("Scala runtime plugin is not yet implemented")
15831583
else -> {}
15841584
}
15851585
}
266 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)