Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMOB-6187: Android: Re-enable Fastdev for V8 / Rhino #713

Merged
merged 10 commits into from
Nov 21, 2011
Merged
4 changes: 2 additions & 2 deletions android/build/common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ Common ant tasks and macros for building Android-based Titanium modules and proj
<target name="build.kroll.common.jar">
<property name="kroll.common.classes.dir" location="${dist.classes.dir}/kroll-common"/>
<mkdir dir="${kroll.common.classes.dir}"/>
<javac srcdir="${kroll.common.project.dir}/src/java" destdir="${kroll.common.classes.dir}">
<javac srcdir="${kroll.common.project.dir}/src/java" destdir="${kroll.common.classes.dir}" debug="true">
<classpath refid="android"/>
</javac>

Expand Down Expand Up @@ -475,7 +475,7 @@ Common ant tasks and macros for building Android-based Titanium modules and proj
<target name="build.kroll.v8.jar" depends="build.kroll.common.jar">
<property name="kroll.v8.classes.dir" location="${dist.classes.dir}/kroll-v8"/>
<mkdir dir="${kroll.v8.classes.dir}"/>
<javac srcdir="${kroll.v8.project.dir}/src/java" destdir="${kroll.v8.classes.dir}">
<javac srcdir="${kroll.v8.project.dir}/src/java" destdir="${kroll.v8.classes.dir}" debug="true">
<classpath refid="android"/>
<classpath>
<fileset file="${dist.dir}/kroll-common.jar"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.kroll.common.Log;
import org.appcelerator.kroll.common.TiConfig;
import org.appcelerator.kroll.util.TiTempFileHelper;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.TiBlob;
import org.appcelerator.titanium.TiFileProxy;
import org.appcelerator.titanium.io.TiBaseFile;
import org.appcelerator.titanium.io.TiFile;
import org.appcelerator.titanium.util.TiConvert;
import org.appcelerator.titanium.util.TiMimeTypeHelper;
import org.appcelerator.titanium.util.TiTempFileHelper;

import ti.modules.titanium.xml.DocumentProxy;
import ti.modules.titanium.xml.XMLModule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
package org.appcelerator.kroll;

import org.appcelerator.kroll.common.CurrentActivityListener;
import org.appcelerator.kroll.common.TiDeployData;
import org.appcelerator.kroll.util.TiTempFileHelper;

import android.app.Activity;

Expand All @@ -16,9 +18,16 @@
public interface KrollApplication
{
public int getThreadStackSize();

public Activity getCurrentActivity();

public void waitForCurrentActivity(CurrentActivityListener l);


public TiTempFileHelper getTempFileHelper();

public TiDeployData getDeployData();

public boolean isFastDevMode();

public String getAppGUID();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
package org.appcelerator.titanium;
package org.appcelerator.kroll.common;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.util.TiStreamHelper;
import org.appcelerator.kroll.util.KrollStreamHelper;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.Application;
import android.os.Environment;

/**
Expand All @@ -24,6 +24,7 @@
public class TiDeployData
{
private static final String TAG = "TiDeployData";
private static final boolean DBG = TiConfig.LOGD;

protected static final String DEBUGGER_ENABLED = "debuggerEnabled";
protected static final String DEBUGGER_PORT = "debuggerPort";
Expand All @@ -35,11 +36,11 @@ public class TiDeployData
/**
* Parses the deploy.json file if it exists
*/
public TiDeployData()
public TiDeployData(Application app)
{
TiApplication app = TiApplication.getInstance();
File extStorage = Environment.getExternalStorageDirectory();
File deployJson = new File(new File(extStorage, app.getPackageName()), "deploy.json");

if (deployJson.exists()) {
readDeployData(deployJson);
}
Expand All @@ -49,10 +50,15 @@ protected void readDeployData(File deployJson)
{
try {
FileInputStream stream = new FileInputStream(deployJson);
deployData = new JSONObject(TiStreamHelper.toString(stream));
Log.d(TAG, "Read deploy data: " + deployData.toString());
deployData = new JSONObject(KrollStreamHelper.toString(stream));

if (DBG) {
Log.d(TAG, "Read deploy data: " + deployData.toString());
}

} catch (FileNotFoundException e) {
Log.e(TAG, e.getMessage(), e);

} catch (JSONException e) {
Log.e(TAG, e.getMessage(), e);
}
Expand All @@ -63,7 +69,10 @@ protected void readDeployData(File deployJson)
*/
public boolean isDebuggerEnabled()
{
if (deployData == null) return false;
if (deployData == null) {
return false;
}

return deployData.optBoolean(DEBUGGER_ENABLED, false);
}

Expand All @@ -72,7 +81,10 @@ public boolean isDebuggerEnabled()
*/
public int getDebuggerPort()
{
if (deployData == null) return -1;
if (deployData == null) {
return -1;
}

return deployData.optInt(DEBUGGER_PORT, -1);
}

Expand All @@ -81,7 +93,10 @@ public int getDebuggerPort()
*/
public int getFastDevPort()
{
if (deployData == null) return -1;
if (deployData == null) {
return -1;
}

return deployData.optInt(FASTDEV_PORT, -1);
}

Expand All @@ -91,7 +106,10 @@ public int getFastDevPort()
*/
public boolean getFastDevListen()
{
if (deployData == null) return false;
if (deployData == null) {
return false;
}

return deployData.optBoolean(FASTDEV_LISTEN, false);
}
}