Skip to content

Commit 08dba29

Browse files
committed
Generate templated sources under main/java-templates
This path avoids the sources getting wiped out during `mvn clean`, since they are not generated during the maven build. This patch also moves the generated WASM build under src/main/wasm since it is really a source file and not a test file. It will not be included in the built artifact.
1 parent 7534097 commit 08dba29

File tree

15 files changed

+19
-17
lines changed

15 files changed

+19
-17
lines changed

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Check C coverage
3737
run: doxygen Doxyfile
3838
- name: Check Java coverage
39-
run: javadoc -Xdoclint:all,-missing -d doc/java -sourcepath java/api/target/generated-sources/java/:java/api/src/main/java org.ruby_lang.prism
39+
run: javadoc -Xdoclint:all,-missing -d doc/java -sourcepath java/api/src/main/java-templates/:java/api/src/main/java org.ruby_lang.prism
4040
- name: Generate Rust documentation
4141
run: |
4242
bundle exec rake cargo:build

.github/workflows/github-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- name: Build with Doxygen
5252
run: doxygen Doxyfile
5353
- name: Build with JavaDoc
54-
run: javadoc -Xdoclint:all,-missing -d doc/java -sourcepath java/api/target/generated-sources/java/:java/api/src/main/java org.ruby_lang.prism
54+
run: javadoc -Xdoclint:all,-missing -d doc/java -sourcepath java/api/src/main/java-templates/:java/api/src/main/java org.ruby_lang.prism
5555
- name: Build with rustdoc
5656
run: |
5757
bundle exec rake cargo:build

.github/workflows/java-wasm-bindings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ jobs:
5555
- uses: actions/upload-artifact@v7
5656
with:
5757
name: prism.wasm
58-
path: java/wasm/src/test/resources/prism.wasm
58+
path: java/wasm/src/main/wasm/prism.wasm

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ out.svg
4242
/java/org/ruby_lang/prism/AbstractNodeVisitor.java
4343
/java/org/ruby_lang/prism/Loader.java
4444
/java/org/ruby_lang/prism/Nodes.java
45-
/java/wasm/src/test/resources/prism.wasm
45+
/java/wasm/src/main/wasm/prism.wasm
4646
/lib/prism/compiler.rb
4747
/lib/prism/dispatcher.rb
4848
/lib/prism/dot_visitor.rb

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ all: shared static
3131
shared: build/libprism.$(SOEXT)
3232
static: build/libprism.a
3333
wasm: javascript/src/prism.wasm
34-
java-wasm: java/wasm/src/test/resources/prism.wasm
34+
java-wasm: java/wasm/src/main/wasm/prism.wasm
3535

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

54-
java/wasm/src/test/resources/prism.wasm: Makefile $(SOURCES) $(HEADERS)
54+
java/wasm/src/main/wasm/prism.wasm: Makefile $(SOURCES) $(HEADERS)
5555
$(ECHO) "building $@"
5656
$(Q) $(MAKEDIRS) $(@D)
5757
$(Q) $(WASI_SDK_PATH)/bin/clang \

docs/configuration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ A lot of code in prism's repository is templated from a single configuration fil
88
* `include/prism/node_new.h` - for defining the functions that create the nodes in C
99
* `javascript/src/deserialize.js` - for defining how to deserialize the nodes in JavaScript
1010
* `javascript/src/nodes.js` - for defining the nodes in JavaScript
11-
* `java/api/target/generated-sources/java/org/ruby_lang/prism/AbstractNodeVisitor.java` - for defining the visitor interface for the nodes in Java
12-
* `java/api/target/generated-sources/java/org/ruby_lang/prism/Loader.java` - for defining how to deserialize the nodes in Java
13-
* `java/api/target/generated-sources/java/org/ruby_lang/prism/Nodes.java` - for defining the nodes in Java
11+
* `java/api/src/main/java-templates/org/ruby_lang/prism/AbstractNodeVisitor.java` - for defining the visitor interface for the nodes in Java
12+
* `java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java` - for defining how to deserialize the nodes in Java
13+
* `java/api/src/main/java-templates/org/ruby_lang/prism/Nodes.java` - for defining the nodes in Java
1414
* `lib/prism/compiler.rb` - for defining the compiler for the nodes in Ruby
1515
* `lib/prism/dispatcher.rb` - for defining the dispatch visitors for the nodes in Ruby
1616
* `lib/prism/dot_visitor.rb` - for defining the dot visitor for the nodes in Ruby

java/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
api/src/main/java-templates
12
api/target
23
native/target
4+
wasm/src/main/wasm
35
wasm/target
6+
target
47
.idea

java/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Sources under `api` are generated from templates in `../templates`. Those source
1818
$ PRISM_EXCLUDE_PRETTYPRINT=1 PRISM_SERIALIZE_ONLY_SEMANTICS_FIELDS=1 bundle exec rake templates
1919
```
2020

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

2323
### WASM build of Prism
2424

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

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

3333
### Build and install
3434

java/api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</goals>
2828
<configuration>
2929
<sources>
30-
<source>target/generated-sources/java</source>
30+
<source>src/main/java-templates</source>
3131
</sources>
3232
</configuration>
3333
</execution>

java/wasm/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@
7979
</goals>
8080
<configuration>
8181
<name>org.ruby_lang.prism.wasm.PrismParser</name>
82-
<wasmFile>src/test/resources/prism.wasm</wasmFile>
8382
<moduleInterface>org.ruby_lang.prism.wasm.Prism</moduleInterface>
83+
<wasmFile>src/main/wasm/prism.wasm</wasmFile>
8484
</configuration>
8585
</execution>
8686
</executions>

0 commit comments

Comments
 (0)