Skip to content

Commit 080b1f3

Browse files
committed
improve debug ("ant debug")
1 parent 8550fe9 commit 080b1f3

File tree

2 files changed

+66
-10
lines changed

2 files changed

+66
-10
lines changed

tools/build-plugin.xml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,42 @@
546546
<arg value="tcp:5036" />
547547
</exec>
548548
<uploadsite src="." name="${ant.project.name}" />
549-
<launchsite src="." name="${ant.project.name}" debug="${run.debug}" />
549+
<launchsite src="." name="${ant.project.name}" />
550550
</target>
551551

552-
<target name="-set-debug">
553-
<property name="run.debug" value="true" />
552+
<target name="debug"
553+
depends="release"
554+
description="start app, upload codes, and launch debug.">
555+
<property file="${plugin_rules.basedir}\ant.properties" />
556+
<exec executable="adb" failonerror="false">
557+
<arg value="shell" />
558+
<arg value="am" />
559+
<arg value="force-stop" />
560+
<arg value="${app.package}" />
561+
</exec>
562+
<exec executable="adb" failonerror="true">
563+
<arg value="shell" />
564+
<arg value="am" />
565+
<arg value="set-debug-app" />
566+
<arg value="${app.package}" />
567+
</exec>
568+
<exec executable="adb" failonerror="true">
569+
<arg value="shell" />
570+
<arg value="am" />
571+
<arg value="start" />
572+
<arg value="-n" />
573+
<arg value="${app.loader}" />
574+
<arg value="-W" />
575+
<arg value="-D" />
576+
</exec>
577+
<exec executable="adb" failonerror="true">
578+
<arg value="forward" />
579+
<arg value="tcp:5036" />
580+
<arg value="tcp:5036" />
581+
</exec>
582+
<uploadsite src="." name="${ant.project.name}" />
583+
<launchsite src="." name="${ant.project.name}" debug="true" />
554584
</target>
555-
<target name="debug" depends="-set-debug, run" />
556585

557586
<!-- ******************************************************* -->
558587
<!-- ************************* Help ************************ -->
@@ -566,6 +595,6 @@
566595
<echo> clean: Removes output files created by other targets.</echo>
567596
<echo> release: Builds this plugin, generate apk file.</echo>
568597
<echo> run: Builds and run this plugin.</echo>
569-
<echo> debug: Builds and debug (Waiting For Debugger).</echo>
598+
<echo> debug: Builds and debug (run and attach to debugger).</echo>
570599
</target>
571600
</project>

tools/build-workspace.xml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,40 @@
4141
<arg value="tcp:5036" />
4242
</exec>
4343
<uploadworkspace src="." />
44-
<launchworkspace src="." debug="${run.debug}" />
44+
<launchworkspace src="." />
4545
</target>
4646

47-
<target name="-set-debug">
48-
<property name="run.debug" value="true" />
47+
<target name="debug" depends="release">
48+
<property file="${workspace_rules.basedir}\ant.properties" />
49+
<exec executable="adb" failonerror="false">
50+
<arg value="shell" />
51+
<arg value="am" />
52+
<arg value="force-stop" />
53+
<arg value="${app.package}" />
54+
</exec>
55+
<exec executable="adb" failonerror="true">
56+
<arg value="shell" />
57+
<arg value="am" />
58+
<arg value="set-debug-app" />
59+
<arg value="${app.package}" />
60+
</exec>
61+
<exec executable="adb" failonerror="true">
62+
<arg value="shell" />
63+
<arg value="am" />
64+
<arg value="start" />
65+
<arg value="-n" />
66+
<arg value="${app.loader}" />
67+
<arg value="-W" />
68+
<arg value="-D" />
69+
</exec>
70+
<exec executable="adb" failonerror="true">
71+
<arg value="forward" />
72+
<arg value="tcp:5036" />
73+
<arg value="tcp:5036" />
74+
</exec>
75+
<uploadworkspace src="." />
76+
<launchworkspace src="." debug="true" />
4977
</target>
50-
<target name="debug" depends="-set-debug, run" />
5178

5279
<target name="help">
5380
<!-- displays starts at col 13
@@ -57,6 +84,6 @@
5784
<echo> clean: Removes output files created by each project.</echo>
5885
<echo> release: Builds each plugin, generate apk file.</echo>
5986
<echo> run: Builds and run all plugin in this workspace.</echo>
60-
<echo> debug: Builds and debug (Waiting For Debugger).</echo>
87+
<echo> debug: Builds and debug (run and attach to debugger).</echo>
6188
</target>
6289
</project>

0 commit comments

Comments
 (0)