Skip to content

Commit 0acdf6b

Browse files
committed
[GR-47781] Adopt internal resources in TruffleRuby
PullRequest: truffleruby/3952 (cherry picked from commit 25e9f80)
1 parent 27edc81 commit 0acdf6b

File tree

8 files changed

+247
-93
lines changed

8 files changed

+247
-93
lines changed

doc/contributor/updating-ruby.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Update all of these:
145145
* Update `.ruby-version`, `TruffleRuby.LANGUAGE_VERSION`
146146
* Reset `lib/cext/ABI_version.txt` and `lib/cext/ABI_check.txt` to `1` if `RUBY_VERSION` was updated.
147147
* Update `versions.json` (with gem versions provided by `cat ../ruby/gems/bundled_gems | sort`, `ls -l lib/gems/specifications/default` and `grep 'VERSION =' lib/mri/rubygems.rb`)
148-
* Also update version numbers in `src/main/c/Makefile`.
148+
* Also update version numbers for `debug` and `rbs` in `src/main/c/Makefile` and in `mx.truffleruby/suite.py`.
149149
* Copy and paste `-h` and `--help` output to `RubyLauncher` (instructions are in the end of the file `src/launcher/java/org/truffleruby/launcher/RubyLauncher.java`)
150150
* This is a good time to get `jt build` working.
151151
* Copy and paste the TruffleRuby `--help` output to `doc/user/options.md` (e.g., with `jt ruby --help | xsel -b`)

lib/json/lib/json/ext/.keep

Whitespace-only changes.

mx.truffleruby/mx_truffleruby.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ def verify_ci(args):
274274
'truffleruby:JONI',
275275
],
276276
support_distributions=[
277-
'truffleruby:TRUFFLERUBY_GRAALVM_SUPPORT',
277+
'truffleruby:TRUFFLERUBY_GRAALVM_SUPPORT_PLATFORM_AGNOSTIC',
278+
'truffleruby:TRUFFLERUBY_GRAALVM_SUPPORT_PLATFORM_SPECIFIC',
278279
'truffleruby:TRUFFLERUBY_GRAALVM_SUPPORT_NO_NI_RESOURCES',
279280
],
280281
provided_executables=[

mx.truffleruby/suite.py

+122-20
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,22 @@
191191
"license": ["EPL-2.0"],
192192
},
193193

194+
"org.truffleruby.resources": {
195+
"dir": "src/resources",
196+
"sourceDirs": ["java"],
197+
"dependencies": [
198+
"truffle:TRUFFLE_API",
199+
],
200+
"annotationProcessors": [
201+
"truffle:TRUFFLE_DSL_PROCESSOR",
202+
],
203+
"jacoco": "include",
204+
"javaCompliance": "17+",
205+
"checkstyle": "org.truffleruby",
206+
"workingSets": "TruffleRuby",
207+
"license": ["EPL-2.0"],
208+
},
209+
194210
"org.truffleruby.services": {
195211
"dir": "src/services",
196212
"sourceDirs": ["java"],
@@ -420,6 +436,7 @@
420436
"org.truffleruby.annotations to org.graalvm.ruby",
421437
],
422438
},
439+
"useModulePath": True,
423440
"dependencies": [
424441
"org.truffleruby.annotations"
425442
],
@@ -430,7 +447,6 @@
430447
"tag": ["default", "public"],
431448
},
432449
"noMavenJavadoc": True,
433-
"useModulePath": True,
434450
},
435451

436452
# Required to share code between the launcher and the rest,
@@ -444,6 +460,7 @@
444460
"org.truffleruby.shared.options to org.graalvm.ruby, org.graalvm.ruby.launcher",
445461
],
446462
},
463+
"useModulePath": True,
447464
"dependencies": [
448465
"org.truffleruby.shared"
449466
],
@@ -458,7 +475,6 @@
458475
"tag": ["default", "public"],
459476
},
460477
"noMavenJavadoc": True,
461-
"useModulePath": True,
462478
},
463479

464480
"TRUFFLERUBY-PROCESSOR": {
@@ -478,6 +494,7 @@
478494
"moduleInfo": {
479495
"name": "org.graalvm.ruby",
480496
},
497+
"useModulePath": True,
481498
"dependencies": [
482499
"org.truffleruby",
483500
"org.truffleruby.ruby",
@@ -511,13 +528,13 @@
511528
"tag": ["default", "public"],
512529
},
513530
"noMavenJavadoc": True,
514-
"useModulePath": True,
515531
},
516532

517533
"RUBY_COMMUNITY": {
518534
"type": "pom",
519535
"runtimeDependencies": [
520536
"TRUFFLERUBY",
537+
"TRUFFLERUBY-RESOURCES",
521538
"truffle:TRUFFLE_RUNTIME",
522539
],
523540
"description": "TruffleRuby (GraalVM Ruby)",
@@ -551,6 +568,7 @@
551568
"org.truffleruby.launcher to org.graalvm.launcher",
552569
],
553570
},
571+
"useModulePath": True,
554572
"dependencies": [
555573
"org.truffleruby.launcher"
556574
],
@@ -563,28 +581,77 @@
563581
"description": "TruffleRuby Launcher",
564582
"license": ["EPL-2.0"],
565583
"maven": False,
584+
},
585+
586+
"TRUFFLERUBY-RESOURCES": {
587+
"description": "TruffleRuby runtime resources",
588+
"platformDependent": True,
589+
"moduleInfo": {
590+
"name": "org.graalvm.ruby.resources",
591+
},
566592
"useModulePath": True,
593+
"dependencies": [
594+
"org.truffleruby.resources",
595+
"TRUFFLERUBY_RESOURCES_PLATFORM_AGNOSTIC",
596+
"TRUFFLERUBY_RESOURCES_PLATFORM_SPECIFIC",
597+
],
598+
"distDependencies": [
599+
"truffle:TRUFFLE_API",
600+
],
601+
"requires": [
602+
"java.base",
603+
],
604+
"license": [
605+
"EPL-2.0", # JRuby (we're choosing EPL out of EPL,GPL,LGPL)
606+
"MIT", # minitest, did_you_mean, rake
607+
"BSD-simplified", # MRI
608+
"BSD-new", # Rubinius, FFI
609+
],
610+
"maven": {
611+
"artifactId": "ruby-resources",
612+
"tag": ["default", "public"],
613+
},
614+
},
615+
616+
"TRUFFLERUBY_RESOURCES_PLATFORM_AGNOSTIC": {
617+
"description": "Platform-agnostic resources for TruffleRuby home",
618+
"type": "dir",
619+
"platformDependent": False,
620+
"hashEntry": "META-INF/resources/ruby/ruby-home/common/sha256",
621+
"fileListEntry": "META-INF/resources/ruby/ruby-home/common/file-list",
622+
"layout": {
623+
"META-INF/resources/ruby/ruby-home/common/": "extracted-dependency:TRUFFLERUBY_GRAALVM_SUPPORT_PLATFORM_AGNOSTIC",
624+
},
625+
"maven": False,
567626
},
568627

569-
"TRUFFLERUBY_GRAALVM_SUPPORT": {
628+
"TRUFFLERUBY_RESOURCES_PLATFORM_SPECIFIC": {
629+
"description": "Platform-specific resources for TruffleRuby home",
630+
"type": "dir",
631+
"platformDependent": True,
632+
"hashEntry": "META-INF/resources/ruby/ruby-home/<os>/<arch>/sha256",
633+
"fileListEntry": "META-INF/resources/ruby/ruby-home/<os>/<arch>/file-list",
634+
"layout": {
635+
"META-INF/resources/ruby/ruby-home/<os>/<arch>/": "extracted-dependency:TRUFFLERUBY_GRAALVM_SUPPORT_PLATFORM_SPECIFIC",
636+
},
637+
"maven": False,
638+
},
639+
640+
"TRUFFLERUBY_GRAALVM_SUPPORT_PLATFORM_AGNOSTIC": {
641+
"description": "Platform-agnostic TruffleRuby home files",
570642
"fileListPurpose": 'native-image-resources',
571643
"native": True,
572-
"platformDependent": True,
573-
"description": "TruffleRuby support distribution for the GraalVM",
644+
"platformDependent": False,
574645
"layout": {
575646
"lib/": [
576647
"file:lib/json",
577648
"file:lib/mri",
578649
"file:lib/patches",
579650
"file:lib/truffle",
580-
"dependency:org.truffleruby.yarp.bindings",
581651
],
582652
"lib/cext/": [
583653
"file:lib/cext/*.rb",
584654
"file:lib/cext/ABI_version.txt",
585-
"dependency:org.truffleruby.cext/src/main/c/truffleposix/<lib:truffleposix>",
586-
"dependency:org.truffleruby.cext/src/main/c/cext/<lib:truffleruby>",
587-
"dependency:org.truffleruby.rubysignal",
588655
],
589656
"lib/cext/include/": [
590657
"file:lib/cext/include/*",
@@ -594,11 +661,46 @@
594661
"source_type": "file",
595662
"path": "lib/gems/*",
596663
"exclude": [
597-
"lib/gems/gems/debug-*/ext",
598-
"lib/gems/gems/rbs-*/ext",
664+
# The debug and rbs gems have native extensions.
665+
# Do not ship ext/ as it includes an unnecessary copy of the .so and intermediate files.
666+
# The .so in lib/ are copied in the platform-specific distribution.
667+
# <extsuffix:...> does not work in exclude, so use .* here (.{so,bundle} does not work either).
668+
"lib/gems/extensions",
669+
"lib/gems/gems/debug-1.7.1/ext",
670+
"lib/gems/gems/debug-1.7.1/lib/debug/debug.*",
671+
"lib/gems/gems/rbs-2.8.2/ext",
672+
"lib/gems/gems/rbs-2.8.2/lib/rbs_extension.*",
599673
],
600674
},
601675
],
676+
},
677+
"license": [
678+
"EPL-2.0", # JRuby (we're choosing EPL out of EPL,GPL,LGPL)
679+
"MIT", # minitest, did_you_mean, rake
680+
"BSD-simplified", # MRI
681+
"BSD-new", # Rubinius, FFI
682+
],
683+
"maven": False,
684+
},
685+
686+
"TRUFFLERUBY_GRAALVM_SUPPORT_PLATFORM_SPECIFIC": {
687+
"description": "Platform-specific TruffleRuby home files",
688+
"fileListPurpose": 'native-image-resources',
689+
"native": True,
690+
"platformDependent": True,
691+
"layout": {
692+
"lib/": [
693+
"dependency:org.truffleruby.yarp.bindings",
694+
],
695+
"lib/cext/": [
696+
"dependency:org.truffleruby.cext/src/main/c/truffleposix/<lib:truffleposix>",
697+
"dependency:org.truffleruby.cext/src/main/c/cext/<lib:truffleruby>",
698+
"dependency:org.truffleruby.rubysignal",
699+
],
700+
# The platform-specific files from debug and rbs, see comment above
701+
"lib/gems/": "file:lib/gems/extensions",
702+
"lib/gems/gems/debug-1.7.1/lib/debug/": "file:lib/gems/gems/debug-1.7.1/lib/debug/<extsuffix:debug>",
703+
"lib/gems/gems/rbs-2.8.2/lib/": "file:lib/gems/gems/rbs-2.8.2/lib/<extsuffix:rbs_extension>",
602704
"lib/mri/": [
603705
"dependency:org.truffleruby.cext/src/main/c/bigdecimal/<extsuffix:bigdecimal>",
604706
"dependency:org.truffleruby.cext/src/main/c/date/<extsuffix:date_core>",
@@ -621,10 +723,7 @@
621723
],
622724
},
623725
"license": [
624-
"EPL-2.0", # JRuby (we're choosing EPL out of EPL,GPL,LGPL)
625-
"MIT", # minitest, did_you_mean, rake
626726
"BSD-simplified", # MRI
627-
"BSD-new", # Rubinius, FFI
628727
],
629728
"maven": False,
630729
},
@@ -688,13 +787,15 @@
688787
"sdk:POLYGLOT",
689788
# runtime-only dependencies
690789
"TRUFFLERUBY",
790+
"TRUFFLERUBY-RESOURCES",
691791
],
692792
"exclude": [
693793
"mx:HAMCREST",
694794
"mx:JUNIT",
695795
],
796+
"unittestConfig": "none",
696797
"javaProperties": {
697-
"org.graalvm.language.ruby.home": "<path:TRUFFLERUBY_GRAALVM_SUPPORT>"
798+
"polyglot.engine.WarnInterpreterOnly": "false",
698799
},
699800
"license": ["EPL-2.0"],
700801
"maven": False,
@@ -708,14 +809,18 @@
708809
"distDependencies": [
709810
"sdk:LAUNCHER_COMMON",
710811
"TRUFFLERUBY",
812+
# runtime-only dependencies
813+
"TRUFFLERUBY-RESOURCES"
711814
],
712815
"exclude": [
713816
"mx:HAMCREST",
714817
"mx:JUNIT",
715818
"truffleruby:NETBEANS-LIB-PROFILER",
716819
],
820+
"unittestConfig": "none",
717821
"javaProperties": {
718-
"org.graalvm.language.ruby.home": "<path:TRUFFLERUBY_GRAALVM_SUPPORT>"
822+
"polyglot.engine.WarnInterpreterOnly": "false",
823+
"polyglotimpl.DisableClassPathIsolation": "true",
719824
},
720825
"license": ["EPL-2.0"],
721826
"maven": False,
@@ -725,9 +830,6 @@
725830
"testDistribution": True,
726831
"dependencies": ["org.truffleruby.tck"],
727832
"distDependencies": ["truffle:TRUFFLE_TCK"],
728-
"javaProperties": {
729-
"org.graalvm.language.ruby.home": "<path:TRUFFLERUBY_GRAALVM_SUPPORT>"
730-
},
731833
"license": ["EPL-2.0"],
732834
"maven": False,
733835
},

0 commit comments

Comments
 (0)