assets/src/org/ruboto/JRubyAdapter.java in ruboto-1.3.0 vs assets/src/org/ruboto/JRubyAdapter.java in ruboto-1.3.1
- old
+ new
@@ -130,10 +130,11 @@
// BEGIN Ruboto HeapAlloc
// @SuppressWarnings("unused")
// byte[] arrayForHeapAllocation = new byte[13 * 1024 * 1024];
// arrayForHeapAllocation = null;
// END Ruboto HeapAlloc
+ Log.d("Memory allocation OK");
setDebugBuild(appContext);
Log.d("Setting up JRuby runtime (" + (isDebugBuild ? "DEBUG" : "RELEASE") + ")");
System.setProperty("jruby.backtrace.style", "normal"); // normal raw full mri
System.setProperty("jruby.bytecode.version", "1.6");
// BEGIN Ruboto RubyVersion
@@ -208,23 +209,24 @@
return false;
}
}
try {
+ String jrubyVersion = (String)
+ Class.forName("org.jruby.runtime.Constants", true,
+ scriptingContainerClass.getClassLoader())
+ .getDeclaredField("VERSION").get(String.class);
+ System.out.println("JRuby version: " + jrubyVersion);
+
//////////////////////////////////
//
// Set jruby.home
//
- String jrubyHome = "file:" + apkName + "!/jruby.home";
-
- // FIXME(uwe): Remove when we stop supporting RubotoCore 0.4.7
- Log.i("RUBOTO_CORE_VERSION_NAME: " + RUBOTO_CORE_VERSION_NAME);
- if (RUBOTO_CORE_VERSION_NAME != null &&
- (RUBOTO_CORE_VERSION_NAME.equals("0.4.7") || RUBOTO_CORE_VERSION_NAME.equals("0.4.8"))) {
- jrubyHome = "file:" + apkName + "!";
- }
+ // FIXME(uwe): Simplify when we stop support for JRuby 1.7.x
+ final String jrubyHome = (jrubyVersion.startsWith("9.0.0.0") ?
+ "jar:" : "file:") + apkName + "!/jruby.home";
// EMXIF
Log.i("Setting JRUBY_HOME: " + jrubyHome);
// This needs to be set before the ScriptingContainer is initialized
System.setProperty("jruby.home", jrubyHome);
@@ -299,15 +301,13 @@
put("$package_name", appContext.getPackageName());
runScriptlet("::RUBOTO_JAVA_PROXIES = {}");
- System.out.println("JRuby version: " + Class.forName("org.jruby.runtime.Constants", true, scriptingContainerClass.getClassLoader())
- .getDeclaredField("VERSION").get(String.class));
-
// TODO(uwe): Add a way to display startup progress.
put("$application_context", appContext.getApplicationContext());
runScriptlet("begin\n require 'environment'\nrescue LoadError => e\n puts e\nend");
+ // runScriptlet("begin\n require 'environment'\nrescue LoadError => e\n java.lang.System.out.println(e)\nend");
initialized = true;
} catch (ClassNotFoundException e) {
handleInitException(e);
} catch (IllegalArgumentException e) {