Skip to content

Commit

Permalink
build: Upgrade GraalSDK to 23.1.2 (#7)
Browse files Browse the repository at this point in the history
Signed-off-by: tison <[email protected]>
  • Loading branch information
tisonkun authored Jan 17, 2024
1 parent 9055977 commit 03f0312
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 74 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check license header
uses: korandoru/hawkeye@v3
uses: korandoru/hawkeye@v4
- name: Setup Java
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check codestyle
Expand All @@ -60,13 +60,12 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Java
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
java-version: '21'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and check
run: mvn clean package -DskipTests
Expand Down
38 changes: 2 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,6 @@ mvn clean package -DskipTests
./trufflebf-native/bf examples/helloworld.bf
```

## Install TruffleBF into GraalVM
## Interop

```shell
mvn package -DskipTests
gu install -L trufflebf-component/bf-component.jar
```

After install TruffleBF into GraalVM, you can run the interop examples.

### Interop between Java and TruffleBF

```shell
javac examples/Interop.java
java examples.Interop
```

### Interop between JavaScript and TruffleBF

```shell
gu install nodejs
node --polyglot --jvm examples/interop.js
```

### Interop between C and TruffleBF

```shell
gu install llvm
clang -g -O1 -c -emit-llvm -I$JAVA_HOME/languages/llvm/include examples/interop.c
lli --polyglot --jvm interop.bc
```

### Interop between Ruby and TruffleBF

```
gu install ruby
ruby --experimental-options --single-threaded --polyglot --jvm examples/interop.rb
```
See https://github.com/oracle/graal/issues/6852 and https://github.com/oracle/graal/issues/6855.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
</modules>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<exec-maven-plugin.version>3.1.0</exec-maven-plugin.version>
<graalvm.version>23.0.0</graalvm.version>
<graalvm.version>23.1.2</graalvm.version>
<maven-shade-plugin.version>3.4.1</maven-shade-plugin.version>
<os-maven-plugin.version>1.7.1</os-maven-plugin.version>
<spotless-maven-plugin.version>2.40.0</spotless-maven-plugin.version>
Expand Down
3 changes: 1 addition & 2 deletions trufflebf-component/clean_component.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash

# Copyright 2022 Korandoru Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,6 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.



[[ -f bf-component.jar ]] && rm bf-component.jar || echo "bf-component.jar not found"
3 changes: 1 addition & 2 deletions trufflebf-component/make_component.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash

# Copyright 2022 Korandoru Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.



declare -r GRAALVM_VERSION="${1:?The first argument must be GraalVM version.}"
declare -r OS_DETECTED_ARCH="${2:?The second argument must be machine arch.}"

Expand Down
4 changes: 4 additions & 0 deletions trufflebf-language/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@
<exclude>org.graalvm.truffle:truffle-api</exclude>
<exclude>org.graalvm.truffle:truffle-dsl-processor</exclude>
<exclude>org.graalvm.truffle:truffle-tck</exclude>
<exclude>org.graalvm.polyglot:polyglot</exclude>
<exclude>org.graalvm.sdk:collections</exclude>
<exclude>org.graalvm.sdk:graal-sdk</exclude>
<exclude>org.graalvm.sdk:nativeimage</exclude>
<exclude>org.graalvm.sdk:word</exclude>
</excludes>
</artifactSet>
</configuration>
Expand Down
4 changes: 4 additions & 0 deletions trufflebf-launcher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@
<exclude>com.oracle.truffle:truffle-api</exclude>
<exclude>com.oracle.truffle:truffle-dsl-processor</exclude>
<exclude>com.oracle.truffle:truffle-tck</exclude>
<exclude>org.graalvm.polyglot:polyglot</exclude>
<exclude>org.graalvm.sdk:collections</exclude>
<exclude>org.graalvm.sdk:graal-sdk</exclude>
<exclude>org.graalvm.sdk:nativeimage</exclude>
<exclude>org.graalvm.sdk:word</exclude>
</excludes>
</artifactSet>
</configuration>
Expand Down
3 changes: 1 addition & 2 deletions trufflebf-native/clean_native.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash

# Copyright 2022 Korandoru Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,6 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.



[ -f bf ] && rm bf || echo "bf not found."
22 changes: 0 additions & 22 deletions trufflebf-native/make_native.sh

This file was deleted.

24 changes: 23 additions & 1 deletion trufflebf-native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@
<artifactId>trufflebf-native</artifactId>
<packaging>pom</packaging>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>trufflebf-language</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>trufflebf-launcher</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
Expand All @@ -41,7 +54,16 @@
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/make_native.sh</executable>
<executable>
${env.JAVA_HOME}/bin/native-image</executable>
<commandlineArgs>
--no-fallback
--initialize-at-build-time
-p %classpath
-H:+ReportExceptionStackTraces
io.korandoru.trufflebf.launcher.BFMain
-o ${project.basedir}/bf
</commandlineArgs>
</configuration>
</execution>
<execution>
Expand Down

0 comments on commit 03f0312

Please sign in to comment.