jruby-launcher 1.1.18-java → 2.0.0-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.
- checksums.yaml +4 -4
- data/Makefile +1 -19
- data/Rakefile +1 -1
- data/exe/jruby.sh +990 -0
- data/inc/Makefile-conf.mk +11 -9
- data/jrubyexe.cpp +4 -5
- data/lib/jruby-launcher.rb +1 -1
- data/spec/launcher_spec.rb +1 -1
- data/unixlauncher.c +142 -0
- data/unixlauncher.h +9 -11
- data/version.h +1 -1
- metadata +5 -13
- data/lib/rubygems/defaults/jruby_native.rb +0 -4
- data/pkg/jruby-launcher-1.1.17-java/extconf.rb +0 -12
- data/pkg/jruby-launcher-1.1.17-java/lib/jruby-launcher.rb +0 -3
- data/pkg/jruby-launcher-1.1.17-java/lib/rubygems/defaults/jruby_native.rb +0 -4
- data/pkg/jruby-launcher-1.1.17-java/spec/launcher_spec.rb +0 -288
- data/pkg/jruby-launcher-1.1.17-java/spec/spec_helper.rb +0 -76
- data/unixlauncher.cpp +0 -129
@@ -1,76 +0,0 @@
|
|
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/unixlauncher.cpp
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
#include <stdlib.h>
|
2
|
-
#include <unistd.h>
|
3
|
-
#include <limits.h>
|
4
|
-
#include <string.h>
|
5
|
-
#include "unixlauncher.h"
|
6
|
-
#include "utilsfuncs.h"
|
7
|
-
|
8
|
-
using namespace std;
|
9
|
-
|
10
|
-
extern "C" int nailgunClientMain(int argc, char *argv[], char *env[]);
|
11
|
-
|
12
|
-
UnixLauncher::UnixLauncher()
|
13
|
-
: ArgParser()
|
14
|
-
{
|
15
|
-
}
|
16
|
-
|
17
|
-
UnixLauncher::UnixLauncher(const UnixLauncher& orig)
|
18
|
-
: ArgParser(orig)
|
19
|
-
{
|
20
|
-
}
|
21
|
-
|
22
|
-
UnixLauncher::~UnixLauncher() {
|
23
|
-
}
|
24
|
-
|
25
|
-
int UnixLauncher::run(int argc, char* argv[], char* envp[]) {
|
26
|
-
platformDir = argv[0];
|
27
|
-
if (!initPlatformDir() || !parseArgs(argc - 1, argv + 1)) {
|
28
|
-
return 255;
|
29
|
-
}
|
30
|
-
|
31
|
-
if (nailgunClient) {
|
32
|
-
progArgs.push_front("org.jruby.util.NailMain");
|
33
|
-
char ** nailArgv = convertToArgvArray(progArgs);
|
34
|
-
int nailArgc = progArgs.size();
|
35
|
-
|
36
|
-
if (printCommandLine) {
|
37
|
-
printListToConsole(progArgs);
|
38
|
-
for (int i = 0; i < nailArgc; i++) {
|
39
|
-
free(nailArgv[i]);
|
40
|
-
}
|
41
|
-
delete[] nailArgv;
|
42
|
-
return 0;
|
43
|
-
}
|
44
|
-
return nailgunClientMain(progArgs.size(), (char**)nailArgv, envp);
|
45
|
-
}
|
46
|
-
|
47
|
-
string java("");
|
48
|
-
|
49
|
-
if (getenv("JAVACMD") != NULL) {
|
50
|
-
java = getenv("JAVACMD");
|
51
|
-
if (java.find_last_of('/') == -1) {
|
52
|
-
java = findOnPath(java.c_str());
|
53
|
-
}
|
54
|
-
} else {
|
55
|
-
if (!jdkhome.empty()) {
|
56
|
-
java = jdkhome + "/bin/java";
|
57
|
-
} else if (getenv("JAVA_HOME") != NULL) {
|
58
|
-
string java_home = string(getenv("JAVA_HOME"));
|
59
|
-
jdkhome = java_home;
|
60
|
-
java_home = trimTrailingBackslashes(java_home);
|
61
|
-
java = java_home + "/bin/java";
|
62
|
-
} else {
|
63
|
-
java = findOnPath("java");
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
if (java.empty()) {
|
68
|
-
printToConsole("No `java' executable found on PATH.");
|
69
|
-
return 255;
|
70
|
-
}
|
71
|
-
|
72
|
-
// still no jdk home, use other means to resolve it
|
73
|
-
if (jdkhome.empty()) {
|
74
|
-
if (access("/usr/libexec/java_home", X_OK) != -1) {
|
75
|
-
// try java_home command when not set (on MacOS)
|
76
|
-
FILE *fp;
|
77
|
-
char tmp[PATH_MAX + 1];
|
78
|
-
|
79
|
-
fp = popen("/usr/libexec/java_home", "r");
|
80
|
-
if (fp != NULL) {
|
81
|
-
fgets(tmp, sizeof(tmp), fp);
|
82
|
-
tmp[strcspn(tmp, "\n")] = 0;
|
83
|
-
jdkhome = tmp;
|
84
|
-
pclose(fp);
|
85
|
-
} else {
|
86
|
-
logErr(true, false, "failed to run /usr/libexec/java_home");
|
87
|
-
}
|
88
|
-
} else {
|
89
|
-
java = resolveSymlinks(java);
|
90
|
-
int home_index = java.find_last_of('/', java.find_last_of('/') - 1);
|
91
|
-
jdkhome = java.substr(0, home_index);
|
92
|
-
}
|
93
|
-
}
|
94
|
-
|
95
|
-
prepareOptions();
|
96
|
-
|
97
|
-
list<string> commandLine;
|
98
|
-
commandLine.push_back(java);
|
99
|
-
addOptionsToCommandLine(commandLine);
|
100
|
-
|
101
|
-
logMsg("Command line:");
|
102
|
-
for (list<string>::iterator it = commandLine.begin(); it != commandLine.end(); ++it) {
|
103
|
-
logMsg("\t%s", it->c_str());
|
104
|
-
}
|
105
|
-
|
106
|
-
char** newArgv = convertToArgvArray(commandLine);
|
107
|
-
int newArgc = commandLine.size();
|
108
|
-
|
109
|
-
if (printCommandLine) {
|
110
|
-
printListToConsole(commandLine);
|
111
|
-
for (int i = 0; i < newArgc; i++) {
|
112
|
-
free(newArgv[i]);
|
113
|
-
}
|
114
|
-
delete[] newArgv;
|
115
|
-
return 0;
|
116
|
-
}
|
117
|
-
|
118
|
-
if (!fileExists(java.c_str())) {
|
119
|
-
string msg = "No `java' exists at " + java + ", please double-check JAVA_HOME.\n";
|
120
|
-
printToConsole(msg.c_str());
|
121
|
-
return 255;
|
122
|
-
}
|
123
|
-
|
124
|
-
execv(java.c_str(), newArgv);
|
125
|
-
|
126
|
-
// shouldn't get here unless something bad happened with execv
|
127
|
-
logErr(true, true, "execv failed:");
|
128
|
-
return 255;
|
129
|
-
}
|