jruby-launcher 1.0-java → 1.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,22 +6,37 @@ Spec::Rake::SpecTask.new
6
6
 
7
7
  task :default => :spec
8
8
 
9
- load './lib/jruby-launcher.rb'
9
+ file './lib/jruby-launcher.rb' => 'version.h' do |t|
10
+ version = nil
11
+ IO.readlines(t.prerequisites.first).grep(/LAUNCHER_VERSION\s+"([^"]+)"/) {|l| version = $1 }
12
+ ruby = IO.readlines(t.name)
13
+ File.open(t.name, "wb") do |f|
14
+ ruby.each do |l|
15
+ f << l.sub(/VERSION\s*=\s*"([^"]*)"/, "VERSION = \"#{version}\"")
16
+ end
17
+ end
18
+ end
10
19
 
11
- gemspec = Gem::Specification.new do |s|
12
- s.name = %q{jruby-launcher}
13
- s.platform = Gem::Platform.new("java")
14
- s.version = JRubyLauncher::VERSION
15
- s.authors = ["Nick Sieger", "Vladimir Sizikov"]
16
- s.date = Date.today.to_s
17
- s.description = %q{Builds and installs a native launcher for JRuby on your system}
18
- s.summary = %q{Native launcher for JRuby}
19
- s.email = ["nick@nicksieger.com", "vsizikov@gmail.com"]
20
- s.extensions = ["extconf.rb"]
21
- s.files = FileList["COPYING", "README.txt", "Makefile", "Rakefile", "*.c", "*.cpp", "*.h", "inc/*.*", "**/*.rb", "resources/*.*"]
22
- s.homepage = %q{http://jruby.org}
23
- s.rubyforge_project = %q{jruby-extras}
20
+ task :gemspec => './lib/jruby-launcher.rb' do
21
+ @gemspec ||= Gem::Specification.new do |s|
22
+ load './lib/jruby-launcher.rb'
23
+ s.name = %q{jruby-launcher}
24
+ s.platform = Gem::Platform.new("java")
25
+ s.version = JRubyLauncher::VERSION
26
+ s.authors = ["Nick Sieger", "Vladimir Sizikov"]
27
+ s.date = Date.today.to_s
28
+ s.description = %q{Builds and installs a native launcher for JRuby on your system}
29
+ s.summary = %q{Native launcher for JRuby}
30
+ s.email = ["nick@nicksieger.com", "vsizikov@gmail.com"]
31
+ s.extensions = ["extconf.rb"]
32
+ s.files = FileList["COPYING", "README.txt", "Makefile", "Rakefile", "*.c", "*.cpp", "*.h", "inc/*.*", "**/*.rb", "resources/*.*"]
33
+ s.homepage = %q{http://jruby.org}
34
+ s.rubyforge_project = %q{jruby-extras}
35
+ end
24
36
  end
25
37
 
26
- Rake::GemPackageTask.new(gemspec) do |pkg|
38
+ task :package => :gemspec do
39
+ Rake::GemPackageTask.new(@gemspec) do |pkg|
40
+ end
41
+ Rake::Task['gem'].invoke
27
42
  end
data/argnames.h CHANGED
@@ -1,8 +1,5 @@
1
1
  /*
2
- * File: argnames.h
3
- * Author: Holy
4
- *
5
- * Created on 4. prosinec 2008, 14:13
2
+ * Copyright 2009-2010 JRuby Team (www.jruby.org).
6
3
  */
7
4
 
8
5
  #ifndef _ARGNAMES_H
@@ -22,6 +19,7 @@
22
19
  #define ARG_NAME_CP_PREPEND "-Xcp:p"
23
20
  #define ARG_NAME_CP_APPEND "-Xcp:a"
24
21
  #define ARG_NAME_CMD_ONLY "-Xcommand"
22
+ #define ARG_NAME_NO_BOOTCLASSPATH "-Xnobootclasspath"
25
23
 
26
24
  /* Below are standard JRuby args handled by the launcher. */
27
25
  #define ARG_NAME_SERVER "--server"
data/argparser.cpp CHANGED
@@ -8,6 +8,7 @@
8
8
  #include "utilsfuncs.h"
9
9
  #include "argparser.h"
10
10
  #include "argnames.h"
11
+ #include "version.h"
11
12
 
12
13
  #ifndef WIN32
13
14
  #include <sys/types.h>
@@ -21,24 +22,26 @@
21
22
  using namespace std;
22
23
 
23
24
  const char *ArgParser::HELP_MSG =
24
- "\nJRuby Launcher usage: jruby" EXEEXT " {options} arguments\n\
25
+ "JRuby Launcher usage: jruby" EXEEXT " {options} arguments\n\n\
25
26
  Options:\n\
26
27
  -Xhelp show this help\n\
27
- -Xjdkhome <path> path to JDK\n\
28
+ -Xversion print launcher's version\n\
29
+ \nJvm Management:\n\
30
+ -Xjdkhome <path> set path to JDK\n\
31
+ -Xfork-java run java in separate process\n\
28
32
  -J<jvm_option> pass <jvm_option> to JVM\n\
29
- \n\
33
+ \nClasspath Management:\n\
30
34
  -Xcp <classpath> set the classpath\n\
31
35
  -Xcp:p <classpath> prepend <classpath> to classpath\n\
32
36
  -Xcp:a <classpath> append <classpath> to classpath\n\
33
- \n\
34
- -Xfork-java run java in separate process\n\
37
+ -Xnobootclasspath don't put jruby jars on the bootclasspath\n\
38
+ \nMisc:\n\
35
39
  -Xtrace <path> path for launcher log (for troubleshooting)\n\
36
40
  -Xcommand just print the equivalent java command and exit\n"
37
41
  #ifdef WIN32
38
42
  " -Xconsole <mode> jrubyw console attach mode (new|attach|suppress)\n\n"
39
43
  #endif
40
- "To see general JRuby options, type 'jruby -h' or 'jruby --help'.\n\
41
- --------------------------------------------------------------------\n\n";
44
+ "To see general JRuby options, type 'jruby -h' or 'jruby --help'.\n";
42
45
 
43
46
  const char *ArgParser::REQ_JAVA_VERSION = "1.5";
44
47
 
@@ -58,7 +61,7 @@ const char *ArgParser::DEFAULT_EXECUTABLE = "jruby";
58
61
  ArgParser::ArgParser()
59
62
  : separateProcess(false)
60
63
  , nailgunClient(false)
61
- , nailgunServer(false)
64
+ , noBootClassPath(false)
62
65
  , printCommandLine(false)
63
66
  {
64
67
  }
@@ -242,6 +245,8 @@ bool ArgParser::parseArgs(int argc, char *argv[]) {
242
245
  logMsg("Run Java in separater process");
243
246
  } else if (it->compare(ARG_NAME_CMD_ONLY) == 0) {
244
247
  printCommandLine = true;
248
+ } else if (it->compare(ARG_NAME_NO_BOOTCLASSPATH) == 0) {
249
+ noBootClassPath = true;
245
250
  } else if (it->compare(ARG_NAME_LAUNCHER_LOG) == 0) {
246
251
  // We only check the validity of args here,
247
252
  // the actual parsing and setting the log file
@@ -294,21 +299,31 @@ bool ArgParser::parseArgs(int argc, char *argv[]) {
294
299
  javaOptions.push_front("-Dprofile.properties=" + platformDir + "/lib/profile-" + filterType + ".properties");
295
300
  javaOptions.push_front("-javaagent:" + platformDir + "/lib/profile.jar");
296
301
  progArgs.push_back("-X+C");
302
+ noBootClassPath = true;
297
303
  printToConsole("Running with instrumented profiler\n");
298
304
  } else if (it->compare(ARG_NAME_NG) == 0) {
299
305
  nailgunClient = true;
300
306
  } else if (it->compare(ARG_NAME_NG_SERVER) == 0) {
301
307
  bootclass = "com/martiansoftware/nailgun/NGServer";
302
308
  javaOptions.push_back("-server");
303
- nailgunServer = true;
309
+ noBootClassPath = true;
304
310
  } else if (it->compare(0, 2, "-J", 2) == 0) {
305
- javaOptions.push_back(it->substr(2));
311
+ std::string javaOpt = it->substr(2);
312
+ if (javaOpt.compare(0, 3, "-ea", 3) == 0
313
+ || javaOpt.compare(0, 17, "-enableassertions", 17) == 0) {
314
+ logMsg("Note: -ea option is specified, there will be no bootclasspath in order to enable assertions");
315
+ noBootClassPath = true;
316
+ }
317
+ javaOptions.push_back(javaOpt);
306
318
  } else if (strcmp(it->c_str(), "-Xhelp") == 0) {
307
319
  printToConsole(HELP_MSG);
308
320
  if (!appendHelp.empty()) {
309
321
  printToConsole(appendHelp.c_str());
310
322
  }
311
323
  return false;
324
+ } else if (strcmp(it->c_str(), "-Xversion") == 0) {
325
+ printToConsole("JRuby Launcher Version " JRUBY_LAUNCHER_VERSION "\n");
326
+ return false;
312
327
  } else {
313
328
  progArgs.push_back(*it);
314
329
  }
@@ -467,6 +482,11 @@ void ArgParser::constructClassPath() {
467
482
  classPath += cpAfter;
468
483
  }
469
484
 
485
+ // JRUBY-4709: Include this by default to have PWD as part of classpath
486
+ if (!classPath.empty()) {
487
+ classPath += PATH_SEP;
488
+ }
489
+
470
490
  logMsg("ClassPath: %s", classPath.c_str());
471
491
  }
472
492
 
@@ -533,8 +553,8 @@ void ArgParser::addToClassPath(const char *path, bool onlyIfExists) {
533
553
  void ArgParser::addToBootClassPath(const char *path, bool onlyIfExists) {
534
554
  logMsg("addToBootClassPath()\n\tpath: %s\n\tonlyIfExists: %s", path, onlyIfExists ? "true" : "false");
535
555
 
536
- if (nailgunServer) {
537
- logMsg("NOTE: In 'ng-server' mode there is no bootclasspath, adding to classpath...");
556
+ if (noBootClassPath) {
557
+ logMsg("NOTE: In this mode there is no bootclasspath, adding to the classpath instead...");
538
558
  return addToClassPath(path, onlyIfExists);
539
559
  }
540
560
 
data/argparser.h CHANGED
@@ -54,7 +54,7 @@ protected:
54
54
  protected:
55
55
  bool separateProcess;
56
56
  bool nailgunClient;
57
- bool nailgunServer;
57
+ bool noBootClassPath;
58
58
  bool printCommandLine;
59
59
  std::string platformDir;
60
60
  std::string bootclass;
@@ -1,3 +1,3 @@
1
1
  module JRubyLauncher
2
- VERSION = "1.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/resources/jruby.rc CHANGED
@@ -12,7 +12,7 @@ BEGIN
12
12
  VALUE "FileDescription", "Windows JRuby Launcher\0"
13
13
  VALUE "FileVersion", "1.0\0"
14
14
  VALUE "InternalName", "jruby.exe\0"
15
- VALUE "LegalCopyright", "Copyright (C) The JRuby Team\0"
15
+ VALUE "LegalCopyright", "Copyright 2009-2010 JRuby Team\0"
16
16
  VALUE "OriginalFilename", "jruby.exe\0"
17
17
  VALUE "ProductName", "JRuby\0"
18
18
  VALUE "ProductVersion", "1.0\0"
@@ -1,5 +1,4 @@
1
1
  require File.expand_path('../spec_helper.rb', __FILE__)
2
- require 'rbconfig'
3
2
 
4
3
  describe "JRuby native launcher" do
5
4
  it "should run org.jruby.Main" do
@@ -148,4 +147,26 @@ describe "JRuby native launcher" do
148
147
  jruby_launcher("-Xtrace '' 2>&1").should =~ /-Xtrace/
149
148
  jruby_launcher("-Xjdkhome '' 2>&1").should =~ /-Xjdkhome/
150
149
  end
150
+
151
+ # JRUBY-4706
152
+ it "should put JRuby on regular classpath when -Xnobootclasspath is used" do
153
+ args = jruby_launcher_args("-e true")
154
+ args.grep(/Xbootclasspath/).should_not be_empty
155
+ args = jruby_launcher_args("-Xnobootclasspath -e true")
156
+ args.grep(/Xbootclasspath/).should be_empty
157
+ end
158
+
159
+ # JRUBY-4709
160
+ it "should include a bare : or ; at the end of the classpath, to include PWD in the path" do
161
+ jruby_launcher_args("-Xnobootclasspath -e true").grep(/java\.class\.path/).first.should =~
162
+ if windows?
163
+ /;$/
164
+ else
165
+ /:$/
166
+ end
167
+ end
168
+
169
+ it "should print the version" do
170
+ jruby_launcher("-Xversion 2>&1").should =~ /Launcher Version [0-9.]+/
171
+ end
151
172
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'spec'
2
2
  require 'rbconfig'
3
+ require 'fileutils'
3
4
 
4
5
  if defined?(JRUBY_VERSION)
5
6
  require 'jruby'
@@ -7,13 +8,25 @@ if defined?(JRUBY_VERSION)
7
8
  end
8
9
 
9
10
  module JRubyLauncherHelper
10
- JRUBY_EXE = File.expand_path("../../jruby", __FILE__) + Config::CONFIG['EXEEXT']
11
+ JRUBY_EXE = ''
11
12
  WINDOWS = Config::CONFIG['target_os'] =~ /mswin/
12
13
 
13
14
  def self.check_executable_built
14
- unless File.executable?(JRUBY_EXE)
15
+ exe = File.expand_path("../../jruby", __FILE__) + Config::CONFIG['EXEEXT']
16
+ unless File.executable?(exe)
15
17
  raise "Error: launcher executable not built; type `make' before continuing."
16
18
  end
19
+ top = File.dirname(exe)
20
+ name = File.basename(exe)
21
+ home = File.join(top, "build/home")
22
+ FileUtils.mkdir_p(File.join(home, "bin"))
23
+ FileUtils.cp(exe, File.join(home, "bin"))
24
+ if JRubyLauncherHelper::WINDOWS
25
+ FileUtils.cp(exe.sub(/exe/, 'dll'), File.join(home, "bin"))
26
+ end
27
+ FileUtils.mkdir_p(File.join(home, "lib"))
28
+ FileUtils.touch(File.join(home, "lib/jruby.jar"))
29
+ JRUBY_EXE.concat File.join(home, "bin", name)
17
30
  end
18
31
 
19
32
  def jruby_launcher(args)
data/utilsfuncs.cpp CHANGED
@@ -184,7 +184,7 @@ void logV(bool appendSysError, bool showMsgBox, const char *format, va_list args
184
184
  strncat(msg, sysErr, 4096 - strlen(msg));
185
185
  }
186
186
 
187
- if (!gLogFileName.empty()) {
187
+ if (!gLogFileName.empty() && gLogFileName != "''") {
188
188
  FILE *file = fopen(gLogFileName.c_str(), "a");
189
189
  if (file) {
190
190
  fprintf(file, "%s\n", msg);
data/version.h ADDED
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Copyright 2009-2010 JRuby Team (www.jruby.org).
3
+ */
4
+
5
+
6
+ #ifndef _VERSION_H_
7
+ #define _VERSION_H_
8
+
9
+ #define JRUBY_LAUNCHER_VERSION "1.0.1"
10
+
11
+ #endif // ! _VERSION_H_
metadata CHANGED
@@ -3,64 +3,66 @@ name: jruby-launcher
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
- - 1
7
- - 0
8
- version: "1.0"
6
+ - 1
7
+ - 0
8
+ - 1
9
+ version: 1.0.1
9
10
  platform: java
10
11
  authors:
11
- - Nick Sieger
12
- - Vladimir Sizikov
12
+ - Nick Sieger
13
+ - Vladimir Sizikov
13
14
  autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-04-07 00:00:00 -05:00
18
+ date: 2010-04-13 00:00:00 -05:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
21
22
  description: Builds and installs a native launcher for JRuby on your system
22
23
  email:
23
- - nick@nicksieger.com
24
- - vsizikov@gmail.com
24
+ - nick@nicksieger.com
25
+ - vsizikov@gmail.com
25
26
  executables: []
26
27
 
27
28
  extensions:
28
- - extconf.rb
29
+ - extconf.rb
29
30
  extra_rdoc_files: []
30
31
 
31
32
  files:
32
- - COPYING
33
- - README.txt
34
- - Makefile
35
- - Rakefile
36
- - ng.c
37
- - strlcpy.c
38
- - argparser.cpp
39
- - jruby.cpp
40
- - jrubyexe.cpp
41
- - jvmlauncher.cpp
42
- - platformlauncher.cpp
43
- - unixlauncher.cpp
44
- - utilsfuncs.cpp
45
- - utilsfuncswin.cpp
46
- - argnames.h
47
- - argparser.h
48
- - jvmlauncher.h
49
- - nbexecloader.h
50
- - platformlauncher.h
51
- - rb_w32_cmdvector.h
52
- - unixlauncher.h
53
- - utilsfuncs.h
54
- - inc/Makefile-conf.mk
55
- - inc/Makefile-impl.mk
56
- - inc/Makefile-rules.mk
57
- - extconf.rb
58
- - lib/jruby-launcher.rb
59
- - lib/rubygems/defaults/jruby_native.rb
60
- - spec/launcher_spec.rb
61
- - spec/spec_helper.rb
62
- - resources/jruby.ico
63
- - resources/jruby.rc
33
+ - COPYING
34
+ - README.txt
35
+ - Makefile
36
+ - Rakefile
37
+ - ng.c
38
+ - strlcpy.c
39
+ - argparser.cpp
40
+ - jruby.cpp
41
+ - jrubyexe.cpp
42
+ - jvmlauncher.cpp
43
+ - platformlauncher.cpp
44
+ - unixlauncher.cpp
45
+ - utilsfuncs.cpp
46
+ - utilsfuncswin.cpp
47
+ - argnames.h
48
+ - argparser.h
49
+ - jvmlauncher.h
50
+ - nbexecloader.h
51
+ - platformlauncher.h
52
+ - rb_w32_cmdvector.h
53
+ - unixlauncher.h
54
+ - utilsfuncs.h
55
+ - version.h
56
+ - inc/Makefile-conf.mk
57
+ - inc/Makefile-impl.mk
58
+ - inc/Makefile-rules.mk
59
+ - extconf.rb
60
+ - lib/jruby-launcher.rb
61
+ - lib/rubygems/defaults/jruby_native.rb
62
+ - spec/launcher_spec.rb
63
+ - spec/spec_helper.rb
64
+ - resources/jruby.ico
65
+ - resources/jruby.rc
64
66
  has_rdoc: true
65
67
  homepage: http://jruby.org
66
68
  licenses: []
@@ -69,21 +71,21 @@ post_install_message:
69
71
  rdoc_options: []
70
72
 
71
73
  require_paths:
72
- - lib
74
+ - lib
73
75
  required_ruby_version: !ruby/object:Gem::Requirement
74
76
  requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- segments:
78
- - 0
79
- version: "0"
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ segments:
80
+ - 0
81
+ version: "0"
80
82
  required_rubygems_version: !ruby/object:Gem::Requirement
81
83
  requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- segments:
85
- - 0
86
- version: "0"
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ segments:
87
+ - 0
88
+ version: "0"
87
89
  requirements: []
88
90
 
89
91
  rubyforge_project: jruby-extras