debugging exclude hot load
This commit is contained in:
parent
75f1aacb8b
commit
30f61eb47c
@ -7,15 +7,18 @@ import pub.doric.DoricNativeDriver;
|
|||||||
public class DoricContextDebuggable {
|
public class DoricContextDebuggable {
|
||||||
private DoricContext doricContext;
|
private DoricContext doricContext;
|
||||||
private DoricDebugDriver doricDebugDriver;
|
private DoricDebugDriver doricDebugDriver;
|
||||||
|
public boolean isDebugging = false;
|
||||||
|
|
||||||
public DoricContextDebuggable(String contextId) {
|
public DoricContextDebuggable(String contextId) {
|
||||||
this.doricContext = DoricContextManager.getContext(contextId);
|
this.doricContext = DoricContextManager.getContext(contextId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startDebug() {
|
public void startDebug() {
|
||||||
|
|
||||||
doricDebugDriver = new DoricDebugDriver(new IStatusCallback() {
|
doricDebugDriver = new DoricDebugDriver(new IStatusCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
|
isDebugging = true;
|
||||||
doricContext.setDriver(doricDebugDriver);
|
doricContext.setDriver(doricDebugDriver);
|
||||||
doricContext.reInit();
|
doricContext.reInit();
|
||||||
}
|
}
|
||||||
@ -23,8 +26,13 @@ public class DoricContextDebuggable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void stopDebug() {
|
public void stopDebug() {
|
||||||
|
isDebugging = false;
|
||||||
doricDebugDriver.destroy();
|
doricDebugDriver.destroy();
|
||||||
doricContext.setDriver(DoricNativeDriver.getInstance());
|
doricContext.setDriver(DoricNativeDriver.getInstance());
|
||||||
doricContext.reInit();
|
doricContext.reInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DoricContext getContext() {
|
||||||
|
return doricContext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,9 +85,13 @@ public class DemoDebugActivity extends DoricActivity {
|
|||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onReloadEvent(ReloadEvent reloadEvent) {
|
public void onReloadEvent(ReloadEvent reloadEvent) {
|
||||||
for (DoricContext context : DoricContextManager.aliveContexts()) {
|
if (doricContextDebuggable != null && doricContextDebuggable.isDebugging) {
|
||||||
if (reloadEvent.source.contains(context.getSource())) {
|
System.out.println("is debugging");
|
||||||
context.reload(reloadEvent.script);
|
} else {
|
||||||
|
for (DoricContext context : DoricContextManager.aliveContexts()) {
|
||||||
|
if (reloadEvent.source.contains(context.getSource())) {
|
||||||
|
context.reload(reloadEvent.script);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user