add project home build field for debugger

This commit is contained in:
王劲鹏 2019-11-12 16:34:11 +08:00
parent 261ae29042
commit 1ab3fdb3ea
3 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,7 @@
apply plugin: 'com.android.library'
def projectHome = project.rootDir.getParent() + "/demo"
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
@ -20,6 +22,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
consumerProguardFiles 'proguard-rules.pro'
}
debug {
buildConfigField "String", "PROJECT_HOME", "\"${projectHome}\""
}
}
}

View File

@ -23,6 +23,7 @@ import org.greenrobot.eventbus.ThreadMode;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import pub.doric.BuildConfig;
import pub.doric.Doric;
import pub.doric.DoricContext;
import pub.doric.DoricContextManager;
@ -30,7 +31,6 @@ import pub.doric.IDoricDriver;
import pub.doric.R;
import pub.doric.dev.event.EOFEvent;
import pub.doric.dev.event.OpenEvent;
import pub.doric.utils.DoricUtils;
public class DevPanel extends BottomSheetDialogFragment {
@ -85,6 +85,7 @@ public class DevPanel extends BottomSheetDialogFragment {
for (DoricContext doricContext : DoricContextManager.aliveContexts()) {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("contextId", doricContext.getContextId());
jsonObject.addProperty("projectHome", BuildConfig.PROJECT_HOME);
Doric.sendDevCommand(IDoricDriver.Command.DEBUG, jsonObject);
}
}

View File

@ -7,9 +7,10 @@ const createServer = () => {
console.log('text', result)
let resultObject = JSON.parse(result)
switch(resultObject.cmd) {
case 'debug':
let contextId = resultObject.contextId
case 'DEBUG':
let contextId = resultObject.data.contextId
let projectHome = resultObject.data.projectHome
console.log(projectHome)
break
}
})