-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Introduce Truffle Espresso to make GroovyShell available under GraalVM Native Image #23873
Conversation
dd6d1c5
to
7863dd5
Compare
3181ba4
to
7783545
Compare
infra/util/pom.xml
Outdated
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy</id> | ||
<goals> | ||
<goal>copy</goal> | ||
</goals> | ||
<phase>package</phase> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Logically, we need to advance the Maven life cycle that executes
copy
toprocess-test-classes
, so that we can verify the unit tests of Truffle Espresso in the future nativeTest. -
But I'm not sure how to make
org.apache.shardingsphere:shardingsphere-infra-util-groovy:${project.version}
advance./mvnw clean install
so that the task ofcopy
gets the corresponding JAR. -
Is there any way for Maven to solve this kind of problem without stepping in the CI file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- If the answer to this question is no, considering that the classes that really need to be executed on the Espresso VM are no different on 5.3.1 and 5.3.2, I can use
shardingsphere infra-util:5.3.1
to provide the classpath required for espresso.
static { | ||
// https://github.com/oracle/graal/issues/4555 not yet closed | ||
String javaHome = System.getenv("GRAALVM_HOME"); | ||
if (javaHome == null) { | ||
javaHome = System.getenv("JAVA_HOME"); | ||
} | ||
if (javaHome == null) { | ||
throw new RuntimeException("Failed to determine the system's environment variable GRAALVM_HOME or JAVA_HOME!"); | ||
} | ||
System.setProperty("org.graalvm.home", javaHome); | ||
URL resource = Thread.currentThread().getContextClassLoader().getResource("espresso-need-libs"); | ||
assert null != resource; | ||
String dir = resource.getPath(); | ||
String javaClasspath = String.join(":", dir + "/groovy.jar", dir + "/guava.jar", dir + "/shardingsphere-infra-util-groovy.jar"); | ||
POLYGLOT = Context.newBuilder().allowAllAccess(true) | ||
.option("java.MultiThreaded", "true") | ||
.option("java.Classpath", javaClasspath) | ||
.build(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
This class is difficult to set up tests because Espresso is not available outside of GraalVM, it is not standalone like other Truffle implementations.
-
But if necessary, I can add a CI to complete the test under GraalVM CE.
7783545
to
7ee3e88
Compare
infra/util/pom.xml
Outdated
<phase>process-test-classes</phase> | ||
<configuration> | ||
<artifactItems> | ||
<artifactItem> | ||
<groupId>org.apache.shardingsphere</groupId> | ||
<artifactId>shardingsphere-infra-util-groovy</artifactId> | ||
<version>${project.version}</version> | ||
<artifactId>shardingsphere-infra-util</artifactId> | ||
<version>5.3.1</version> | ||
<type>jar</type> | ||
<overWrite>true</overWrite> | ||
<destFileName>shardingsphere-infra-util-groovy.jar</destFileName> | ||
<destFileName>shardingsphere-infra-util.jar</destFileName> | ||
</artifactItem> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This is another processing idea that I pointed out at Introduce Truffle Espresso to make GroovyShell available under GraalVM Native Image #23873 (comment) .
.../src/main/java/org/apache/shardingsphere/infra/util/expr/EspressoInlineExpressionParser.java
Show resolved
Hide resolved
7ee3e88
to
8b60d3b
Compare
Codecov Report
@@ Coverage Diff @@
## master #23873 +/- ##
============================================
- Coverage 50.19% 50.16% -0.03%
Complexity 1567 1567
============================================
Files 3247 3249 +2
Lines 53483 53534 +51
Branches 9800 9812 +12
============================================
+ Hits 26844 26857 +13
- Misses 24280 24312 +32
- Partials 2359 2365 +6
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
8b60d3b
to
9af249c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I checked https://github.com/apache/shardingsphere/actions/runs/4054863246/jobs/6977753161 and the CI timeout seems to be caused by other PRs.
1ec235c
to
8492c7e
Compare
892a612
to
106668d
Compare
…M Native Image and update GraalVM Reachability Metadata Repository to 0.2.6
106668d
to
d7b0e8e
Compare
For #21347 and #22899.
Changes proposed in this pull request:
Before committing this PR, I'm sure that I have checked the following options:
./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e
.