jruby-launcher 1.1.11-java → 1.1.16-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +2 -1
- data/Rakefile +1 -1
- data/argparser.cpp +21 -2
- data/argparser.h +1 -0
- data/extconf.rb +3 -4
- data/lib/jruby-launcher.rb +1 -1
- data/pkg/jruby-launcher-1.1.14-java/extconf.rb +12 -0
- data/pkg/jruby-launcher-1.1.14-java/lib/jruby-launcher.rb +3 -0
- data/pkg/jruby-launcher-1.1.14-java/lib/rubygems/defaults/jruby_native.rb +4 -0
- data/pkg/jruby-launcher-1.1.14-java/spec/launcher_spec.rb +281 -0
- data/pkg/jruby-launcher-1.1.14-java/spec/spec_helper.rb +76 -0
- data/pkg/jruby-launcher-1.1.15-java/extconf.rb +12 -0
- data/pkg/jruby-launcher-1.1.15-java/lib/jruby-launcher.rb +3 -0
- data/pkg/jruby-launcher-1.1.15-java/lib/rubygems/defaults/jruby_native.rb +4 -0
- data/pkg/jruby-launcher-1.1.15-java/pkg/jruby-launcher-1.1.14-java/extconf.rb +12 -0
- data/pkg/jruby-launcher-1.1.15-java/pkg/jruby-launcher-1.1.14-java/lib/jruby-launcher.rb +3 -0
- data/pkg/jruby-launcher-1.1.15-java/pkg/jruby-launcher-1.1.14-java/lib/rubygems/defaults/jruby_native.rb +4 -0
- data/pkg/jruby-launcher-1.1.15-java/pkg/jruby-launcher-1.1.14-java/spec/launcher_spec.rb +281 -0
- data/pkg/jruby-launcher-1.1.15-java/pkg/jruby-launcher-1.1.14-java/spec/spec_helper.rb +76 -0
- data/pkg/jruby-launcher-1.1.15-java/spec/launcher_spec.rb +288 -0
- data/pkg/jruby-launcher-1.1.15-java/spec/spec_helper.rb +76 -0
- data/platformlauncher.cpp +20 -5
- data/rb_w32_cmdvector.h +3 -3
- data/spec/launcher_spec.rb +15 -5
- data/spec/spec_helper.rb +0 -5
- data/unixlauncher.cpp +12 -0
- data/utilsfuncs.cpp +13 -1
- data/utilsfuncs.h +1 -0
- data/utilsfuncswin.cpp +20 -2
- data/version.h +1 -1
- metadata +22 -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/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
|
-
|
151
|
-
|
152
|
-
|
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
|
-
|
157
|
-
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
|
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;
|
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
|
@@ -257,9 +264,12 @@ describe "JRuby native launcher" do
|
|
257
264
|
jruby_launcher_args("-e %s%s%s%s%s 2>&1").should include('-e', '%s%s%s%s%s')
|
258
265
|
end
|
259
266
|
|
260
|
-
it "should use --module-path on java9+" do
|
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
|
+
|
261
271
|
Dir.mktmpdir do |java_home|
|
262
|
-
|
272
|
+
FileUtils.mkdir_p(File.join(java_home, 'lib/modules'))
|
263
273
|
with_environment 'JAVA_HOME' => java_home do
|
264
274
|
jruby_launcher_args('').grep(/^--module-path=.*jruby.jar/).should_not be_empty
|
265
275
|
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";
|
@@ -59,11 +62,20 @@ int UnixLauncher::run(int argc, char* argv[], char* envp[]) {
|
|
59
62
|
}
|
60
63
|
}
|
61
64
|
|
65
|
+
logMsg("UnixLauncher::run\n\tjava command found at %s\n", java.c_str());
|
66
|
+
|
62
67
|
if (java.empty()) {
|
63
68
|
printToConsole("No `java' executable found on PATH.");
|
64
69
|
return 255;
|
65
70
|
}
|
66
71
|
|
72
|
+
// still no jdk home, use java command to resolve it
|
73
|
+
if (jdkhome.empty()) {
|
74
|
+
java = resolveSymlinks(java);
|
75
|
+
int home_index = java.find_last_of('/', java.find_last_of('/') - 1);
|
76
|
+
jdkhome = java.substr(0, home_index);
|
77
|
+
}
|
78
|
+
|
67
79
|
prepareOptions();
|
68
80
|
|
69
81
|
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) == 0 && (st.st_mode & S_IFMT) == 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();
|
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/utilsfuncswin.cpp
CHANGED
@@ -39,10 +39,27 @@ bool disableFolderVirtualization(HANDLE hProcess) {
|
|
39
39
|
return true;
|
40
40
|
}
|
41
41
|
|
42
|
+
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
|
43
|
+
|
44
|
+
LPFN_ISWOW64PROCESS IsWow64Process;
|
45
|
+
|
46
|
+
BOOL is64bits() {
|
47
|
+
BOOL is64Bits = FALSE;
|
48
|
+
IsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandle(TEXT("kernel32")),"IsWow64Process");
|
49
|
+
|
50
|
+
if (IsWow64Process && !IsWow64Process(GetCurrentProcess(),&is64Bits)) {}
|
51
|
+
|
52
|
+
return is64Bits;
|
53
|
+
}
|
54
|
+
|
55
|
+
#define KEY_WOW64_64KEY 0x0100
|
56
|
+
#define KEY_WOW64_32KEY 0x0200
|
57
|
+
|
42
58
|
bool getStringFromRegistry(HKEY rootKey, const char *keyName, const char *valueName, string &value) {
|
43
59
|
logMsg("getStringFromRegistry()\n\tkeyName: %s\n\tvalueName: %s", keyName, valueName);
|
60
|
+
DWORD openFlags = KEY_READ | (is64bits() ? KEY_WOW64_64KEY : KEY_WOW64_32KEY);
|
44
61
|
HKEY hKey = 0;
|
45
|
-
if (RegOpenKeyEx(rootKey, keyName, 0,
|
62
|
+
if (RegOpenKeyEx(rootKey, keyName, 0, openFlags, &hKey) == ERROR_SUCCESS) {
|
46
63
|
DWORD valSize = 4096;
|
47
64
|
DWORD type = 0;
|
48
65
|
char val[4096] = "";
|
@@ -64,8 +81,9 @@ bool getStringFromRegistry(HKEY rootKey, const char *keyName, const char *valueN
|
|
64
81
|
|
65
82
|
bool getDwordFromRegistry(HKEY rootKey, const char *keyName, const char *valueName, DWORD &value) {
|
66
83
|
logMsg("getDwordFromRegistry()\n\tkeyName: %s\n\tvalueName: %s", keyName, valueName);
|
84
|
+
DWORD openFlags = KEY_READ | (is64bits() ? KEY_WOW64_64KEY : KEY_WOW64_32KEY);
|
67
85
|
HKEY hKey = 0;
|
68
|
-
if (RegOpenKeyEx(rootKey, keyName, 0,
|
86
|
+
if (RegOpenKeyEx(rootKey, keyName, 0, openFlags, &hKey) == ERROR_SUCCESS) {
|
69
87
|
DWORD valSize = sizeof(DWORD);
|
70
88
|
DWORD type = 0;
|
71
89
|
if (RegQueryValueEx(hKey, valueName, 0, &type, (BYTE *) &value, &valSize) == ERROR_SUCCESS
|
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.16
|
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:
|
12
|
+
date: 2021-06-03 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.14-java/extconf.rb
|
43
|
+
- pkg/jruby-launcher-1.1.14-java/lib/jruby-launcher.rb
|
44
|
+
- pkg/jruby-launcher-1.1.14-java/lib/rubygems/defaults/jruby_native.rb
|
45
|
+
- pkg/jruby-launcher-1.1.14-java/spec/launcher_spec.rb
|
46
|
+
- pkg/jruby-launcher-1.1.14-java/spec/spec_helper.rb
|
47
|
+
- pkg/jruby-launcher-1.1.15-java/extconf.rb
|
48
|
+
- pkg/jruby-launcher-1.1.15-java/lib/jruby-launcher.rb
|
49
|
+
- pkg/jruby-launcher-1.1.15-java/lib/rubygems/defaults/jruby_native.rb
|
50
|
+
- pkg/jruby-launcher-1.1.15-java/pkg/jruby-launcher-1.1.14-java/extconf.rb
|
51
|
+
- pkg/jruby-launcher-1.1.15-java/pkg/jruby-launcher-1.1.14-java/lib/jruby-launcher.rb
|
52
|
+
- pkg/jruby-launcher-1.1.15-java/pkg/jruby-launcher-1.1.14-java/lib/rubygems/defaults/jruby_native.rb
|
53
|
+
- pkg/jruby-launcher-1.1.15-java/pkg/jruby-launcher-1.1.14-java/spec/launcher_spec.rb
|
54
|
+
- pkg/jruby-launcher-1.1.15-java/pkg/jruby-launcher-1.1.14-java/spec/spec_helper.rb
|
55
|
+
- pkg/jruby-launcher-1.1.15-java/spec/launcher_spec.rb
|
56
|
+
- pkg/jruby-launcher-1.1.15-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,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
86
|
- !ruby/object:Gem::Version
|
72
87
|
version: '0'
|
73
88
|
requirements: []
|
74
|
-
rubyforge_project:
|
75
|
-
rubygems_version: 2.
|
76
|
-
signing_key:
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 2.5.2.3
|
91
|
+
signing_key:
|
77
92
|
specification_version: 4
|
78
93
|
summary: Native launcher for JRuby
|
79
94
|
test_files: []
|