Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ out.svg
/java/org/ruby_lang/prism/AbstractNodeVisitor.java
/java/org/ruby_lang/prism/Loader.java
/java/org/ruby_lang/prism/Nodes.java
/java-wasm/src/test/resources/prism.wasm
/lib/prism/compiler.rb
/lib/prism/dispatcher.rb
/lib/prism/dot_visitor.rb
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ javascript/src/prism.wasm: Makefile $(SOURCES) $(HEADERS)
java-wasm/src/test/resources/prism.wasm: Makefile $(SOURCES) $(HEADERS)
$(ECHO) "building $@"
$(Q) $(MAKEDIRS) $(@D)
$(Q) $(WASI_SDK_PATH)/bin/clang $(DEBUG_FLAGS) -DPRISM_EXCLUDE_PRETTYPRINT -DPRISM_EXPORT_SYMBOLS -D_WASI_EMULATED_MMAN -lwasi-emulated-mman $(CPPFLAGS) $(JAVA_WASM_CFLAGS) -Wl,--export-all -Wl,--no-entry -mexec-model=reactor -lc++ -lc++abi -o $@ $(SOURCES)
$(Q) $(WASI_SDK_PATH)/bin/clang \
$(DEBUG_FLAGS) \
-DPRISM_EXCLUDE_PRETTYPRINT -DPRISM_EXPORT_SYMBOLS -D_WASI_EMULATED_MMAN \
-lwasi-emulated-mman $(CPPFLAGS) $(JAVA_WASM_CFLAGS) \
-Wl,--export-all -Wl,--no-entry -mexec-model=reactor -lc++ -lc++abi \
-o $@ $(SOURCES)

build/shared/%.o: src/%.c Makefile $(HEADERS)
$(ECHO) "compiling $@"
Expand Down
6 changes: 6 additions & 0 deletions java-wasm/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
This dir contains the chicory-prism artifact, a version of prism compiled to WASM and then AOT compiled to JVM bytecode by the Chicory project.

## Building

Generate the templated sources:

```
Expand All @@ -21,3 +23,7 @@ mvn -f java-wasm/pom.xml clean package
This should build the chicory-wasm jar file and pass some basic tests.

The jar will be under `java-wasm/target/chicory-prism-#####-SNAPSHOT.jar` or can be installed by using `install` instead of `pacakge` in the `mvn` command line above.

## Releasing

Pass `-Prelease` to enable release plugins for Maven Central (optional for snapshots) and run the `deploy` target for `mvn`.
109 changes: 89 additions & 20 deletions java-wasm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.jruby</groupId>
<artifactId>chicory-prism</artifactId>
<groupId>org.ruby-lang</groupId>
<artifactId>prism-parser-wasm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Java Prism</name>
<name>Java WASM Prism</name>
<description>Pure Java Prism using Chicory WASM runtime</description>


Expand Down Expand Up @@ -61,11 +61,71 @@
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>10.0.2.0</version>
<artifactId>jruby-stdlib</artifactId>
<version>10.1.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-base</artifactId>
<version>10.1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>

<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<doclint>none</doclint>
</configuration>
</plugin>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<gpgArguments>
<gpgArgument>--pinentry-mode</gpgArgument>
<gpgArgument>loopback</gpgArgument>
</gpgArguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -97,26 +157,26 @@
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.4</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>../java</source>
</sources>
</configuration>
</execution>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>../java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand All @@ -130,12 +190,21 @@
<goal>compile</goal>
</goals>
<configuration>
<name>org.jruby.parser.prism.wasm.PrismParser</name>
<name>org.ruby_lang.prism.wasm.PrismParser</name>
<wasmFile>src/test/resources/prism.wasm</wasmFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.7.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jruby.parser.prism.wasm;
package org.ruby_lang.prism.wasm;

public final class WasmResource {
public static final String absoluteFile = "file://${project.basedir}/src/test/resources/prism.wasm";
Expand Down
95 changes: 0 additions & 95 deletions java-wasm/src/main/java/org/jruby/parser/prism/wasm/Prism.java

This file was deleted.

Loading