From 30f61eb47cb24ae21b8e8a105834fdbf84083228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Tue, 10 Dec 2019 20:55:31 +0800 Subject: [PATCH] debugging exclude hot load --- .../java/pub/doric/devkit/DoricContextDebuggable.java | 8 ++++++++ .../java/pub/doric/devkit/ui/DemoDebugActivity.java | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/devkit/src/main/java/pub/doric/devkit/DoricContextDebuggable.java b/devkit/src/main/java/pub/doric/devkit/DoricContextDebuggable.java index dca526c0..a2fccef0 100644 --- a/devkit/src/main/java/pub/doric/devkit/DoricContextDebuggable.java +++ b/devkit/src/main/java/pub/doric/devkit/DoricContextDebuggable.java @@ -7,15 +7,18 @@ import pub.doric.DoricNativeDriver; public class DoricContextDebuggable { private DoricContext doricContext; private DoricDebugDriver doricDebugDriver; + public boolean isDebugging = false; public DoricContextDebuggable(String contextId) { this.doricContext = DoricContextManager.getContext(contextId); } public void startDebug() { + doricDebugDriver = new DoricDebugDriver(new IStatusCallback() { @Override public void start() { + isDebugging = true; doricContext.setDriver(doricDebugDriver); doricContext.reInit(); } @@ -23,8 +26,13 @@ public class DoricContextDebuggable { } public void stopDebug() { + isDebugging = false; doricDebugDriver.destroy(); doricContext.setDriver(DoricNativeDriver.getInstance()); doricContext.reInit(); } + + public DoricContext getContext() { + return doricContext; + } } diff --git a/devkit/src/main/java/pub/doric/devkit/ui/DemoDebugActivity.java b/devkit/src/main/java/pub/doric/devkit/ui/DemoDebugActivity.java index 2a085654..0ee1d3ad 100644 --- a/devkit/src/main/java/pub/doric/devkit/ui/DemoDebugActivity.java +++ b/devkit/src/main/java/pub/doric/devkit/ui/DemoDebugActivity.java @@ -85,9 +85,13 @@ public class DemoDebugActivity extends DoricActivity { @Subscribe(threadMode = ThreadMode.MAIN) public void onReloadEvent(ReloadEvent reloadEvent) { - for (DoricContext context : DoricContextManager.aliveContexts()) { - if (reloadEvent.source.contains(context.getSource())) { - context.reload(reloadEvent.script); + if (doricContextDebuggable != null && doricContextDebuggable.isDebugging) { + System.out.println("is debugging"); + } else { + for (DoricContext context : DoricContextManager.aliveContexts()) { + if (reloadEvent.source.contains(context.getSource())) { + context.reload(reloadEvent.script); + } } } }