jruby-launcher 1.1.9-java → 1.1.15-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +3 -0
  3. data/Rakefile +1 -2
  4. data/argparser.cpp +55 -14
  5. data/argparser.h +1 -0
  6. data/extconf.rb +7 -0
  7. data/inc/Makefile-conf.mk +5 -0
  8. data/lib/jruby-launcher.rb +1 -1
  9. data/pkg/jruby-launcher-1.1.14-java/extconf.rb +12 -0
  10. data/pkg/{jruby-launcher-1.1.8-java → jruby-launcher-1.1.14-java}/lib/jruby-launcher.rb +1 -1
  11. data/pkg/{jruby-launcher-1.1.5-java → jruby-launcher-1.1.14-java}/lib/rubygems/defaults/jruby_native.rb +0 -0
  12. data/pkg/{jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java → jruby-launcher-1.1.14-java}/spec/launcher_spec.rb +23 -0
  13. data/pkg/{jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java → jruby-launcher-1.1.14-java}/spec/spec_helper.rb +0 -5
  14. data/platformlauncher.cpp +20 -5
  15. data/rb_w32_cmdvector.h +3 -3
  16. data/spec/launcher_spec.rb +33 -3
  17. data/spec/spec_helper.rb +0 -5
  18. data/unixlauncher.cpp +10 -0
  19. data/utilsfuncs.cpp +13 -1
  20. data/utilsfuncs.h +1 -0
  21. data/utilsfuncswin.cpp +20 -2
  22. data/version.h +1 -1
  23. metadata +8 -79
  24. data/pkg/jruby-launcher-1.1.5-java/extconf.rb +0 -5
  25. data/pkg/jruby-launcher-1.1.5-java/lib/jruby-launcher.rb +0 -3
  26. data/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/extconf.rb +0 -5
  27. data/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/lib/jruby-launcher.rb +0 -3
  28. data/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  29. data/pkg/jruby-launcher-1.1.5-java/spec/launcher_spec.rb +0 -258
  30. data/pkg/jruby-launcher-1.1.5-java/spec/spec_helper.rb +0 -81
  31. data/pkg/jruby-launcher-1.1.5.pre-java/extconf.rb +0 -5
  32. data/pkg/jruby-launcher-1.1.5.pre-java/lib/jruby-launcher.rb +0 -3
  33. data/pkg/jruby-launcher-1.1.5.pre-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  34. data/pkg/jruby-launcher-1.1.5.pre-java/spec/launcher_spec.rb +0 -258
  35. data/pkg/jruby-launcher-1.1.5.pre-java/spec/spec_helper.rb +0 -81
  36. data/pkg/jruby-launcher-1.1.7-java/extconf.rb +0 -5
  37. data/pkg/jruby-launcher-1.1.7-java/lib/jruby-launcher.rb +0 -3
  38. data/pkg/jruby-launcher-1.1.7-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  39. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/extconf.rb +0 -5
  40. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/lib/jruby-launcher.rb +0 -3
  41. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  42. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/extconf.rb +0 -5
  43. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/lib/jruby-launcher.rb +0 -3
  44. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  45. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/spec/launcher_spec.rb +0 -258
  46. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/spec/spec_helper.rb +0 -81
  47. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/spec/launcher_spec.rb +0 -258
  48. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/spec/spec_helper.rb +0 -81
  49. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5.pre-java/extconf.rb +0 -5
  50. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5.pre-java/lib/jruby-launcher.rb +0 -3
  51. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5.pre-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  52. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5.pre-java/spec/launcher_spec.rb +0 -258
  53. data/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5.pre-java/spec/spec_helper.rb +0 -81
  54. data/pkg/jruby-launcher-1.1.7-java/spec/launcher_spec.rb +0 -258
  55. data/pkg/jruby-launcher-1.1.7-java/spec/spec_helper.rb +0 -81
  56. data/pkg/jruby-launcher-1.1.8-java/extconf.rb +0 -5
  57. data/pkg/jruby-launcher-1.1.8-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  58. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5-java/extconf.rb +0 -5
  59. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5-java/lib/jruby-launcher.rb +0 -3
  60. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  61. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/extconf.rb +0 -5
  62. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/lib/jruby-launcher.rb +0 -3
  63. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  64. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/spec/launcher_spec.rb +0 -258
  65. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/spec/spec_helper.rb +0 -81
  66. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5-java/spec/launcher_spec.rb +0 -258
  67. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5-java/spec/spec_helper.rb +0 -81
  68. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5.pre-java/extconf.rb +0 -5
  69. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5.pre-java/lib/jruby-launcher.rb +0 -3
  70. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5.pre-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  71. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5.pre-java/spec/launcher_spec.rb +0 -258
  72. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.5.pre-java/spec/spec_helper.rb +0 -81
  73. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/extconf.rb +0 -5
  74. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/lib/jruby-launcher.rb +0 -3
  75. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  76. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/extconf.rb +0 -5
  77. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/lib/jruby-launcher.rb +0 -3
  78. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  79. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/extconf.rb +0 -5
  80. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/lib/jruby-launcher.rb +0 -3
  81. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  82. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/spec/launcher_spec.rb +0 -258
  83. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/pkg/jruby-launcher-1.1.5.pre-java/spec/spec_helper.rb +0 -81
  84. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/spec/launcher_spec.rb +0 -258
  85. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5-java/spec/spec_helper.rb +0 -81
  86. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5.pre-java/extconf.rb +0 -5
  87. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5.pre-java/lib/jruby-launcher.rb +0 -3
  88. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5.pre-java/lib/rubygems/defaults/jruby_native.rb +0 -4
  89. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5.pre-java/spec/launcher_spec.rb +0 -258
  90. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/pkg/jruby-launcher-1.1.5.pre-java/spec/spec_helper.rb +0 -81
  91. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/spec/launcher_spec.rb +0 -258
  92. data/pkg/jruby-launcher-1.1.8-java/pkg/jruby-launcher-1.1.7-java/spec/spec_helper.rb +0 -81
  93. data/pkg/jruby-launcher-1.1.8-java/spec/launcher_spec.rb +0 -258
  94. data/pkg/jruby-launcher-1.1.8-java/spec/spec_helper.rb +0 -81
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a24cd17a7e856fa27004cd2ecae5be7f6fe133bec57528e9cfcdd287293eb76
4
- data.tar.gz: 7a5c616e66f9423f27ea5ed477c5500960527e84fcccb0c12fe53056959c581b
3
+ metadata.gz: 0b6988d6ac03341b36b3f204165bee190f7f7ae0a73ad223527b7631bd4e5b80
4
+ data.tar.gz: 0c797f2e012c00217e9defc6081c69c636443ca836436d25fc21d95326c398c7
5
5
  SHA512:
6
- metadata.gz: fc086ec3f19e35e4c70d0a8176230785cefc796032ce32f85dfc6c84e723c721e924fe6fd345a3682164e66430e6eb10f569c55342d124a1f6fd0a6dc22b5ba8
7
- data.tar.gz: 07e802263388bb7395b879beef5883189775296c07b4ab81b0a9191a560d797207ebafadb870316a261ef11f9d4b97179a7f2203f1d7089d7e7463d3f16deb54
6
+ metadata.gz: 26b78fd8b5b97ac99c2d3822805ff6acaebdc39e9a015a0c99cbc4b8de563b6ebe34d09376d9a7a5c0759362e7dd97bdeffe5303aa91085c21a706e77a441964
7
+ data.tar.gz: 6f39b0b7f613069696db0acfd3494b029c14e7d847e7093fa8527cab76ff40ba3c61325bfb5b119e189103b2457eab2a50bd27feb52d3dae19079dbf41560371
data/Makefile CHANGED
@@ -1,6 +1,8 @@
1
1
  # These line gets substituted with the actual Config::CONFIG items location by extconf.rb
2
2
  PREFIX = notspecified
3
3
  BINDIR = $(PREFIX)/bin
4
+ JRUBY_VERSION = notspecified
5
+ JRUBY_MODULE = 1
4
6
  INSTALLDIR = $(PREFIX)/lib/ruby/shared/rubygems/defaults
5
7
  INSTALLDIR9000 = $(PREFIX)/lib/ruby/stdlib/rubygems/defaults
6
8
  OLDINSTALLDIR = $(PREFIX)/lib/ruby/site_ruby/1.8/rubygems/defaults
@@ -112,6 +114,7 @@ include $(SUB_IMPLMK)
112
114
 
113
115
  # Pick conf based on OS. for mingw64, must manually override for now.
114
116
  ifeq ($(OS),Windows_NT)
117
+ CC=gcc
115
118
  CONF=mingw
116
119
  else
117
120
  CONF=unix
data/Rakefile CHANGED
@@ -28,12 +28,11 @@ task :gemspec => './lib/jruby-launcher.rb' do
28
28
  s.extensions = ["extconf.rb"]
29
29
  s.files = FileList["COPYING", "README.md", "Makefile", "Rakefile", "*.c", "*.cpp", "*.h", "inc/*.*", "**/*.rb", "resources/*.*"]
30
30
  s.homepage = %q{http://jruby.org}
31
- s.rubyforge_project = %q{jruby-extras}
32
31
  end
33
32
  end
34
33
 
35
34
  desc "Create gem file"
36
- task :package => [:update_version, :gemspec, :spec] do
35
+ task :package => [:update_version, :gemspec] do
37
36
  Gem::PackageTask.new(@gemspec) do |pkg|
38
37
  end
39
38
  Rake::Task['gem'].invoke
data/argparser.cpp CHANGED
@@ -10,6 +10,7 @@
10
10
  #include <algorithm>
11
11
  #include <unistd.h>
12
12
  #include <limits>
13
+ #include <fstream>
13
14
  #include "utilsfuncs.h"
14
15
  #include "argparser.h"
15
16
  #include "argnames.h"
@@ -247,9 +248,9 @@ bool ArgParser::parseArgs(int argc, char *argv[]) {
247
248
  }
248
249
  #endif
249
250
 
251
+
250
252
  // Force OpenJDK-based JVMs to use /dev/urandom for random number generation
251
253
  // See https://github.com/jruby/jruby/issues/4685 among others.
252
- struct stat buffer;
253
254
  if (access("/dev/urandom", R_OK) == 0) {
254
255
  // OpenJDK tries really hard to prevent you from using urandom.
255
256
  // See https://bugs.openjdk.java.net/browse/JDK-6202721
@@ -485,12 +486,46 @@ void ArgParser::prepareOptions() {
485
486
  option += cmdName;
486
487
  javaOptions.push_back(option);
487
488
 
488
- if (useModulePath) {
489
- // When modules are present, use module path
490
- option = OPT_CMDLINE_MODULE_PATH;
491
- option += classPath;
489
+ if (!bootClassPath.empty()) {
490
+ if (useModulePath) {
491
+ #ifdef JRUBY_MODULE
492
+ // When modules are present, use module path for the jruby libs (aka bootClassPath)
493
+ option = OPT_CMDLINE_MODULE_PATH;
494
+ #else
495
+ option = OPT_BOOT_CLASS_PATH;
496
+ #endif
497
+ } else {
498
+ option = OPT_BOOT_CLASS_PATH;
499
+ }
500
+ option += bootClassPath;
492
501
  javaOptions.push_back(option);
493
- } else if (separateProcess) {
502
+ }
503
+
504
+ if (useModulePath) {
505
+ string moduleOptsFile = platformDir + "/bin/.jruby.module_opts";
506
+ if (access(moduleOptsFile.c_str(), R_OK) == 0) {
507
+ logMsg("using @arguments file for Java module options");
508
+ javaOptions.push_back(string("@") + platformDir + "/bin/.jruby.module_opts");
509
+ } else {
510
+ // If .module_opts file is not detected, only add options if JRUBY_MODULE is defined.
511
+ // See extconf.rb for rules on which JRuby versions get JRUBY_MODULE.
512
+ #ifdef JRUBY_MODULE
513
+ logMsg("using hardcoded module options");
514
+ javaOptions.push_back("--add-opens");
515
+ javaOptions.push_back("java.base/java.io=org.jruby.dist");
516
+ javaOptions.push_back("--add-opens");
517
+ javaOptions.push_back("java.base/java.nio.channels=org.jruby.dist");
518
+ javaOptions.push_back("--add-opens");
519
+ javaOptions.push_back("java.base/sun.nio.ch=org.jruby.dist");
520
+ javaOptions.push_back("--add-opens");
521
+ javaOptions.push_back("java.management/sun.management=org.jruby.dist");
522
+ #else
523
+ logMsg("no JRuby module support detected, skipping module flags");
524
+ #endif
525
+ }
526
+ }
527
+
528
+ if (separateProcess) {
494
529
  // When launching a separate process, use '-cp' which expands embedded wildcards
495
530
  javaOptions.push_back(OPT_CMDLINE_CLASS_PATH);
496
531
  javaOptions.push_back(classPath);
@@ -500,12 +535,6 @@ void ArgParser::prepareOptions() {
500
535
  javaOptions.push_back(option);
501
536
  }
502
537
 
503
- if (!bootClassPath.empty()) {
504
- option = OPT_BOOT_CLASS_PATH;
505
- option += bootClassPath;
506
- javaOptions.push_back(option);
507
- }
508
-
509
538
  javaOptions.insert(javaOptions.end(), userOptions.begin(), userOptions.end());
510
539
  }
511
540
 
@@ -529,13 +558,25 @@ void ArgParser::useModulesIfPresent() {
529
558
 
530
559
  if (jdkhome.empty()) {
531
560
  logMsg("Unable to detect JPMS modules as JAVA_HOME is not specified");
532
- } else if (access((jdkhome + "/jmods").c_str(), R_OK) == 0) {
561
+ } else if (access((jdkhome + "/lib/modules").c_str(), R_OK) == 0 ||
562
+ releaseFileHasModules()) {
533
563
  logMsg("JPMS jmods dir detected, using module flags");
534
- noBootClassPath = 1;
535
564
  useModulePath = 1;
536
565
  }
537
566
  }
538
567
 
568
+ bool ArgParser::releaseFileHasModules() {
569
+ string releaseFile = jdkhome + "/release";
570
+ std::string line;
571
+ ifstream in(releaseFile.c_str());
572
+ if (in.is_open()) {
573
+ while (getline(in,line)) {
574
+ if (line.find("MODULES") == 0) return true;
575
+ }
576
+ }
577
+ return false;
578
+ }
579
+
539
580
  void ArgParser::constructBootClassPath() {
540
581
  logMsg("constructBootClassPath()");
541
582
  addedToBootCP.clear();
data/argparser.h CHANGED
@@ -54,6 +54,7 @@ protected:
54
54
  void addOptionsToCommandLine(std::list<std::string> & commandLine);
55
55
  bool endsWith(const std::string &string, const std::string &end);
56
56
  void useModulesIfPresent();
57
+ bool releaseFileHasModules();
57
58
 
58
59
  protected:
59
60
  bool separateProcess;
data/extconf.rb CHANGED
@@ -1,5 +1,12 @@
1
1
  mf = File.read('Makefile')
2
2
  mf = mf.gsub(/^BINDIR\s*=.*$/, "BINDIR = #{RbConfig::CONFIG['bindir']}")
3
3
  mf = mf.gsub(/^PREFIX\s*=.*$/, "PREFIX = #{File.dirname(RbConfig::CONFIG['libdir'])}")
4
+ mf = mf.gsub(/^JRUBY_VERSION\s*=.*$/, "JRUBY_VERSION = #{JRUBY_VERSION}")
5
+
6
+ # Launcher will use .module_opts file if present, otherwise hardcoded add-opens for this module.
7
+ # Module options are only supported on JRuby 9.2.1 or higher.
8
+ if JRUBY_VERSION =~ /(^1)|(^9\.[01])|(^9\.2\.0\.0)/
9
+ mf = mf.gsub(/^JRUBY_MODULE\s*=.*1$/, "JRUBY_MODULE =")
10
+ end
4
11
  puts mf
5
12
  File.open('Makefile', 'wb') {|f| f << mf}
data/inc/Makefile-conf.mk CHANGED
@@ -71,3 +71,8 @@ ifneq (,$(findstring SunOS,$(CND_PLATFORM)))
71
71
  CFLAGS += -D__SUNOS__
72
72
  LDLIBSOPTIONS += -lsocket -lnsl
73
73
  endif
74
+
75
+ # define JRUBY_MODULE appropriately for target JRuby
76
+ ifeq (1,$(JRUBY_MODULE))
77
+ CFLAGS += -DJRUBY_MODULE=${JRUBY_MODULE}
78
+ endif
@@ -1,3 +1,3 @@
1
1
  module JRubyLauncher
2
- VERSION = "1.1.9"
2
+ VERSION = "1.1.15"
3
3
  end
@@ -0,0 +1,12 @@
1
+ mf = File.read('Makefile')
2
+ mf = mf.gsub(/^BINDIR\s*=.*$/, "BINDIR = #{RbConfig::CONFIG['bindir']}")
3
+ mf = mf.gsub(/^PREFIX\s*=.*$/, "PREFIX = #{File.dirname(RbConfig::CONFIG['libdir'])}")
4
+ mf = mf.gsub(/^JRUBY_VERSION\s*=.*$/, "JRUBY_VERSION = #{JRUBY_VERSION}")
5
+
6
+ # Launcher will use .module_opts file if present, otherwise hardcoded add-opens for this module.
7
+ # Module options are only supported on JRuby 9.2.1 or higher.
8
+ if JRUBY_VERSION =~ /(^1)|(^9\.[01])|(^9\.2\.0\.0)/
9
+ mf = mf.gsub(/^JRUBY_MODULE\s*=.*1$/, "JRUBY_MODULE =")
10
+ end
11
+ puts mf
12
+ File.open('Makefile', 'wb') {|f| f << mf}
@@ -1,3 +1,3 @@
1
1
  module JRubyLauncher
2
- VERSION = "1.1.9"
2
+ VERSION = "1.1.15"
3
3
  end
@@ -1,3 +1,4 @@
1
+ require 'tmpdir'
1
2
  require File.expand_path('../spec_helper.rb', __FILE__)
2
3
  load File.expand_path('../../lib/jruby-launcher.rb', __FILE__)
3
4
 
@@ -255,4 +256,26 @@ describe "JRuby native launcher" do
255
256
  it "should not crash on format-strings" do
256
257
  jruby_launcher_args("-e %s%s%s%s%s 2>&1").should include('-e', '%s%s%s%s%s')
257
258
  end
259
+
260
+ it "should use --module-path on java9+ jruby 9.2.1+" do
261
+ # versions prior to 9.2.1 do not set a predictable module name
262
+ skip unless (JRUBY_VERSION.split('.') <=> ['9', '2', '1']) >= 0
263
+
264
+ Dir.mktmpdir do |java_home|
265
+ FileUtils.mkdir_p(File.join(java_home, 'lib/modules'))
266
+ with_environment 'JAVA_HOME' => java_home do
267
+ jruby_launcher_args('').grep(/^--module-path=.*jruby.jar/).should_not be_empty
268
+ end
269
+ end
270
+ end
271
+
272
+ it "should not treat CLASSPATH entries as modules on java9+" do
273
+ Dir.mktmpdir do |java_home|
274
+ Dir.mkdir(File.join(java_home, 'jmods'))
275
+ with_environment 'JAVA_HOME' => java_home, 'CLASSPATH' => '/some/lib.jar' do
276
+ jruby_launcher_args('').grep(/^--module-path=.*\/some\/lib.jar/).should be_empty
277
+ classpath_arg(jruby_launcher_args('')).should =~ /\/some\/lib.jar/
278
+ end
279
+ end
280
+ end
258
281
  end
@@ -2,11 +2,6 @@ require 'rspec'
2
2
  require 'rbconfig'
3
3
  require 'fileutils'
4
4
 
5
- if defined?(JRUBY_VERSION)
6
- require 'jruby'
7
- JRuby.runtime.instance_config.run_ruby_in_process = false
8
- end
9
-
10
5
  module JRubyLauncherHelper
11
6
  JRUBY_EXE = ''
12
7
  WINDOWS = RbConfig::CONFIG['target_os'] =~ /mswin/
data/platformlauncher.cpp CHANGED
@@ -147,14 +147,29 @@ bool PlatformLauncher::start(char* argv[], int argc, DWORD *retCode, const char*
147
147
  suppressConsole = false;
148
148
  } else {
149
149
  if (jdkhome.empty()) {
150
- if (!jvmLauncher.initialize(REQ_JAVA_VERSION)) {
151
- logErr(false, true, "Cannot find Java %s or higher.", REQ_JAVA_VERSION);
152
- return false;
150
+ // attempt to get JDK home from registry
151
+ jvmLauncher.initialize(REQ_JAVA_VERSION);
152
+ }
153
+
154
+ if (!jdkhome.empty()) {
155
+ java = jdkhome + "\\bin\\java.exe";
156
+ } else if (getenv("JAVA_HOME") != NULL) {
157
+ string java_home = string(getenv("JAVA_HOME"));
158
+ jdkhome = java_home;
159
+ java_home = trimTrailingBackslashes(java_home);
160
+ java = java_home + "\\bin\\java.exe";
161
+ } else {
162
+ java = findOnPath("java.exe");
163
+ if (!java.empty()) {
164
+ int home_index = java.find_last_of('\\', java.find_last_of('\\') - 1);
165
+ jdkhome = java.substr(0, home_index);
153
166
  }
154
167
  }
168
+ }
155
169
 
156
- jvmLauncher.getJavaPath(jdkhome);
157
- java = jdkhome + "\\bin\\java";
170
+ if (java.empty()) {
171
+ printToConsole("No `java.exe' executable found on PATH.");
172
+ return 255;
158
173
  }
159
174
 
160
175
  prepareOptions();
data/rb_w32_cmdvector.h CHANGED
@@ -52,7 +52,7 @@ int rb_w32_cmdvector(const char *cmd, char ***vec) {
52
52
  char *ptr, *base, *buffer, *cmdline;
53
53
  char **vptr;
54
54
  char quote;
55
- NtCmdLineElement *curr, **tail;
55
+ NtCmdLineElement *curr;
56
56
  NtCmdLineElement *cmdhead = NULL, **cmdtail = &cmdhead;
57
57
 
58
58
  //
@@ -237,7 +237,7 @@ int rb_w32_cmdvector(const char *cmd, char ***vec) {
237
237
  buffer = (char *)malloc(len);
238
238
  if (!buffer) {
239
239
  do_nothing:
240
- while (curr = cmdhead) {
240
+ while ((curr = cmdhead)) {
241
241
  cmdhead = curr->next;
242
242
  if (curr->flags & NTMALLOC) free(curr->str);
243
243
  free(curr);
@@ -263,7 +263,7 @@ int rb_w32_cmdvector(const char *cmd, char ***vec) {
263
263
 
264
264
  ptr = buffer + (elements+1) * sizeof(char *);
265
265
 
266
- while (curr = cmdhead) {
266
+ while ((curr = cmdhead)) {
267
267
  strlcpy(ptr, curr->str, curr->len + 1);
268
268
  *vptr++ = ptr;
269
269
  ptr += curr->len + 1;
@@ -1,3 +1,4 @@
1
+ require 'tmpdir'
1
2
  require File.expand_path('../spec_helper.rb', __FILE__)
2
3
  load File.expand_path('../../lib/jruby-launcher.rb', __FILE__)
3
4
 
@@ -20,11 +21,12 @@ describe "JRuby native launcher" do
20
21
  end
21
22
 
22
23
  it "should use $JAVACMD when JAVACMD is specified" do
23
- with_environment "JAVACMD" => File.join("jato") do
24
+ javacmd_path = File.join("path", "to", "jato")
25
+ with_environment "JAVACMD" => javacmd_path do
24
26
  if windows?
25
- jruby_launcher_args("-v 2>&1").join.should =~ %r{jato}
27
+ jruby_launcher_args("-v 2>&1").join.should =~ /#{javacmd_path}/
26
28
  else
27
- jruby_launcher_args("-v").first.should == File.join("jato")
29
+ jruby_launcher_args("-v").first.should == javacmd_path
28
30
  end
29
31
  end
30
32
  end
@@ -179,6 +181,9 @@ describe "JRuby native launcher" do
179
181
 
180
182
  # JRUBY-4706
181
183
  it "should put JRuby on regular classpath when -Xnobootclasspath is used" do
184
+ # Java 9+ do not like bootclasspath so we do not use it
185
+ skip if ENV_JAVA['java.specification.version'].to_i >= 9
186
+
182
187
  args = jruby_launcher_args("-e true")
183
188
  args.grep(/Xbootclasspath/).should_not be_empty
184
189
  args = jruby_launcher_args("-Xnobootclasspath -e true")
@@ -235,6 +240,9 @@ describe "JRuby native launcher" do
235
240
  after { FileUtils.rm_rf jruby_home }
236
241
 
237
242
  it "should add jruby.jar to the bootclasspath" do
243
+ # Java 9+ do not like bootclasspath so we do not use it
244
+ skip if ENV_JAVA['java.specification.version'].to_i >= 9
245
+
238
246
  with_environment "JRUBY_HOME" => jruby_home do
239
247
  jruby_launcher_args("").should include("-Xbootclasspath/a:#{jruby_home}/lib/jruby.jar")
240
248
  end
@@ -255,4 +263,26 @@ describe "JRuby native launcher" do
255
263
  it "should not crash on format-strings" do
256
264
  jruby_launcher_args("-e %s%s%s%s%s 2>&1").should include('-e', '%s%s%s%s%s')
257
265
  end
266
+
267
+ it "should use --module-path on java9+ jruby 9.2.1+" do
268
+ # versions prior to 9.2.1 do not set a predictable module name
269
+ skip unless (JRUBY_VERSION.split('.') <=> ['9', '2', '1']) >= 0
270
+
271
+ Dir.mktmpdir do |java_home|
272
+ FileUtils.mkdir_p(File.join(java_home, 'lib/modules'))
273
+ with_environment 'JAVA_HOME' => java_home do
274
+ jruby_launcher_args('').grep(/^--module-path=.*jruby.jar/).should_not be_empty
275
+ end
276
+ end
277
+ end
278
+
279
+ it "should not treat CLASSPATH entries as modules on java9+" do
280
+ Dir.mktmpdir do |java_home|
281
+ Dir.mkdir(File.join(java_home, 'jmods'))
282
+ with_environment 'JAVA_HOME' => java_home, 'CLASSPATH' => '/some/lib.jar' do
283
+ jruby_launcher_args('').grep(/^--module-path=.*\/some\/lib.jar/).should be_empty
284
+ classpath_arg(jruby_launcher_args('')).should =~ /\/some\/lib.jar/
285
+ end
286
+ end
287
+ end
258
288
  end
data/spec/spec_helper.rb CHANGED
@@ -2,11 +2,6 @@ require 'rspec'
2
2
  require 'rbconfig'
3
3
  require 'fileutils'
4
4
 
5
- if defined?(JRUBY_VERSION)
6
- require 'jruby'
7
- JRuby.runtime.instance_config.run_ruby_in_process = false
8
- end
9
-
10
5
  module JRubyLauncherHelper
11
6
  JRUBY_EXE = ''
12
7
  WINDOWS = RbConfig::CONFIG['target_os'] =~ /mswin/
data/unixlauncher.cpp CHANGED
@@ -46,6 +46,9 @@ int UnixLauncher::run(int argc, char* argv[], char* envp[]) {
46
46
 
47
47
  if (getenv("JAVACMD") != NULL) {
48
48
  java = getenv("JAVACMD");
49
+ if (java.find_last_of('/') == -1) {
50
+ java = findOnPath(java.c_str());
51
+ }
49
52
  } else {
50
53
  if (!jdkhome.empty()) {
51
54
  java = jdkhome + "/bin/java";
@@ -64,6 +67,13 @@ int UnixLauncher::run(int argc, char* argv[], char* envp[]) {
64
67
  return 255;
65
68
  }
66
69
 
70
+ // still no jdk home, use java command to resolve it
71
+ if (jdkhome.empty()) {
72
+ java = resolveSymlinks(java);
73
+ int home_index = java.find_last_of('/', java.find_last_of('/') - 1);
74
+ jdkhome = java.substr(0, home_index);
75
+ }
76
+
67
77
  prepareOptions();
68
78
 
69
79
  list<string> commandLine;
data/utilsfuncs.cpp CHANGED
@@ -54,6 +54,7 @@
54
54
  #include <unistd.h>
55
55
  #include "utilsfuncs.h"
56
56
  #include "argnames.h"
57
+ #include <limits.h>
57
58
 
58
59
  #ifndef WIN32
59
60
  #include <sys/stat.h>
@@ -123,7 +124,6 @@ string findOnPath(const char* name) {
123
124
  string path(getenv("PATH"));
124
125
  size_t start = 0;
125
126
  size_t sep;
126
- char * found;
127
127
 
128
128
  while (start < path.length()) {
129
129
  sep = path.find(PATH_SEP, start);
@@ -147,6 +147,18 @@ string findOnPath(const char* name) {
147
147
  return "";
148
148
  }
149
149
 
150
+ string resolveSymlinks(string path) {
151
+ struct stat st;
152
+ char tmp[PATH_MAX + 1];
153
+
154
+ if (lstat(path.c_str(), &st) && st.st_mode & S_IFLNK) {
155
+ realpath(path.c_str(), tmp);
156
+ path = tmp;
157
+ }
158
+
159
+ return path;
160
+ }
161
+
150
162
  const char* getSysError(char *str, int strSize) {
151
163
  #ifdef WIN32
152
164
  int err = GetLastError();