Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable std-database in native image #12068

Merged
merged 19 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -1920,7 +1920,8 @@ lazy val `ydoc-polyfill` = project
"com.github.sbt" % "junit-interface" % junitIfVersion % Test
),
libraryDependencies ++= {
GraalVM.modules ++ GraalVM.jsPkgs ++ GraalVM.chromeInspectorPkgs ++ helidon
GraalVM.modules ++ GraalVM.jsPkgs
.map(_ % "provided") ++ GraalVM.chromeInspectorPkgs ++ helidon
}
)
.dependsOn(`syntax-rust-definition`)
Expand Down Expand Up @@ -3707,7 +3708,8 @@ lazy val `engine-runner` = project
val stdLibsJars =
`base-polyglot-root`.listFiles("*.jar").map(_.getAbsolutePath()) ++
`image-polyglot-root`.listFiles("*.jar").map(_.getAbsolutePath()) ++
`table-polyglot-root`.listFiles("*.jar").map(_.getAbsolutePath())
`table-polyglot-root`.listFiles("*.jar").map(_.getAbsolutePath()) ++
`database-polyglot-root`.listFiles("*.jar").map(_.getAbsolutePath())
core ++ stdLibsJars
},
buildSmallJdk := {
Expand All @@ -3718,7 +3720,7 @@ lazy val `engine-runner` = project
val NI_MODULES =
"org.graalvm.nativeimage,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.base,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.librarysupport,org.graalvm.nativeimage.objectfile,org.graalvm.nativeimage.pointsto,com.oracle.graal.graal_enterprise,com.oracle.svm.svm_enterprise"
val JDK_MODULES =
"jdk.localedata,jdk.httpserver,java.naming,java.net.http"
"jdk.localedata,jdk.httpserver,java.naming,java.net.http,java.desktop"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including java.desktop is undesirable. What can we do to remove it?

  • Use quarkus version?
  • Replace java.awt.Color usage with a substitution?
  • Report a bug for later?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer the last option. Configuration is rather fragile and it is easier to improve it incrementally than push it in one go.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go on, get this in. Otherwise we need to deal #12073 (comment) forever. Once this change is in, we can polish it more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quarkus-poi doesn't work out-of-the-box. It seems it relies on the fact that one builds it for redhat base image:
https://github.com/quarkiverse/quarkus-poi?tab=readme-ov-file#docker

val DEBUG_MODULES = "jdk.jdwp.agent"
val PYTHON_MODULES = "jdk.security.auth,java.naming"

Expand Down Expand Up @@ -3781,6 +3783,12 @@ lazy val `engine-runner` = project
"enso",
targetDir = engineDistributionRoot.value / "bin",
staticOnLinux = false,
// sqlite-jdbc includes `--enable-url-protocols=jar` in its native-image.properites file,
// which breaks all our class loading. We still want to run `SqliteJdbcFeature` which extracts a proper
// native library from the jar.
excludeConfigs = Seq(
s".*sqlite-jdbc-.*\\.jar,META-INF/native-image/org\\.xerial/sqlite-jdbc/native-image\\.properties"
),
additionalOptions = Seq(
"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog",
"-H:IncludeResources=.*Main.enso$",
Expand All @@ -3792,8 +3800,11 @@ lazy val `engine-runner` = project
// "-H:-DeleteLocalSymbols",
// you may need to set smallJdk := None to use following flags:
// "--trace-class-initialization=org.enso.syntax2.Parser",
// "--diagnostics-mode",
// "--verbose",
"-Dnic=nic",
"-Dorg.enso.feature.native.lib.output=" + (engineDistributionRoot.value / "bin")
"-Dorg.enso.feature.native.lib.output=" + (engineDistributionRoot.value / "bin"),
"-Dorg.sqlite.lib.exportPath=" + (engineDistributionRoot.value / "bin")
),
mainClass = Some("org.enso.runner.Main"),
initializeAtRuntime = Seq(
Expand All @@ -3815,6 +3826,7 @@ lazy val `engine-runner` = project
"org.enso.base",
"org.enso.image",
"org.enso.table",
"org.enso.database",
"org.eclipse.jgit"
)
)
Expand Down Expand Up @@ -4724,7 +4736,8 @@ lazy val `std-table` = project
"org.apache.poi" % "poi-ooxml" % poiOoxmlVersion,
"org.apache.xmlbeans" % "xmlbeans" % xmlbeansVersion,
"org.antlr" % "antlr4-runtime" % antlrVersion,
"org.apache.logging.log4j" % "log4j-to-slf4j" % "2.18.0" // org.apache.poi uses log4j
"org.apache.logging.log4j" % "log4j" % "2.24.3",
"org.apache.logging.log4j" % "log4j-to-slf4j" % "2.24.3" // org.apache.poi uses log4j
),
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
Expand Down
8 changes: 7 additions & 1 deletion build_tools/build/src/engine/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,12 @@ pub async fn runner_sanity_test(
.run_ok()
.await;

let test_table = Command::new(&enso)
.args(["--run", repo_root.test.join("Table_Tests").as_str()])
.set_env(ENSO_DATA_DIRECTORY, engine_package)?
.run_ok()
.await;

let test_geo = Command::new(&enso)
.args(["--run", repo_root.test.join("Geo_Tests").as_str()])
.set_env(ENSO_DATA_DIRECTORY, engine_package)?
Expand All @@ -708,7 +714,7 @@ pub async fn runner_sanity_test(
.run_ok()
.await;

let all_cmds = test_base.and(test_internal_base).and(test_geo).and(test_image);
let all_cmds = test_base.and(test_internal_base).and(test_table).and(test_geo).and(test_image);

// The following test does not actually run anything, it just checks if the engine
// can accept `--jvm` argument and evaluates something.
Expand Down
2 changes: 1 addition & 1 deletion distribution/engine/THIRD-PARTY/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ Copyright notices related to this dependency can be found in the directory `org.

'slf4j-api', licensed under the MIT License, is distributed with the engine.
The license file can be found at `licenses/MIT`.
Copyright notices related to this dependency can be found in the directory `org.slf4j.slf4j-api-2.0.9`.
Copyright notices related to this dependency can be found in the directory `org.slf4j.slf4j-api-2.0.16`.


'cats-core_2.13', licensed under the MIT, is distributed with the engine.
Expand Down
32 changes: 32 additions & 0 deletions distribution/engine/THIRD-PARTY/org.slf4j.slf4j-api-2.0.16/NOTICES
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright (c) 2004-2011 QOS.ch
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/

Copyright (c) 2004-2019 QOS.ch

Copyright (c) 2004-2021 QOS.ch

Copyright (c) 2004-2022 QOS.ch

Copyright (c) 2004-2024 QOS.ch
2 changes: 1 addition & 1 deletion distribution/launcher/THIRD-PARTY/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Copyright notices related to this dependency can be found in the directory `org.

'slf4j-api', licensed under the MIT License, is distributed with the launcher.
The license file can be found at `licenses/MIT`.
Copyright notices related to this dependency can be found in the directory `org.slf4j.slf4j-api-2.0.9`.
Copyright notices related to this dependency can be found in the directory `org.slf4j.slf4j-api-2.0.16`.


'cats-core_2.13', licensed under the MIT, is distributed with the launcher.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ Copyright (c) 2004-2019 QOS.ch
Copyright (c) 2004-2021 QOS.ch

Copyright (c) 2004-2022 QOS.ch

Copyright (c) 2004-2024 QOS.ch
17 changes: 11 additions & 6 deletions distribution/lib/Standard/Table/0.0.0-dev/THIRD-PARTY/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,19 @@ The license information can be found along with the copyright notices.
Copyright notices related to this dependency can be found in the directory `org.apache.commons.commons-math3-3.6.1`.


'log4j-api', licensed under the Apache License, Version 2.0, is distributed with the Table.
The license information can be found along with the copyright notices.
Copyright notices related to this dependency can be found in the directory `org.apache.logging.log4j.log4j-api-2.18.0`.
'log4j', licensed under the Apache-2.0, is distributed with the Table.
The license file can be found at `licenses/APACHE2.0`.
Copyright notices related to this dependency can be found in the directory `org.apache.logging.log4j.log4j-2.24.3`.


'log4j-api', licensed under the Apache-2.0, is distributed with the Table.
The license file can be found at `licenses/APACHE2.0`.
Copyright notices related to this dependency can be found in the directory `org.apache.logging.log4j.log4j-api-2.24.3`.


'log4j-to-slf4j', licensed under the Apache License, Version 2.0, is distributed with the Table.
'log4j-to-slf4j', licensed under the Apache-2.0, is distributed with the Table.
The license file can be found at `licenses/APACHE2.0`.
Copyright notices related to this dependency can be found in the directory `org.apache.logging.log4j.log4j-to-slf4j-2.18.0`.
Copyright notices related to this dependency can be found in the directory `org.apache.logging.log4j.log4j-to-slf4j-2.24.3`.


'poi', licensed under the Apache License, Version 2.0, is distributed with the Table.
Expand All @@ -78,5 +83,5 @@ Copyright notices related to this dependency can be found in the directory `org.

'slf4j-api', licensed under the MIT License, is distributed with the Table.
The license file can be found at `licenses/MIT`.
Copyright notices related to this dependency can be found in the directory `org.slf4j.slf4j-api-1.7.36`.
Copyright notices related to this dependency can be found in the directory `org.slf4j.slf4j-api-2.0.16`.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright 2003-2022 The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (https://www.apache.org/).

This product contains parts that were originally based on software from BEA.
Copyright (c) 2000-2003, BEA Systems, <http://www.bea.com/> (dead link),
which was acquired by Oracle Corporation in 2008.
<http://www.oracle.com/us/corporate/Acquisitions/bea/index.html>
<https://en.wikipedia.org/wiki/BEA_Systems>
Note: The ASF Secretary has on hand a Software Grant Agreement (SGA) from
BEA Systems, Inc. dated 9 Sep 2003 for XMLBeans signed by their EVP/CFO.

This product contains W3C XML Schema documents. Copyright 2001-2003 (c)
World Wide Web Consortium (Massachusetts Institute of Technology, European
Research Consortium for Informatics and Mathematics, Keio University)

This product contains the chunks_parse_cmds.tbl file from the vsdump program.
Copyright (C) 2006-2007 Valek Filippov ([email protected])

This product contains parts of the eID Applet project
<http://eid-applet.googlecode.com> and <https://github.com/e-Contract/eid-applet>.
Copyright (c) 2009-2018
FedICT (federal ICT department of Belgium), e-Contract.be BVBA (https://www.e-contract.be),
Bart Hanssens from FedICT

Loading
Loading