Commit 558680e
ADFA-2354: Fix "permission denied" on installDebug/uninstallDebug; installDebug now installs via CoGo run tasks (#1803)
* ADFA-2354: Replace adb-backed install/uninstall task actions on device
The shipped SDK has a 0-byte platform-tools/adb stub and adb cannot run on
the device, so AGP's install<Variant>/uninstall<Variant> tasks fail with
"Exec failed, error: 13 (Permission denied)".
The IDE plugin now replaces the actions of every AGP InstallVariantTask and
UninstallTask with a lifecycle message. Main-variant install and uninstall
succeed with the message (the IDE takes over installing); *AndroidTest
variants fail with a clear message because nothing installs test APKs on
device. Task dependencies are kept, so installDebug still builds the APK.
Matched by task class rather than name so user tasks named install* are
untouched and com.android.test modules are covered. Matching on task group
does not work here: the init script applies this plugin from an afterEvaluate
registered in projectsLoaded, which runs before AGP's own afterEvaluate sets
the group.
Also fixes ADFA-2356 (uninstall permission denied).
* ADFA-2354: Install the APK through CoGo when install<Variant> is run
RunTasksDialogFragment routes any selection containing an install<Variant>
task through BuildViewModel.runTasks. After the build succeeds it picks the
app-module variant whose assembleTaskName is assemble<Variant>, reads the APK
from the output listing and emits BuildState.AwaitingInstall, so the existing
installer flow installs it. The app is not launched automatically.
Non-install selections keep going straight to the build service. The
InProgress slot claim and terminal-state reporting are shared with
runQuickBuild (claimBuildSlot, RunReporter); no behaviour change there.
Verified on device: installDebug builds, prints the plugin message, and CoGo
installs the APK; uninstallDebug prints its message and succeeds.
* style: spotless reformat MainDispatcherRule, no functional change
* ADFA-2354: Report a refused install run and test the new paths
runTasks now returns whether the build slot was claimed. When another build
is in progress the task dialog flashes the existing "build in progress"
message and stays open instead of dismissing and silently dropping the
selected install task.
Tests:
- BuildViewModelTest: runTasks is refused and reported while a build is
queued, claims the slot before its coroutine runs, and ends in a single
reported error when no build service is registered.
- InstallTaskReplacementTest (gradle-plugin, ProjectBuilder): AGP
InstallVariantTask/UninstallTask are recognised by class and their action
replaced by one message action, *AndroidTest install tasks fail with the
unsupported message, a user task named install* keeps its own actions, and
task dependencies survive the replacement.
MainDispatcherRule exposes its dispatcher so tests can advance it.
* ADFA-2354: Route only app-variant install tasks to the installer
The IDE half matched any task named install<Capital>, so :installDist or
:app:installGitHooks went through runTasks and, after a successful build,
hit "No Android application variant is assembled by ..." and a red error.
Review feedback from jatezzz and dara-abijo-adfa.
BuildViewModel now resolves an install task to an app-module variant by
assembleTaskName up front (installsAnAppVariant); the task dialog routes to
the installer only when that resolves, and the post-build lookup returns null
instead of throwing, so non-variant install tasks behave exactly as before.
The project manager is injected as a provider so this is unit-testable.
Also restores the result == null guard that runQuickBuild has for the same
executeTasks future, so a null JSON-RPC result reports the failure instead of
an NPE-turned-"unknown error".
---------
Co-authored-by: Daniel Alome <astrocoder007@gmail.com>1 parent 60e4970 commit 558680e
9 files changed
Lines changed: 395 additions & 43 deletions
File tree
- app/src
- main/java/com/itsaky/androidide
- fragments
- models
- viewmodel
- test/java/com/itsaky/androidide
- models
- viewmodel
- gradle-plugin/src
- main/java/com/itsaky/androidide/gradle
- test/java/com/itsaky/androidide/gradle
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| 75 | + | |
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
| |||
199 | 202 | | |
200 | 203 | | |
201 | 204 | | |
202 | | - | |
203 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
204 | 212 | | |
205 | 213 | | |
206 | 214 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
Lines changed: 100 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
| |||
46 | 50 | | |
47 | 51 | | |
48 | 52 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 53 | + | |
63 | 54 | | |
64 | 55 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 56 | + | |
76 | 57 | | |
77 | 58 | | |
78 | 59 | | |
79 | | - | |
| 60 | + | |
80 | 61 | | |
81 | 62 | | |
82 | 63 | | |
| |||
118 | 99 | | |
119 | 100 | | |
120 | 101 | | |
121 | | - | |
| 102 | + | |
122 | 103 | | |
123 | 104 | | |
124 | | - | |
| 105 | + | |
125 | 106 | | |
126 | 107 | | |
127 | 108 | | |
| |||
140 | 121 | | |
141 | 122 | | |
142 | 123 | | |
143 | | - | |
| 124 | + | |
144 | 125 | | |
145 | 126 | | |
146 | 127 | | |
| |||
150 | 131 | | |
151 | 132 | | |
152 | 133 | | |
153 | | - | |
| 134 | + | |
154 | 135 | | |
155 | 136 | | |
156 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
157 | 199 | | |
158 | 200 | | |
159 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
160 | 228 | | |
161 | 229 | | |
162 | 230 | | |
| |||
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments