jruby-launcher 1.1.14-java → 1.1.19-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/jruby-launcher.rb +1 -1
- data/pkg/jruby-launcher-1.1.17-java/extconf.rb +12 -0
- data/pkg/jruby-launcher-1.1.17-java/lib/jruby-launcher.rb +3 -0
- data/pkg/jruby-launcher-1.1.17-java/lib/rubygems/defaults/jruby_native.rb +4 -0
- data/pkg/jruby-launcher-1.1.17-java/spec/launcher_spec.rb +288 -0
- data/pkg/jruby-launcher-1.1.17-java/spec/spec_helper.rb +76 -0
- data/pkg/jruby-launcher-1.1.18-java/extconf.rb +12 -0
- data/pkg/jruby-launcher-1.1.18-java/lib/jruby-launcher.rb +3 -0
- data/pkg/jruby-launcher-1.1.18-java/lib/rubygems/defaults/jruby_native.rb +4 -0
- data/pkg/jruby-launcher-1.1.18-java/pkg/jruby-launcher-1.1.17-java/extconf.rb +12 -0
- data/pkg/jruby-launcher-1.1.18-java/pkg/jruby-launcher-1.1.17-java/lib/jruby-launcher.rb +3 -0
- data/pkg/jruby-launcher-1.1.18-java/pkg/jruby-launcher-1.1.17-java/lib/rubygems/defaults/jruby_native.rb +4 -0
- data/pkg/jruby-launcher-1.1.18-java/pkg/jruby-launcher-1.1.17-java/spec/launcher_spec.rb +288 -0
- data/pkg/jruby-launcher-1.1.18-java/pkg/jruby-launcher-1.1.17-java/spec/spec_helper.rb +76 -0
- data/pkg/jruby-launcher-1.1.18-java/spec/launcher_spec.rb +288 -0
- data/pkg/jruby-launcher-1.1.18-java/spec/spec_helper.rb +76 -0
- data/spec/launcher_spec.rb +10 -3
- data/unixlauncher.cpp +30 -4
- data/utilsfuncs.cpp +14 -0
- data/utilsfuncs.h +1 -0
- data/version.h +1 -1
- metadata +21 -7
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'rbconfig'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module JRubyLauncherHelper
|
6
|
+
JRUBY_EXE = ''
|
7
|
+
WINDOWS = RbConfig::CONFIG['target_os'] =~ /mswin/
|
8
|
+
|
9
|
+
def self.check_executable_built
|
10
|
+
exe = File.expand_path("../../jruby", __FILE__) + RbConfig::CONFIG['EXEEXT']
|
11
|
+
unless File.executable?(exe)
|
12
|
+
raise "Error: launcher executable not built; type `make' before continuing."
|
13
|
+
end
|
14
|
+
top = File.dirname(exe)
|
15
|
+
name = File.basename(exe)
|
16
|
+
home = File.join(top, "build/home")
|
17
|
+
FileUtils.mkdir_p(File.join(home, "bin"))
|
18
|
+
FileUtils.cp(exe, File.join(home, "bin"))
|
19
|
+
if JRubyLauncherHelper::WINDOWS
|
20
|
+
FileUtils.cp(exe.sub(/exe/, 'dll'), File.join(home, "bin"))
|
21
|
+
end
|
22
|
+
FileUtils.mkdir_p(File.join(home, "lib"))
|
23
|
+
FileUtils.touch(File.join(home, "lib/jruby.jar"))
|
24
|
+
JRUBY_EXE.concat File.join(home, "bin", name)
|
25
|
+
end
|
26
|
+
|
27
|
+
def jruby_launcher(args)
|
28
|
+
`#{JRUBY_EXE} #{args}`
|
29
|
+
end
|
30
|
+
|
31
|
+
def jruby_launcher_args(args)
|
32
|
+
jruby_launcher("-Xcommand #{args}").split("\n")
|
33
|
+
end
|
34
|
+
|
35
|
+
def last_exit_code
|
36
|
+
$?.exitstatus
|
37
|
+
end
|
38
|
+
|
39
|
+
def windows?
|
40
|
+
WINDOWS
|
41
|
+
end
|
42
|
+
|
43
|
+
def classpath_arg(args)
|
44
|
+
index = args.index("-cp")
|
45
|
+
index.should > 0
|
46
|
+
args[index + 1]
|
47
|
+
end
|
48
|
+
|
49
|
+
def with_environment(pairs = {})
|
50
|
+
prev_env = {}
|
51
|
+
pairs.each_pair do |k,v|
|
52
|
+
prev_env[k] = ENV[k] if ENV.has_key?(k)
|
53
|
+
ENV[k] = v
|
54
|
+
end
|
55
|
+
begin
|
56
|
+
yield
|
57
|
+
ensure
|
58
|
+
pairs.keys.each {|k| ENV.delete(k)}
|
59
|
+
ENV.update(prev_env)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
RSpec.configure do |config|
|
65
|
+
config.before(:all) do
|
66
|
+
JRubyLauncherHelper.check_executable_built
|
67
|
+
# clear environment for better control
|
68
|
+
ENV.delete("JAVA_HOME")
|
69
|
+
ENV.delete("JRUBY_HOME")
|
70
|
+
ENV.delete("JAVA_OPTS")
|
71
|
+
ENV.delete("JRUBY_OPTS")
|
72
|
+
ENV.delete("CLASSPATH")
|
73
|
+
ENV.delete("JAVA_ENCODING")
|
74
|
+
end
|
75
|
+
config.include(JRubyLauncherHelper)
|
76
|
+
end
|
data/spec/launcher_spec.rb
CHANGED
@@ -21,11 +21,12 @@ describe "JRuby native launcher" do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should use $JAVACMD when JAVACMD is specified" do
|
24
|
-
|
24
|
+
javacmd_path = File.join("path", "to", "jato")
|
25
|
+
with_environment "JAVACMD" => javacmd_path do
|
25
26
|
if windows?
|
26
|
-
jruby_launcher_args("-v 2>&1").join.should =~
|
27
|
+
jruby_launcher_args("-v 2>&1").join.should =~ /#{javacmd_path}/
|
27
28
|
else
|
28
|
-
jruby_launcher_args("-v").first.should ==
|
29
|
+
jruby_launcher_args("-v").first.should == javacmd_path
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|
@@ -180,6 +181,9 @@ describe "JRuby native launcher" do
|
|
180
181
|
|
181
182
|
# JRUBY-4706
|
182
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
|
+
|
183
187
|
args = jruby_launcher_args("-e true")
|
184
188
|
args.grep(/Xbootclasspath/).should_not be_empty
|
185
189
|
args = jruby_launcher_args("-Xnobootclasspath -e true")
|
@@ -236,6 +240,9 @@ describe "JRuby native launcher" do
|
|
236
240
|
after { FileUtils.rm_rf jruby_home }
|
237
241
|
|
238
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
|
+
|
239
246
|
with_environment "JRUBY_HOME" => jruby_home do
|
240
247
|
jruby_launcher_args("").should include("-Xbootclasspath/a:#{jruby_home}/lib/jruby.jar")
|
241
248
|
end
|
data/unixlauncher.cpp
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
#include <stdio.h>
|
1
2
|
#include <stdlib.h>
|
2
3
|
#include <unistd.h>
|
4
|
+
#include <limits.h>
|
5
|
+
#include <string.h>
|
3
6
|
#include "unixlauncher.h"
|
4
7
|
#include "utilsfuncs.h"
|
5
8
|
|
@@ -46,6 +49,9 @@ int UnixLauncher::run(int argc, char* argv[], char* envp[]) {
|
|
46
49
|
|
47
50
|
if (getenv("JAVACMD") != NULL) {
|
48
51
|
java = getenv("JAVACMD");
|
52
|
+
if (java.find_last_of('/') == -1) {
|
53
|
+
java = findOnPath(java.c_str());
|
54
|
+
}
|
49
55
|
} else {
|
50
56
|
if (!jdkhome.empty()) {
|
51
57
|
java = jdkhome + "/bin/java";
|
@@ -56,10 +62,6 @@ int UnixLauncher::run(int argc, char* argv[], char* envp[]) {
|
|
56
62
|
java = java_home + "/bin/java";
|
57
63
|
} else {
|
58
64
|
java = findOnPath("java");
|
59
|
-
if (!java.empty()) {
|
60
|
-
int home_index = java.find_last_of('/', java.find_last_of('/') - 1);
|
61
|
-
jdkhome = java.substr(0, home_index);
|
62
|
-
}
|
63
65
|
}
|
64
66
|
}
|
65
67
|
|
@@ -68,6 +70,30 @@ int UnixLauncher::run(int argc, char* argv[], char* envp[]) {
|
|
68
70
|
return 255;
|
69
71
|
}
|
70
72
|
|
73
|
+
// still no jdk home, use other means to resolve it
|
74
|
+
if (jdkhome.empty()) {
|
75
|
+
char javaHomeCommand[] = "/usr/libexec/java_home";
|
76
|
+
if (access(javaHomeCommand, R_OK | X_OK) != -1 && !checkDirectory(javaHomeCommand)) {
|
77
|
+
// try java_home command when not set (on MacOS)
|
78
|
+
FILE *fp;
|
79
|
+
char tmp[PATH_MAX + 1];
|
80
|
+
|
81
|
+
fp = popen(javaHomeCommand, "r");
|
82
|
+
if (fp != NULL) {
|
83
|
+
fgets(tmp, sizeof(tmp), fp);
|
84
|
+
tmp[strcspn(tmp, "\n")] = 0;
|
85
|
+
jdkhome = tmp;
|
86
|
+
pclose(fp);
|
87
|
+
} else {
|
88
|
+
logErr(true, false, "failed to run %s", javaHomeCommand);
|
89
|
+
}
|
90
|
+
} else {
|
91
|
+
java = resolveSymlinks(java);
|
92
|
+
int home_index = java.find_last_of('/', java.find_last_of('/') - 1);
|
93
|
+
jdkhome = java.substr(0, home_index);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
71
97
|
prepareOptions();
|
72
98
|
|
73
99
|
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>
|
@@ -146,6 +147,19 @@ string findOnPath(const char* name) {
|
|
146
147
|
return "";
|
147
148
|
}
|
148
149
|
|
150
|
+
string resolveSymlinks(string path) {
|
151
|
+
#ifndef WIN32
|
152
|
+
struct stat st;
|
153
|
+
char tmp[PATH_MAX + 1];
|
154
|
+
|
155
|
+
if (lstat(path.c_str(), &st) == 0 && (st.st_mode & S_IFMT) == S_IFLNK) {
|
156
|
+
realpath(path.c_str(), tmp);
|
157
|
+
path = tmp;
|
158
|
+
}
|
159
|
+
#endif
|
160
|
+
return path;
|
161
|
+
}
|
162
|
+
|
149
163
|
const char* getSysError(char *str, int strSize) {
|
150
164
|
#ifdef WIN32
|
151
165
|
int err = GetLastError();
|
data/utilsfuncs.h
CHANGED
@@ -57,6 +57,7 @@ bool printToConsole(const char *msg);
|
|
57
57
|
char** convertToArgvArray(std::list<std::string> args);
|
58
58
|
void addToArgList(std::list<std::string> & args, int argc, char ** argv);
|
59
59
|
std::string findOnPath(const char* name);
|
60
|
+
std::string resolveSymlinks(std::string name);
|
60
61
|
bool checkDirectory(const char* path);
|
61
62
|
void printListToConsole(std::list<std::string> l);
|
62
63
|
std::string trimTrailingBackslashes(std::string orig);
|
data/version.h
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-launcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.19
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Nick Sieger
|
8
8
|
- Vladimir Sizikov
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-07-08 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Builds and installs a native launcher for JRuby on your system
|
15
15
|
email:
|
@@ -39,6 +39,21 @@ files:
|
|
39
39
|
- lib/rubygems/defaults/jruby_native.rb
|
40
40
|
- nbexecloader.h
|
41
41
|
- ng.c
|
42
|
+
- pkg/jruby-launcher-1.1.17-java/extconf.rb
|
43
|
+
- pkg/jruby-launcher-1.1.17-java/lib/jruby-launcher.rb
|
44
|
+
- pkg/jruby-launcher-1.1.17-java/lib/rubygems/defaults/jruby_native.rb
|
45
|
+
- pkg/jruby-launcher-1.1.17-java/spec/launcher_spec.rb
|
46
|
+
- pkg/jruby-launcher-1.1.17-java/spec/spec_helper.rb
|
47
|
+
- pkg/jruby-launcher-1.1.18-java/extconf.rb
|
48
|
+
- pkg/jruby-launcher-1.1.18-java/lib/jruby-launcher.rb
|
49
|
+
- pkg/jruby-launcher-1.1.18-java/lib/rubygems/defaults/jruby_native.rb
|
50
|
+
- pkg/jruby-launcher-1.1.18-java/pkg/jruby-launcher-1.1.17-java/extconf.rb
|
51
|
+
- pkg/jruby-launcher-1.1.18-java/pkg/jruby-launcher-1.1.17-java/lib/jruby-launcher.rb
|
52
|
+
- pkg/jruby-launcher-1.1.18-java/pkg/jruby-launcher-1.1.17-java/lib/rubygems/defaults/jruby_native.rb
|
53
|
+
- pkg/jruby-launcher-1.1.18-java/pkg/jruby-launcher-1.1.17-java/spec/launcher_spec.rb
|
54
|
+
- pkg/jruby-launcher-1.1.18-java/pkg/jruby-launcher-1.1.17-java/spec/spec_helper.rb
|
55
|
+
- pkg/jruby-launcher-1.1.18-java/spec/launcher_spec.rb
|
56
|
+
- pkg/jruby-launcher-1.1.18-java/spec/spec_helper.rb
|
42
57
|
- platformlauncher.cpp
|
43
58
|
- platformlauncher.h
|
44
59
|
- rb_w32_cmdvector.h
|
@@ -56,7 +71,7 @@ files:
|
|
56
71
|
homepage: http://jruby.org
|
57
72
|
licenses: []
|
58
73
|
metadata: {}
|
59
|
-
post_install_message:
|
74
|
+
post_install_message:
|
60
75
|
rdoc_options: []
|
61
76
|
require_paths:
|
62
77
|
- lib
|
@@ -71,9 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
86
|
- !ruby/object:Gem::Version
|
72
87
|
version: '0'
|
73
88
|
requirements: []
|
74
|
-
|
75
|
-
|
76
|
-
signing_key:
|
89
|
+
rubygems_version: 3.1.6
|
90
|
+
signing_key:
|
77
91
|
specification_version: 4
|
78
92
|
summary: Native launcher for JRuby
|
79
93
|
test_files: []
|