Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow specifying default Ruby version as a build parameter.

  • Loading branch information...
commit b124f1f00d221e4e532d049c9f4116837b191f78 1 parent e845608
@headius headius authored
View
1  build.xml
@@ -210,6 +210,7 @@
<filter token="jruby.revision" value="${jruby.revision}"/>
<filter token="joda.time.version" value="${joda.time.version}"/>
<filter token="tzdata.version" value="@{tzdata-version}"/>
+ <filter token="jruby.default.ruby.version" value="${jruby.default.ruby.version}"/>
</filterset>
</copy>
View
1  default.build.properties
@@ -93,3 +93,4 @@ mac.dist=${build.dir}/jruby-${version.jruby}
dist.zip=${dist.dir}/jruby-bin-${version.jruby}.zip
gems.dist.dir=${build.dir}/gems_dist
gems.defaults.dir=${mac.dist}/lib/ruby/site_ruby/1.8/rubygems/defaults
+jruby.default.ruby.version=1.8
View
6 src/org/jruby/RubyInstanceConfig.java
@@ -445,8 +445,10 @@ public RubyInstanceConfig() {
setCurrentDirectory(Ruby.isSecurityRestricted() ? "/" : JRubyFile.getFileProperty("user.dir"));
samplingEnabled = SafePropertyAccessor.getBoolean("jruby.sampling.enabled", false);
- String compatString = SafePropertyAccessor.getProperty("jruby.compat.version", "RUBY1_8");
- if (compatString.equalsIgnoreCase("RUBY1_8")) {
+ String compatString = SafePropertyAccessor.getProperty("jruby.compat.version");
+ if (compatString == null) {
+ setCompatVersion(Constants.DEFAULT_RUBY_VERSION);
+ } else if (compatString.equalsIgnoreCase("RUBY1_8")) {
setCompatVersion(CompatVersion.RUBY1_8);
} else if (compatString.equalsIgnoreCase("RUBY1_9")) {
setCompatVersion(CompatVersion.RUBY1_9);
View
13 src/org/jruby/runtime/Constants.java
@@ -30,6 +30,8 @@
***** END LICENSE BLOCK *****/
package org.jruby.runtime;
+import org.jruby.CompatVersion;
+
public final class Constants {
public static final String PLATFORM = "java";
@@ -53,6 +55,8 @@
public static final String JODA_TIME_VERSION = "@joda.time.version@";
public static final String TZDATA_VERSION = "@tzdata.version@";
+
+ public static final CompatVersion DEFAULT_RUBY_VERSION;
@Deprecated
public static final String JRUBY_PROPERTIES = "/org/jruby/jruby.properties";
@@ -60,6 +64,15 @@
static {
// This is populated here to avoid javac propagating the value to consumers
REVISION = "@jruby.revision@";
+ String defaultRubyVersion = "@jruby.default.ruby.version@";
+ if (defaultRubyVersion.equals("1.8")) {
+ DEFAULT_RUBY_VERSION = CompatVersion.RUBY1_8;
+ } else if (defaultRubyVersion.equals("1.9")) {
+ DEFAULT_RUBY_VERSION = CompatVersion.RUBY1_9;
+ } else {
+ System.err.println("invalid version selected in build (\"" + defaultRubyVersion + "\"), using 1.8");
+ DEFAULT_RUBY_VERSION = CompatVersion.RUBY1_8;
+ }
}
private Constants() {}
Please sign in to comment.
Something went wrong with that request. Please try again.