Skip to content
This repository was archived by the owner on May 22, 2024. It is now read-only.

Commit 109621d

Browse files
author
Jaroslav Tulach
committed
Execute the project on vanilla JDK8 (but slowly)
1 parent 8e1e8a2 commit 109621d

File tree

4 files changed

+89
-15
lines changed

4 files changed

+89
-15
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ install:
2121
tar -xzf graalvm.tar.gz
2222
2323
script:
24-
- java -version
2524
- mvn clean
2625
- mvn package
2726
- mvn exec:exec

pom.xml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,88 @@
149149
</plugins>
150150
</build>
151151
</profile>
152+
<profile>
153+
<id>jdk8</id>
154+
<activation>
155+
<jdk>1.8</jdk>
156+
<file>
157+
<missing>${java.home}/lib/truffle/truffle-api.jar</missing>
158+
</file>
159+
</activation>
160+
<dependencies>
161+
<dependency>
162+
<groupId>org.graalvm.sdk</groupId>
163+
<artifactId>graal-sdk</artifactId>
164+
<version>${graalvm.version}</version>
165+
<scope>compile</scope>
166+
</dependency>
167+
<dependency>
168+
<groupId>org.graalvm.js</groupId>
169+
<artifactId>js</artifactId>
170+
<version>${graalvm.version}</version>
171+
<scope>runtime</scope>
172+
</dependency>
173+
<dependency>
174+
<groupId>org.graalvm.js</groupId>
175+
<artifactId>js-scriptengine</artifactId>
176+
<version>${graalvm.version}</version>
177+
<scope>runtime</scope>
178+
</dependency>
179+
<dependency>
180+
<groupId>org.graalvm.tools</groupId>
181+
<artifactId>profiler</artifactId>
182+
<version>${graalvm.version}</version>
183+
<scope>runtime</scope>
184+
</dependency>
185+
<dependency>
186+
<groupId>org.graalvm.tools</groupId>
187+
<artifactId>chromeinspector</artifactId>
188+
<version>${graalvm.version}</version>
189+
<scope>runtime</scope>
190+
</dependency>
191+
</dependencies>
192+
<build>
193+
<plugins>
194+
<plugin>
195+
<groupId>org.codehaus.mojo</groupId>
196+
<artifactId>exec-maven-plugin</artifactId>
197+
<version>1.6.0</version>
198+
<executions>
199+
<execution>
200+
<id>default-cli</id>
201+
<goals>
202+
<goal>exec</goal>
203+
</goals>
204+
<configuration>
205+
<arguments>
206+
<argument>-classpath</argument>
207+
<classpath/>
208+
<argument>com.mycompany.app.App</argument>
209+
</arguments>
210+
</configuration>
211+
</execution>
212+
<execution>
213+
<id>nograal</id>
214+
<goals>
215+
<goal>exec</goal>
216+
</goals>
217+
<configuration>
218+
<arguments>
219+
<argument>-classpath</argument>
220+
<!-- automatically creates the classpath using all project dependencies, also adding the project build directory -->
221+
<classpath/>
222+
<argument>com.mycompany.app.App</argument>
223+
</arguments>
224+
</configuration>
225+
</execution>
226+
</executions>
227+
<configuration>
228+
<executable>${JAVA_HOME}/bin/java</executable>
229+
</configuration>
230+
</plugin>
231+
</plugins>
232+
</build>
233+
</profile>
152234
</profiles>
153235
<build>
154236
<plugins>

src/main/java/com/mycompany/app/App.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,7 @@ public class App {
7171
+ "}\n";
7272

7373
public static void main(String[] args) throws Exception {
74-
try {
75-
benchGraalPolyglotContext();
76-
} catch (LinkageError err) {
77-
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
78-
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
79-
System.out.println("!Download GraalVM.org or use JDK11!");
80-
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
81-
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
82-
System.exit(0);
83-
}
74+
benchGraalPolyglotContext();
8475
benchGraalScriptEngine();
8576
benchNashornScriptEngine();
8677
}

src/test/java/com/mycompany/app/AppTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.mycompany.app;
22

3-
import org.graalvm.polyglot.Context;
43
import static org.junit.Assert.fail;
54
import org.junit.Assume;
65
import org.junit.BeforeClass;
@@ -33,10 +32,13 @@ public void testGraalScriptEngineSpeed() throws Exception {
3332
}
3433

3534
private void assertGraalVMOrJDK11() {
35+
if (System.getProperty("java.vm.name").contains("GraalVM")) {
36+
return;
37+
}
3638
try {
37-
Context.create().close();
38-
} catch (IllegalStateException ex) {
39-
Assume.assumeNoException("Download GraalVM.org or use JDK11!", ex);
39+
Class.forName("java.lang.Module");
40+
} catch (ClassNotFoundException ex) {
41+
Assume.assumeNoException("Skipping the test on regular JDK8", ex);
4042
}
4143
}
4244
}

0 commit comments

Comments
 (0)