You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "linghengqian (via GitHub)" <gi...@apache.org> on 2023/01/31 10:24:51 UTC
[GitHub] [shardingsphere] linghengqian opened a new pull request, #23873: Introduce Truffle Espresso to make GroovyShell available under GraalVM Native Image and update GraalVM Reachability Metadata Repository to 0.2.6
linghengqian opened a new pull request, #23873:
URL: https://github.com/apache/shardingsphere/pull/23873
For #21347 and #22899.
Changes proposed in this pull request:
- Introduce Truffle Espresso to make GroovyShell available under GraalVM Native Image
- Update GraalVM Reachability Metadata Repository to 0.2.6
---
Before committing this PR, I'm sure that I have checked the following options:
- [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
- [x] I have self-reviewed the commit code.
- [ ] I have (or in comment I request) added corresponding labels for the pull request.
- [x] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
- [x] I have made corresponding changes to the documentation.
- [x] I have added corresponding unit tests for my changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] linghengqian commented on a diff in pull request #23873: Introduce Truffle Espresso to make GroovyShell available under GraalVM Native Image and update GraalVM Reachability Metadata Repository to 0.2.6
Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian commented on code in PR #23873:
URL: https://github.com/apache/shardingsphere/pull/23873#discussion_r1091972762
##########
infra/util/src/main/java/org/apache/shardingsphere/infra/util/expr/EspressoInlineExpressionParser.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.util.expr;
+
+import groovy.lang.Closure;
+import org.graalvm.polyglot.Context;
+import org.graalvm.polyglot.Value;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Espresso Inline expression parser.
+ */
+public class EspressoInlineExpressionParser {
+
+ private static final Context POLYGLOT;
+
+ private final Value espressoInlineExpressionParser;
+
+ 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.jar");
+ POLYGLOT = Context.newBuilder().allowAllAccess(true)
+ .option("java.MultiThreaded", "true")
+ .option("java.Classpath", javaClasspath)
+ .build();
Review Comment:
- Since GroovyShell essentially starts a new thread, and MultiThreaded is disabled by default on Espresso, it makes sense to enable it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-commenter commented on pull request #23873: Introduce Truffle Espresso to make GroovyShell available under GraalVM Native Image and update GraalVM Reachability Metadata Repository to 0.2.6
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #23873:
URL: https://github.com/apache/shardingsphere/pull/23873#issuecomment-1410491493
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#23873](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6dc10da) into [master](https://codecov.io/gh/apache/shardingsphere/commit/3a1157e350ada5f37164a634c6f0f978150477ed?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3a1157e) will **decrease** coverage by `0.10%`.
> The diff coverage is `58.44%`.
> :exclamation: Current head 6dc10da differs from pull request most recent head 8b60d3b. Consider uploading reports for the commit 8b60d3b to get more accurate results
```diff
@@ Coverage Diff @@
## master #23873 +/- ##
============================================
- Coverage 50.22% 50.12% -0.10%
+ Complexity 1572 1571 -1
============================================
Files 3239 3247 +8
Lines 53456 53506 +50
Branches 9779 9802 +23
============================================
- Hits 26847 26820 -27
- Misses 24258 24324 +66
- Partials 2351 2362 +11
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...ore/advisor/config/AdvisorConfigurationLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvY29yZS9hZHZpc29yL2NvbmZpZy9BZHZpc29yQ29uZmlndXJhdGlvbkxvYWRlci5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...gsphere/agent/core/log/AgentLoggerClassLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvY29yZS9sb2cvQWdlbnRMb2dnZXJDbGFzc0xvYWRlci5qYXZh) | `50.00% <0.00%> (ø)` | |
| [...gsphere/agent/core/plugin/jar/PluginJarLoader.java](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvY29yZS9wbHVnaW4vamFyL1BsdWdpbkphckxvYWRlci5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...rdingsphere/agent/log/api/impl/NOPAgentLogger.java](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvbG9nL2xvZy1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2FnZW50L2xvZy9hcGkvaW1wbC9OT1BBZ2VudExvZ2dlci5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...ardingsphere/agent/log/slf4j/SLF4JAgentLogger.java](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvbG9nL2xvZy10by1zbGY0ai9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvbG9nL3NsZjRqL1NMRjRKQWdlbnRMb2dnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...phere/agent/log/slf4j/SLF4JAgentLoggerFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YWdlbnQvbG9nL2xvZy10by1zbGY0ai9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvbG9nL3NsZjRqL1NMRjRKQWdlbnRMb2dnZXJGYWN0b3J5LmphdmE=) | `0.00% <0.00%> (ø)` | |
| [...nfra/util/expr/EspressoInlineExpressionParser.java](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-aW5mcmEvdXRpbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvaW5mcmEvdXRpbC9leHByL0VzcHJlc3NvSW5saW5lRXhwcmVzc2lvblBhcnNlci5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...andler/distsql/ral/QueryableRALBackendHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJveHkvYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9oYW5kbGVyL2Rpc3RzcWwvcmFsL1F1ZXJ5YWJsZVJBTEJhY2tlbmRIYW5kbGVyLmphdmE=) | `0.00% <0.00%> (-90.91%)` | :arrow_down: |
| [.../handler/distsql/ral/RALBackendHandlerFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJveHkvYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9oYW5kbGVyL2Rpc3RzcWwvcmFsL1JBTEJhY2tlbmRIYW5kbGVyRmFjdG9yeS5qYXZh) | `72.09% <0.00%> (-4.66%)` | :arrow_down: |
| [.../ShowStatusFromReadwriteSplittingRulesHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHJveHkvYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9oYW5kbGVyL2Rpc3RzcWwvcmFsL3F1ZXJ5YWJsZS9TaG93U3RhdHVzRnJvbVJlYWR3cml0ZVNwbGl0dGluZ1J1bGVzSGFuZGxlci5qYXZh) | `0.00% <0.00%> (ø)` | |
| ... and [47 more](https://codecov.io/gh/apache/shardingsphere/pull/23873?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] linghengqian commented on a diff in pull request #23873: Introduce Truffle Espresso to make GroovyShell available under GraalVM Native Image and update GraalVM Reachability Metadata Repository to 0.2.6
Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian commented on code in PR #23873:
URL: https://github.com/apache/shardingsphere/pull/23873#discussion_r1091913781
##########
infra/util/src/main/java/org/apache/shardingsphere/infra/util/expr/EspressoInlineExpressionParser.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.util.expr;
+
+import groovy.lang.Closure;
+import org.apache.shardingsphere.infra.util.groovy.expr.HotspotInlineExpressionParser;
+import org.graalvm.polyglot.Context;
+import org.graalvm.polyglot.Value;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Espresso Inline expression parser.
+ */
+public class EspressoInlineExpressionParser {
+
+ private static final Context POLYGLOT;
+
+ private final Value espressoInlineExpressionParser;
+
+ 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();
+ }
Review Comment:
- 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] linghengqian commented on a diff in pull request #23873: Introduce Truffle Espresso to make GroovyShell available under GraalVM Native Image and update GraalVM Reachability Metadata Repository to 0.2.6
Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian commented on code in PR #23873:
URL: https://github.com/apache/shardingsphere/pull/23873#discussion_r1091977940
##########
pom.xml:
##########
@@ -1063,6 +1076,9 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
+ <configuration>
+ <excludes>**/*.jar</excludes>
+ </configuration>
Review Comment:
- This is to solve the problem https://github.com/apache/shardingsphere/actions/runs/4054751320/jobs/6976968248 encountered. Jacoco actively scans JARs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] linghengqian commented on a diff in pull request #23873: Introduce Truffle Espresso to make GroovyShell available under GraalVM Native Image and update GraalVM Reachability Metadata Repository to 0.2.6
Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian commented on code in PR #23873:
URL: https://github.com/apache/shardingsphere/pull/23873#discussion_r1091862118
##########
infra/util/pom.xml:
##########
@@ -33,14 +33,66 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-util-groovy</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.groovy</groupId>
- <artifactId>groovy</artifactId>
+ <groupId>org.graalvm.truffle</groupId>
+ <artifactId>truffle-api</artifactId>
</dependency>
</dependencies>
+
+ <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>
Review Comment:
- Logically, we need to advance the Maven life cycle that executes `copy` to `process-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 of `copy` gets the corresponding JAR.
- Is there any way for Maven to solve this kind of problem without stepping in the CI file?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] linghengqian commented on a diff in pull request #23873: Introduce Truffle Espresso to make GroovyShell available under GraalVM Native Image and update GraalVM Reachability Metadata Repository to 0.2.6
Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian commented on code in PR #23873:
URL: https://github.com/apache/shardingsphere/pull/23873#discussion_r1091896706
##########
infra/util/pom.xml:
##########
@@ -33,14 +33,66 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-util-groovy</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.groovy</groupId>
- <artifactId>groovy</artifactId>
+ <groupId>org.graalvm.truffle</groupId>
+ <artifactId>truffle-api</artifactId>
</dependency>
</dependencies>
+
+ <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>
Review Comment:
- 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] linghengqian commented on a diff in pull request #23873: Introduce Truffle Espresso to make GroovyShell available under GraalVM Native Image and update GraalVM Reachability Metadata Repository to 0.2.6
Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian commented on code in PR #23873:
URL: https://github.com/apache/shardingsphere/pull/23873#discussion_r1091913781
##########
infra/util/src/main/java/org/apache/shardingsphere/infra/util/expr/EspressoInlineExpressionParser.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.util.expr;
+
+import groovy.lang.Closure;
+import org.apache.shardingsphere.infra.util.groovy.expr.HotspotInlineExpressionParser;
+import org.graalvm.polyglot.Context;
+import org.graalvm.polyglot.Value;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Espresso Inline expression parser.
+ */
+public class EspressoInlineExpressionParser {
+
+ private static final Context POLYGLOT;
+
+ private final Value espressoInlineExpressionParser;
+
+ 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();
+ }
Review Comment:
- This class is difficult to set up tests because Espresso is not available outside of GraalVM, it is not standalone.
- But if necessary, I can add a CI to complete the test under GraalVM CE.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] terrymanu merged pull request #23873: Introduce Truffle Espresso to make GroovyShell available under GraalVM Native Image
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu merged PR #23873:
URL: https://github.com/apache/shardingsphere/pull/23873
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] linghengqian commented on a diff in pull request #23873: Introduce Truffle Espresso to make GroovyShell available under GraalVM Native Image and update GraalVM Reachability Metadata Repository to 0.2.6
Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian commented on code in PR #23873:
URL: https://github.com/apache/shardingsphere/pull/23873#discussion_r1091963256
##########
infra/util/pom.xml:
##########
@@ -60,16 +60,16 @@
<goals>
<goal>copy</goal>
</goals>
- <phase>package</phase>
+ <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>
Review Comment:
- This is another processing idea that I pointed out at https://github.com/apache/shardingsphere/pull/23873#discussion_r1091862118 .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org