Skip to content

Commit 388483f

Browse files
committed
[GR-45043] Prototype to use YARP - Yet Another Ruby Parser
PullRequest: truffleruby/3531
2 parents b6c6096 + 986314e commit 388483f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+26113
-14
lines changed

doc/contributor/yarp.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# YARP
2+
3+
## Update YARP
4+
5+
* Clone `yarp` as a sibling of `truffleruby-ws`.
6+
* Run `tool/import-yarp.sh` in the truffleruby repo.
7+
* Commit the result with message `Import Shopify/yarp@COMMIT`
8+
9+
## Print Detailed YARP AST
10+
11+
```bash
12+
cd yarp
13+
chruby 3.2.
14+
bundle exec rake
15+
bundle exec ruby -Ilib -ryarp -e 'pp YARP.parse("1&.itself")'
16+
```

mx.truffleruby/mx_truffleruby.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,11 @@ def verify_ci(args):
243243
'TruffleRuby license files': ('', []),
244244
},
245245
truffle_jars=[
246+
# Distributions
246247
'truffleruby:TRUFFLERUBY',
247248
'truffleruby:TRUFFLERUBY-SHARED',
248249
'truffleruby:TRUFFLERUBY-ANNOTATIONS',
250+
# Libraries
249251
'sdk:JLINE3',
250252
'truffleruby:JCODINGS',
251253
'truffleruby:JONI',

mx.truffleruby/suite.py

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,23 @@
124124

125125
# ------------- Projects -------------
126126

127+
"org.yarp": {
128+
"dir": "src/yarp",
129+
"sourceDirs": ["java"],
130+
"jniHeaders": True,
131+
"jacoco": "include",
132+
"javaCompliance": "17+",
133+
"workingSets": "TruffleRuby",
134+
"license": ["MIT"],
135+
},
136+
127137
"org.truffleruby.annotations": {
128138
"dir": "src/annotations",
129139
"sourceDirs": ["java"],
130140
"jacoco": "include",
131141
"javaCompliance": "17+",
132142
"checkstyle": "org.truffleruby",
133143
"workingSets": "TruffleRuby",
134-
"checkPackagePrefix": "false",
135144
"license": ["EPL-2.0"],
136145
},
137146

@@ -194,6 +203,19 @@
194203
"ldflags": ["-pthread"],
195204
},
196205

206+
"org.yarp.libyarp": {
207+
"dir": "src/main/c/yarp",
208+
"native": "shared_lib",
209+
"deliverable": "yarp",
210+
"buildDependencies": [
211+
"org.yarp", # for the generated JNI header file
212+
],
213+
"use_jdk_headers": True, # the generated JNI header includes jni.h
214+
"cflags": ["-g", "-Wall", "-Werror", "-pthread"],
215+
"ldflags": ["-pthread"],
216+
"description": "YARP + JNI bindings as a single lib"
217+
},
218+
197219
"org.truffleruby": {
198220
"dir": "src/main",
199221
"sourceDirs": ["java"],
@@ -204,15 +226,17 @@
204226
"jdk.management",
205227
"jdk.unsupported", # sun.misc.Signal
206228
],
207-
"dependencies": [ # Keep in sync with TRUFFLERUBY distDependencies and exclude
208-
# Distributions
229+
"dependencies": [
230+
# Projects
231+
"org.yarp",
232+
# Distributions, keep in sync with TRUFFLERUBY.distDependencies
209233
"truffleruby:TRUFFLERUBY-ANNOTATIONS",
210234
"truffleruby:TRUFFLERUBY-SHARED",
211235
"truffle:TRUFFLE_API",
212236
"truffle:TRUFFLE_NFI",
213237
"regex:TREGEX",
214238
"sulong:SULONG_API",
215-
# Libraries
239+
# Libraries, keep in sync with TRUFFLERUBY.exclude and truffle_jars (in mx_truffleruby.py)
216240
"sdk:JLINE3",
217241
"truffleruby:JCODINGS",
218242
"truffleruby:JONI",
@@ -230,7 +254,7 @@
230254
"EPL-2.0", # JRuby (we're choosing EPL out of EPL,GPL,LGPL)
231255
"BSD-new", # Rubinius
232256
"BSD-simplified", # MRI
233-
"MIT", # Joni, JCodings
257+
"MIT", # Joni, JCodings, YARP
234258
],
235259
},
236260

@@ -274,11 +298,13 @@
274298
"sourceDirs": ["java", "ruby"],
275299
"requires": ["java.scripting", "java.management", "jdk.management"],
276300
"dependencies": [
277-
"org.truffleruby",
278-
"org.truffleruby.services",
301+
# Distributions
302+
"sdk:LAUNCHER_COMMON",
303+
"TRUFFLERUBY",
304+
"TRUFFLERUBY-SERVICES",
305+
# Libraries
279306
"mx:JUNIT",
280307
"truffleruby:NETBEANS-LIB-PROFILER",
281-
"sdk:LAUNCHER_COMMON"
282308
],
283309
"javaCompliance": "17+",
284310
"checkstyle": "org.truffleruby",
@@ -456,6 +482,7 @@
456482
"file:lib/mri",
457483
"file:lib/patches",
458484
"file:lib/truffle",
485+
"dependency:org.yarp.libyarp",
459486
],
460487
"lib/cext/": [
461488
"file:lib/cext/*.rb",
@@ -560,16 +587,15 @@
560587
"dependencies": [
561588
"org.truffleruby.test",
562589
],
563-
"exclude": [
564-
"mx:HAMCREST",
565-
"mx:JUNIT",
566-
"truffleruby:NETBEANS-LIB-PROFILER",
567-
],
568590
"distDependencies": [
569591
"sdk:LAUNCHER_COMMON",
570592
"TRUFFLERUBY",
571593
"TRUFFLERUBY-SERVICES",
572-
"TRUFFLERUBY_GRAALVM_SUPPORT",
594+
],
595+
"exclude": [
596+
"mx:HAMCREST",
597+
"mx:JUNIT",
598+
"truffleruby:NETBEANS-LIB-PROFILER",
573599
],
574600
"javaProperties": {
575601
"org.graalvm.language.ruby.home": "<path:TRUFFLERUBY_GRAALVM_SUPPORT>"

0 commit comments

Comments
 (0)