Commit e61a4ea
[Xamarin.Android.Build.Tasks] improve incremental deploy in IDEs (#3555)
When doing some testing in the IDE, I noticed something odd for an
incremental deploy:
Building target "_BuildApkFastDev" completely.
Input file "obj\Debug\90\adb.props" is newer than output file "obj\Debug\90\android\bin\com.companyname.app14.apk".
This target took 2.470s in this case.
This was the Android App template in VS 2019 (not Xamarin.Forms).
I just modified a `.cs` file, how did `adb.props` change???
It turns out that during the `Build` target, `adb.props` is blank,
and during the `Install` target, it is properly set. That means that
the `Install` target is currently always running the `_BuildApkFastDev`
target on incremental deployments.
I let the IDE team know, so they can see about sending `$(AdbTarget)`
during `Build`. However, they can't do this in every case, due to the
way the UI is setup. Depending on the user's selection, current
document, focus, etc. the play button in VS may not be enabled or
even *know* the current attached device.
This leads me to think we should really change something in our
MSBuild targets, which currently does:
<WriteLinesToFile
Condition=" '$(DesignTimeBuild)' != 'True' "
File="$(_AdbPropertiesCache)"
Lines="AdbTarget=$(AdbTarget);AdbOptions=$(AdbOptions)"
Overwrite="true"
WriteOnlyWhenDifferent="true"
/>
If we didn't write this file when `$(AdbTarget)` is blank, the
problem would be avoided. However, we also should write the file if
it does not exist. If an `Input` to a target doesn't exist, it will
run every time. `adb.props` is used as `Inputs` for some targets.
I added a test for this to the `MSBuildDeviceIntegration` tests.1 parent 0eed072 commit e61a4ea
File tree
3 files changed
+51
-4
lines changed- src/Xamarin.Android.Build.Tasks
- Tests/Xamarin.Android.Build.Tests/Utilities
- tests/MSBuildDeviceIntegration/Tests
3 files changed
+51
-4
lines changedLines changed: 26 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
| 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 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1262 | 1262 | | |
1263 | 1263 | | |
1264 | 1264 | | |
1265 | | - | |
| 1265 | + | |
1266 | 1266 | | |
1267 | 1267 | | |
1268 | 1268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
301 | 324 | | |
302 | 325 | | |
0 commit comments