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
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Check C coverage
run: doxygen Doxyfile
- name: Check Java coverage
run: javadoc -Xdoclint:all,-missing -d doc/java -sourcepath java/api/target/generated-sources/java/:java/api/src/main/java org.ruby_lang.prism
run: javadoc -Xdoclint:all,-missing -d doc/java -sourcepath java/api/src/main/java-templates/:java/api/src/main/java org.ruby_lang.prism
- name: Generate Rust documentation
run: |
bundle exec rake cargo:build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Build with Doxygen
run: doxygen Doxyfile
- name: Build with JavaDoc
run: javadoc -Xdoclint:all,-missing -d doc/java -sourcepath java/api/target/generated-sources/java/:java/api/src/main/java org.ruby_lang.prism
run: javadoc -Xdoclint:all,-missing -d doc/java -sourcepath java/api/src/main/java-templates/:java/api/src/main/java org.ruby_lang.prism
- name: Build with rustdoc
run: |
bundle exec rake cargo:build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/java-wasm-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ jobs:
- uses: actions/upload-artifact@v7
with:
name: prism.wasm
path: java/wasm/src/test/resources/prism.wasm
path: java/wasm/src/main/wasm/prism.wasm
9 changes: 9 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ jobs:
bundler-cache: true
- name: Run Java Loader test
run: PRISM_SERIALIZE_ONLY_SEMANTICS_FIELDS=1 PRISM_JAVA_BACKEND=truffleruby bundle exec rake compile
- name: Archive sources for TruffleRuby
run: |
jar --create --file java/prism-truffleruby-sources.jar -C java/api/src/main/java `ls -r java/api/src/main/java`
jar --update --file java/prism-truffleruby-sources.jar -C java/api/src/main/java-templates `ls -r java/api/src/main/java-templates`
jar --update --file java/prism-truffleruby-sources.jar -C java/native/src/main/java `ls -r java/native/src/main/java`
Comment on lines +204 to +206
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the thought and effort but it's better to directly copy files from my Prism checkout, that way it also works if e.g. I have some local changes in Prism I'm testing in TruffleRuby.
So this can be removed.

- uses: actions/upload-artifact@v7
with:
name: truffleruby-sources
path: java/prism-truffleruby-sources.jar

lex-ruby:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +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
/java/wasm/src/main/wasm/prism.wasm
/lib/prism/compiler.rb
/lib/prism/dispatcher.rb
/lib/prism/dot_visitor.rb
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ all: shared static
shared: build/libprism.$(SOEXT)
static: build/libprism.a
wasm: javascript/src/prism.wasm
java-wasm: java/wasm/src/test/resources/prism.wasm
java-wasm: java/wasm/src/main/wasm/prism.wasm

build/libprism.$(SOEXT): $(SHARED_OBJECTS)
$(ECHO) "linking $@ with $(CC)"
Expand All @@ -51,7 +51,7 @@ javascript/src/prism.wasm: Makefile $(SOURCES) $(HEADERS)
-Oz -g0 -flto -fdata-sections -ffunction-sections \
-o $@ $(SOURCES)

java/wasm/src/test/resources/prism.wasm: Makefile $(SOURCES) $(HEADERS)
java/wasm/src/main/wasm/prism.wasm: Makefile $(SOURCES) $(HEADERS)
$(ECHO) "building $@"
$(Q) $(MAKEDIRS) $(@D)
$(Q) $(WASI_SDK_PATH)/bin/clang \
Expand Down
6 changes: 3 additions & 3 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ A lot of code in prism's repository is templated from a single configuration fil
* `include/prism/node_new.h` - for defining the functions that create the nodes in C
* `javascript/src/deserialize.js` - for defining how to deserialize the nodes in JavaScript
* `javascript/src/nodes.js` - for defining the nodes in JavaScript
* `java/api/target/generated-sources/java/org/ruby_lang/prism/AbstractNodeVisitor.java` - for defining the visitor interface for the nodes in Java
* `java/api/target/generated-sources/java/org/ruby_lang/prism/Loader.java` - for defining how to deserialize the nodes in Java
* `java/api/target/generated-sources/java/org/ruby_lang/prism/Nodes.java` - for defining the nodes in Java
* `java/api/src/main/java-templates/org/ruby_lang/prism/AbstractNodeVisitor.java` - for defining the visitor interface for the nodes in Java
* `java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java` - for defining how to deserialize the nodes in Java
* `java/api/src/main/java-templates/org/ruby_lang/prism/Nodes.java` - for defining the nodes in Java
* `lib/prism/compiler.rb` - for defining the compiler for the nodes in Ruby
* `lib/prism/dispatcher.rb` - for defining the dispatch visitors for the nodes in Ruby
* `lib/prism/dot_visitor.rb` - for defining the dot visitor for the nodes in Ruby
Expand Down
3 changes: 3 additions & 0 deletions java/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
api/src/main/java-templates
api/target
native/target
wasm/src/main/wasm
wasm/target
target
.idea
4 changes: 2 additions & 2 deletions java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Sources under `api` are generated from templates in `../templates`. Those source
$ PRISM_EXCLUDE_PRETTYPRINT=1 PRISM_SERIALIZE_ONLY_SEMANTICS_FIELDS=1 bundle exec rake templates
```

The files go under `api/target/generated-sources/java` and will be removed with `mvn clean`.
The files are generated under `api/src/main/java-templates` and will not be removed with `mvn clean`.

### WASM build of Prism

Expand All @@ -28,7 +28,7 @@ The `wasm` project needs a WASM build of Prism to be generated with the followin
$ make java-wasm WASI_SDK_PATH=<path to WASI sdk>
```

The files go under `wasm/target/generated-sources/wasm` and will be removed with `mvn clean`.
The build is generated under `wasm/src/main/wasm` and will not be removed with `mvn clean`.

### Build and install

Expand Down
2 changes: 1 addition & 1 deletion java/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</goals>
<configuration>
<sources>
<source>target/generated-sources/java</source>
<source>src/main/java-templates</source>
</sources>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.ruby_lang.prism;
package org.ruby_lang.prism.jni;

public abstract class Parser {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class, which is the only class under java/native doesn't really do anything currently.
Notably the corresponding C code is not here, it's in https://github.com/truffleruby/truffleruby/blob/master/src/main/c/yarp_bindings/src/yarp_bindings.c.

Maybe we should actually remove this class? Or import the C file here?
If the C file would get compiled in CI that could be nice, as it'd catch cases that it needs to be updated, e.g. with the recent changes in the C API.

OTOH this is an area where usages might want different things (e.g. how the reading is done, maybe from a file/using mmap/etc), and notably truffleruby compiles that .c file together with libprism.a.

I'd tend to say the simplest is to just remove this file, but then maybe there is an issue because java/native is empty?


Expand Down
2 changes: 1 addition & 1 deletion java/wasm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
</goals>
<configuration>
<name>org.ruby_lang.prism.wasm.PrismParser</name>
<wasmFile>src/test/resources/prism.wasm</wasmFile>
<wasmFile>src/main/wasm/prism.wasm</wasmFile>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.ruby_lang.prism.wasm;

public final class WasmResource {
public static final String absoluteFile = "file://${project.basedir}/src/test/resources/prism.wasm";
public static final String absoluteFile = "file://${project.basedir}/src/main/wasm/prism.wasm";

private WasmResource() {}
}
1 change: 0 additions & 1 deletion java/wasm/src/test/resources/.gitignore

This file was deleted.

6 changes: 3 additions & 3 deletions templates/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -684,9 +684,9 @@ def locals
"javascript/src/deserialize.js",
"javascript/src/nodes.js",
"javascript/src/visitor.js",
"java/api/target/generated-sources/java/org/ruby_lang/prism/Loader.java",
"java/api/target/generated-sources/java/org/ruby_lang/prism/Nodes.java",
"java/api/target/generated-sources/java/org/ruby_lang/prism/AbstractNodeVisitor.java",
"java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java",
"java/api/src/main/java-templates/org/ruby_lang/prism/Nodes.java",
"java/api/src/main/java-templates/org/ruby_lang/prism/AbstractNodeVisitor.java",
"lib/prism/compiler.rb",
"lib/prism/dispatcher.rb",
"lib/prism/dot_visitor.rb",
Expand Down