assets/src/org/ruboto/JRubyAdapter.java in ruboto-0.9.0 vs assets/src/org/ruboto/JRubyAdapter.java in ruboto-0.10.0.rc.0

- old
+ new

@@ -240,11 +240,11 @@ byte[] arrayForHeapAllocation = new byte[13 * 1024 * 1024]; arrayForHeapAllocation = null; // END Ruboto HeapAlloc setDebugBuild(appContext); Log.d("Setting up JRuby runtime (" + (isDebugBuild ? "DEBUG" : "RELEASE") + ")"); - System.setProperty("jruby.compile.mode", "OFF"); // OFF OFFIR JITIR? FORCEIR + System.setProperty("jruby.compile.mode", "OFF"); // OFF OFFIR JITIR? FORCE FORCEIR // System.setProperty("jruby.compile.backend", "DALVIK"); System.setProperty("jruby.bytecode.version", "1.6"); System.setProperty("jruby.interfaces.useProxy", "true"); System.setProperty("jruby.management.enabled", "false"); System.setProperty("jruby.objectspace.enabled", "false"); @@ -253,11 +253,11 @@ // System.setProperty("jruby.compat.version", "RUBY1_8"); // RUBY1_9 is the default in JRuby 1.7 System.setProperty("jruby.ir.passes", "LocalOptimizationPass,DeadCodeElimination"); System.setProperty("jruby.backtrace.style", "normal"); // normal raw full mri // Uncomment these to debug/profile Ruby source loading - System.setProperty("jruby.debug.loadService", "true"); + // System.setProperty("jruby.debug.loadService", "true"); // System.setProperty("jruby.debug.loadService.timing", "true"); // Used to enable JRuby to generate proxy classes System.setProperty("jruby.ji.proxyClassFactory", "org.ruboto.DalvikProxyClassFactory"); System.setProperty("jruby.class.cache.path", appContext.getDir("dex", 0).getAbsolutePath()); @@ -340,10 +340,11 @@ Log.i("Setting JRUBY_HOME: " + jrubyHome); System.setProperty("jruby.home", jrubyHome); addLoadPath(scriptsDirName(appContext)); + put("$package_name", appContext.getPackageName()); initialized = true; } catch (ClassNotFoundException e) { handleInitException(e); } catch (IllegalArgumentException e) { @@ -369,13 +370,11 @@ public static boolean usesPlatformApk() { return RUBOTO_CORE_VERSION_NAME != null; } - // Private methods - - private static Boolean addLoadPath(String scriptsDir) { + public static Boolean addLoadPath(String scriptsDir) { if (new File(scriptsDir).exists()) { Log.i("Added directory to load path: " + scriptsDir); Script.addDir(scriptsDir); runScriptlet("$:.unshift '" + scriptsDir + "' ; $:.uniq!"); Log.d("Changing JRuby current directory to " + scriptsDir); @@ -385,10 +384,12 @@ Log.i("Extra scripts dir not present: " + scriptsDir); return false; } } + // Private methods + @SuppressWarnings("unchecked") private static <T> T callScriptingContainerMethod(Class<T> returnType, String methodName, Object... args) { Class<?>[] argClasses = new Class[args.length]; for (int i = 0; i < argClasses.length; i++) { argClasses[i] = args[i].getClass(); @@ -493,18 +494,18 @@ } catch (NameNotFoundException e) { isDebugBuild = false; } } - private static void setLocalContextScope(String val) { + public static void setLocalContextScope(String val) { localContextScope = val; } - private static void setLocalVariableBehavior(String val) { + public static void setLocalVariableBehavior(String val) { localVariableBehavior = val; } - private static void setOutputStream(PrintStream out) { + public static void setOutputStream(PrintStream out) { if (ruby == null) { output = out; } else { try { Method setOutputMethod = ruby.getClass().getMethod("setOutput", PrintStream.class);