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

Commit 3d9b658

Browse files
authored
Merge pull request #6 from graalvm/profiles-for-graalvm-and-jdk11
Profiles for graalvm and jdk11
2 parents 2f851ca + 5de5362 commit 3d9b658

File tree

3 files changed

+207
-149
lines changed

3 files changed

+207
-149
lines changed

.travis.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,25 @@ os:
44

55
language: java
66

7-
jdk: openjdk11
7+
jdk:
8+
- openjdk11
89

9-
install: true
10+
env:
11+
- GRAALVM_VERSION="1.0.0-rc8"
1012

11-
script: mvn package && mvn exec:exec@graal && mvn exec:exec@nograal
13+
install:
14+
- |
15+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then DOWNLOAD_OS_NAME="macos"; fi
16+
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then DOWNLOAD_OS_NAME="linux"; fi
17+
curl -LJ "https://github.com/oracle/graal/releases/download/vm-$GRAALVM_VERSION/graalvm-ce-$GRAALVM_VERSION-$DOWNLOAD_OS_NAME-amd64.tar.gz" --output graalvm.tar.gz
18+
tar -xzf graalvm.tar.gz
19+
20+
script:
21+
- mvn clean
22+
- mvn package
23+
- mvn exec:exec
24+
- mvn exec:exec@nograal
25+
- export JAVA_HOME="$(pwd)/graalvm-ce-$GRAALVM_VERSION" && if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export JAVA_HOME="$JAVA_HOME/Contents/Home"; fi
26+
- mvn clean
27+
- mvn package
28+
- mvn exec:exec

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,16 @@ API](https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/prog_guide
4848

4949
To Execute with Graal run
5050
```
51-
mvn exec:exec@graal
51+
mvn exec:exec
5252
```
5353

5454
To Execute without Graal run
5555
```
5656
mvn exec:exec@nograal
5757
```
58+
59+
## Running on GraalVM
60+
61+
This project is also setup to run on GraalVM. The setup is the same except
62+
that your JAVA_HOME should point to a directory contain GraalVM. In this case,
63+
execution without Graal is not supported.

pom.xml

Lines changed: 180 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -11,119 +11,189 @@
1111
<graalvm.version>1.0.0-rc8</graalvm.version>
1212
<compiler.dir>${project.build.directory}/compiler</compiler.dir>
1313
</properties>
14+
<profiles>
15+
<profile>
16+
<id>jdk11</id>
17+
<activation>
18+
<jdk>11</jdk>
19+
</activation>
20+
<dependencies>
21+
<dependency>
22+
<groupId>org.graalvm.sdk</groupId>
23+
<artifactId>graal-sdk</artifactId>
24+
<version>${graalvm.version}</version>
25+
</dependency>
26+
<dependency>
27+
<groupId>org.graalvm.js</groupId>
28+
<artifactId>js</artifactId>
29+
<version>${graalvm.version}</version>
30+
<scope>runtime</scope>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.graalvm.js</groupId>
34+
<artifactId>js-scriptengine</artifactId>
35+
<version>${graalvm.version}</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.graalvm.tools</groupId>
39+
<artifactId>profiler</artifactId>
40+
<version>${graalvm.version}</version>
41+
<scope>runtime</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.graalvm.tools</groupId>
45+
<artifactId>chromeinspector</artifactId>
46+
<version>${graalvm.version}</version>
47+
<scope>runtime</scope>
48+
</dependency>
49+
</dependencies>
50+
<build>
51+
<plugins>
52+
<plugin>
53+
<artifactId>maven-surefire-plugin</artifactId>
54+
<version>2.22.1</version>
55+
<configuration>
56+
<argLine>-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --module-path=${compiler.dir} --upgrade-module-path=${compiler.dir}/compiler.jar</argLine>
57+
</configuration>
58+
</plugin>
59+
<plugin>
60+
<groupId>org.apache.maven.plugins</groupId>
61+
<artifactId>maven-dependency-plugin</artifactId>
62+
<version>2.10</version>
63+
<executions>
64+
<execution>
65+
<id>copy</id>
66+
<phase>process-test-classes</phase>
67+
<goals>
68+
<goal>copy</goal>
69+
</goals>
70+
<configuration>
71+
<artifactItems>
72+
<artifactItem>
73+
<groupId>org.graalvm.compiler</groupId>
74+
<artifactId>compiler</artifactId>
75+
<version>${graalvm.version}</version>
76+
<type>jar</type>
77+
<overWrite>true</overWrite>
78+
<destFileName>compiler.jar</destFileName>
79+
</artifactItem>
80+
<artifactItem>
81+
<groupId>org.graalvm.truffle</groupId>
82+
<artifactId>truffle-api</artifactId>
83+
<version>${graalvm.version}</version>
84+
<type>jar</type>
85+
<overWrite>true</overWrite>
86+
<destFileName>truffle-api.jar</destFileName>
87+
</artifactItem>
88+
<artifactItem>
89+
<groupId>org.graalvm.sdk</groupId>
90+
<artifactId>graal-sdk</artifactId>
91+
<version>${graalvm.version}</version>
92+
<type>jar</type>
93+
<overWrite>true</overWrite>
94+
<destFileName>graal-sdk.jar</destFileName>
95+
</artifactItem>
96+
</artifactItems>
97+
<outputDirectory>${compiler.dir}</outputDirectory>
98+
</configuration>
99+
</execution>
100+
</executions>
101+
</plugin>
102+
<plugin>
103+
<groupId>org.codehaus.mojo</groupId>
104+
<artifactId>exec-maven-plugin</artifactId>
105+
<version>1.6.0</version>
106+
<executions>
107+
<execution>
108+
<id>default-cli</id>
109+
<goals>
110+
<goal>exec</goal>
111+
</goals>
112+
<configuration>
113+
<arguments>
114+
<argument>--module-path</argument>
115+
<!-- automatically creates the modulepath using all project dependencies, also adding the project build directory -->
116+
<modulepath/>
117+
<argument>-classpath</argument>
118+
<!-- automatically creates the classpath using all project dependencies, also adding the project build directory -->
119+
<classpath/>
120+
<argument>-XX:+UnlockExperimentalVMOptions</argument>
121+
<argument>-XX:+EnableJVMCI</argument>
122+
<argument>--upgrade-module-path=${compiler.dir}/compiler.jar</argument>
123+
<argument>com.mycompany.app.App</argument>
124+
</arguments>
125+
</configuration>
126+
</execution>
127+
<execution>
128+
<id>nograal</id>
129+
<goals>
130+
<goal>exec</goal>
131+
</goals>
132+
<configuration>
133+
<arguments>
134+
<argument>--module-path</argument>
135+
<!-- automatically creates the modulepath using all project dependencies, also adding the project build directory -->
136+
<modulepath/>
137+
<argument>-classpath</argument>
138+
<!-- automatically creates the classpath using all project dependencies, also adding the project build directory -->
139+
<classpath/>
140+
<argument>com.mycompany.app.App</argument>
141+
</arguments>
142+
</configuration>
143+
</execution>
144+
</executions>
145+
<configuration>
146+
<executable>${JAVA_HOME}/bin/java</executable>
147+
</configuration>
148+
</plugin>
149+
</plugins>
150+
</build>
151+
</profile>
152+
</profiles>
14153
<build>
15-
<pluginManagement>
16-
<plugins>
17-
<plugin>
18-
<artifactId>maven-compiler-plugin</artifactId>
19-
<version>3.8.0</version>
20-
<configuration>
21-
<source>11</source>
22-
<target>11</target>
23-
</configuration>
24-
</plugin>
25-
<plugin>
26-
<artifactId>maven-surefire-plugin</artifactId>
27-
<version>2.22.1</version>
28-
<configuration>
29-
<argLine>-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --module-path=${compiler.dir} --upgrade-module-path=${compiler.dir}/compiler.jar</argLine>
30-
</configuration>
31-
</plugin>
32-
<plugin>
33-
<groupId>org.apache.maven.plugins</groupId>
34-
<artifactId>maven-dependency-plugin</artifactId>
35-
<version>2.10</version>
36-
<executions>
37-
<execution>
38-
<id>copy</id>
39-
<phase>process-test-classes</phase>
40-
<goals>
41-
<goal>copy</goal>
42-
</goals>
43-
<configuration>
44-
<artifactItems>
45-
<artifactItem>
46-
<groupId>org.graalvm.compiler</groupId>
47-
<artifactId>compiler</artifactId>
48-
<version>${graalvm.version}</version>
49-
<type>jar</type>
50-
<overWrite>true</overWrite>
51-
<destFileName>compiler.jar</destFileName>
52-
</artifactItem>
53-
<artifactItem>
54-
<groupId>org.graalvm.truffle</groupId>
55-
<artifactId>truffle-api</artifactId>
56-
<version>${graalvm.version}</version>
57-
<type>jar</type>
58-
<overWrite>true</overWrite>
59-
<destFileName>truffle-api.jar</destFileName>
60-
</artifactItem>
61-
<artifactItem>
62-
<groupId>org.graalvm.sdk</groupId>
63-
<artifactId>graal-sdk</artifactId>
64-
<version>${graalvm.version}</version>
65-
<type>jar</type>
66-
<overWrite>true</overWrite>
67-
<destFileName>graal-sdk.jar</destFileName>
68-
</artifactItem>
69-
</artifactItems>
70-
<outputDirectory>${compiler.dir}</outputDirectory>
71-
</configuration>
72-
</execution>
73-
</executions>
74-
</plugin>
75-
<plugin>
76-
<groupId>org.codehaus.mojo</groupId>
77-
<artifactId>exec-maven-plugin</artifactId>
78-
<version>1.6.0</version>
79-
<executions>
80-
<execution>
81-
<id>graal</id>
82-
<goals>
83-
<goal>exec</goal>
84-
</goals>
85-
<configuration>
86-
<arguments>
87-
<argument>--module-path</argument>
88-
<!-- automatically creates the modulepath using all project dependencies, also adding the project build directory -->
89-
<modulepath/>
90-
<argument>-classpath</argument>
91-
<!-- automatically creates the classpath using all project dependencies, also adding the project build directory -->
92-
<classpath/>
93-
<argument>-XX:+UnlockExperimentalVMOptions</argument>
94-
<argument>-XX:+EnableJVMCI</argument>
95-
<argument>--upgrade-module-path=${compiler.dir}/compiler.jar</argument>
96-
<argument>com.mycompany.app.App</argument>
97-
</arguments>
98-
</configuration>
99-
</execution>
100-
<execution>
101-
<id>nograal</id>
102-
<goals>
103-
<goal>exec</goal>
104-
</goals>
105-
<configuration>
106-
<arguments>
107-
<argument>--module-path</argument>
108-
<!-- automatically creates the modulepath using all project dependencies, also adding the project build directory -->
109-
<modulepath/>
110-
<argument>-classpath</argument>
111-
<!-- automatically creates the classpath using all project dependencies, also adding the project build directory -->
112-
<classpath/>
113-
<argument>com.mycompany.app.App</argument>
114-
</arguments>
115-
</configuration>
116-
</execution>
117-
</executions>
118-
<configuration>
119-
<executable>${JAVA_HOME}/bin/java</executable>
120-
</configuration>
121-
</plugin>
122-
</plugins>
123-
</pluginManagement>
124154
<plugins>
125155
<plugin>
126-
<artifactId>maven-dependency-plugin</artifactId>
156+
<artifactId>maven-compiler-plugin</artifactId>
157+
<version>3.8.0</version>
158+
<configuration>
159+
<source>1.8</source>
160+
<target>1.8</target>
161+
</configuration>
162+
</plugin>
163+
<plugin>
164+
<artifactId>maven-surefire-plugin</artifactId>
165+
<version>2.22.1</version>
166+
</plugin>
167+
<plugin>
168+
<groupId>org.codehaus.mojo</groupId>
169+
<artifactId>exec-maven-plugin</artifactId>
170+
<version>1.6.0</version>
171+
<executions>
172+
<execution>
173+
<goals>
174+
<goal>exec</goal>
175+
</goals>
176+
<configuration>
177+
<arguments>
178+
<argument>--module-path</argument>
179+
<!-- automatically creates the modulepath using all project dependencies, also adding the project build directory -->
180+
<modulepath/>
181+
<argument>-classpath</argument>
182+
<!-- automatically creates the classpath using all project dependencies, also adding the project build directory -->
183+
<classpath/>
184+
</arguments>
185+
</configuration>
186+
</execution>
187+
</executions>
188+
<configuration>
189+
<executable>${JAVA_HOME}/bin/java</executable>
190+
<arguments>
191+
<argument>-classpath</argument>
192+
<!-- automatically creates the classpath using all project dependencies, also adding the project build directory -->
193+
<classpath/>
194+
<argument>com.mycompany.app.App</argument>
195+
</arguments>
196+
</configuration>
127197
</plugin>
128198
</plugins>
129199
</build>
@@ -134,40 +204,5 @@
134204
<version>4.12</version>
135205
<scope>test</scope>
136206
</dependency>
137-
<dependency>
138-
<groupId>org.graalvm.sdk</groupId>
139-
<artifactId>graal-sdk</artifactId>
140-
<version>${graalvm.version}</version>
141-
</dependency>
142-
<dependency>
143-
<groupId>org.graalvm.truffle</groupId>
144-
<artifactId>truffle-api</artifactId>
145-
<version>${graalvm.version}</version>
146-
<scope>runtime</scope>
147-
</dependency>
148-
<dependency>
149-
<groupId>org.graalvm.js</groupId>
150-
<artifactId>js</artifactId>
151-
<version>${graalvm.version}</version>
152-
<scope>runtime</scope>
153-
</dependency>
154-
<dependency>
155-
<groupId>org.graalvm.js</groupId>
156-
<artifactId>js-scriptengine</artifactId>
157-
<version>${graalvm.version}</version>
158-
<scope>runtime</scope>
159-
</dependency>
160-
<dependency>
161-
<groupId>org.graalvm.tools</groupId>
162-
<artifactId>profiler</artifactId>
163-
<version>${graalvm.version}</version>
164-
<scope>runtime</scope>
165-
</dependency>
166-
<dependency>
167-
<groupId>org.graalvm.tools</groupId>
168-
<artifactId>chromeinspector</artifactId>
169-
<version>${graalvm.version}</version>
170-
<scope>runtime</scope>
171-
</dependency>
172207
</dependencies>
173208
</project>

0 commit comments

Comments
 (0)