Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,5 @@ updates:
interval: "daily"
ignore:
- dependency-name: "external/constexpr-xxh3"
- dependency-name: "external/lz4"
- dependency-name: "external/robin-map"
- dependency-name: "external/xxHash"
3 changes: 1 addition & 2 deletions .github/skills/update-tpn/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ Read `.gitmodules` for all submodules. Current submodules and their license file
| Submodule | URL | License File |
|-----------|-----|-------------|
| Java.Interop | https://github.com/dotnet/java-interop | `external/Java.Interop/LICENSE` |
| lz4 | https://github.com/dotnet/lz4 (fork of https://github.com/lz4/lz4) | `external/lz4/lib/LICENSE` |
| xxHash | https://github.com/Cyan4973/xxHash | `external/xxHash/LICENSE` |
| constexpr-xxh3 | https://github.com/chys87/constexpr-xxh3 | `external/constexpr-xxh3/LICENSE` |
| robin-map | https://github.com/xamarin/robin-map (fork of https://github.com/Tessil/robin-map) | `external/robin-map/LICENSE` |
Expand Down Expand Up @@ -99,7 +98,7 @@ The `src/Xamarin.Android.Build.Tasks/Linker/External/` directory contains vendor
| Linker/External/ | mono/linker | https://github.com/mono/linker/ (MIT) |

#### Native Libraries (from CMakeLists.txt)
Check `src/native/` CMakeLists.txt files for references to external native code. The submodules above (lz4, xxHash, libunwind, robin-map) are compiled into native libraries.
Check `src/native/` CMakeLists.txt files for references to external native code. The submodules above (xxHash, libunwind, robin-map) are compiled into native libraries.

#### Android SDK Tools
These are downloaded and shipped with the SDK:
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
path = external/libunwind
url = https://github.com/libunwind/libunwind.git
branch = v1.8-stable
[submodule "external/lz4"]
path = external/lz4
url = https://github.com/dotnet/lz4
branch = net11.0
[submodule "external/robin-map"]
path = external/robin-map
url = https://github.com/xamarin/robin-map
Expand Down
4 changes: 0 additions & 4 deletions .lgtm.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
queries:
- exclude: cs/campaign/constantine
paths:
exclude:
# we don't ship lz4 tests
- external/lz4/tests
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# FastDeploy2
# FastDeploy

`FastDeploy2` is the fast-deployment strategy used by `Install` builds (it is the
default; the legacy strategy is still available as `FastDeploy`). Fast deployment
keeps the installed `.apk` small and avoids a full re-install on every `F5`: the
`FastDeploy` is the fast-deployment strategy used by `Install` builds. Fast
deployment keeps the installed `.apk` small and avoids a full re-install on every `F5`: the
application assemblies (and, optionally, environment files) are pushed to the
device separately and surfaced to the app through an *override directory*, so an
inner-loop change only re-transfers the files that actually changed.

This document describes how the [`FastDeploy2`][task] MSBuild task works: the
This document describes how the [`FastDeploy`][task] MSBuild task works: the
stages it runs, the `adb` commands it issues, and the properties that control it.

[task]: ../../src/Xamarin.Android.Build.Debugging.Tasks/Tasks/FastDeploy2.cs
[task]: ../../src/Xamarin.Android.Build.Debugging.Tasks/Tasks/FastDeploy.cs

## MSBuild properties

Expand All @@ -19,9 +18,8 @@ properties intended for end users are:

| Property | Default | Description |
| --- | --- | --- |
| `$(_AndroidFastDevStrategy)` | `FastDeploy2` | `FastDeploy` or `FastDeploy2`. Set to `FastDeploy` to fall back to the legacy strategy. |
| `$(_AndroidFastDeployAppFileTransferMode)` | `Symlink` (for `FastDeploy2`) | How staged files are surfaced in the override directory: `Symlink` or `Copy`. |
| `$(AndroidFastDeploymentAdbCompressionAlgorithm)` | `any` | The `adb push -z` compression algorithm. `FastDeploy2` relies on a modern Android SDK Platform-Tools `adb` for multi-file `push -z` support. |
| `$(_AndroidFastDeployAppFileTransferMode)` | `Symlink` | How staged files are surfaced in the override directory: `Symlink` or `Copy`. |
| `$(AndroidFastDeploymentAdbCompressionAlgorithm)` | `any` | The `adb push -z` compression algorithm. `FastDeploy` relies on a modern Android SDK Platform-Tools `adb` for multi-file `push -z` support. |

The following internal/unsupported properties tune or disable implementation
details:
Expand All @@ -36,31 +34,27 @@ details:

## On-device layout

* **Staging directory:** `/data/local/tmp/fastdeploy2/<package-name>/<user-id>`.
* **Staging directory:** `/data/local/tmp/fastdeploy/<package-name>/<user-id>`.
Files are pushed here first (this location is writable by `adb` without
`run-as`).
* **Override directory:** `files/.__override__` inside the application's private
data directory (resolved with `run-as`). The runtime loads assemblies from here
in preference to the ones embedded in the `.apk`.
* **Manifest markers:** a `.fastdeploy2-manifest-hash` file is written to both the
* **Manifest markers:** a `.fastdeploy-manifest-hash` file is written to both the
staging and override directories. It records the hash of the last successfully
deployed manifest so the next build can detect whether the device is already up
to date and skip redundant work.

After installing or reinstalling an APK, FastDeploy2 checks for orphaned staging
After installing or reinstalling an APK, FastDeploy checks for orphaned staging
directories. In one `adb shell` command it enumerates staged
`<package-name>/<user-id>` directories, compares them with
`pm list packages --user <user-id>`, and removes directories for packages that
are no longer installed. Incremental deployments that do not install the APK
skip cleanup entirely.

Changing `$(_AndroidFastDevStrategy)` or
`$(_AndroidFastDeployAppFileTransferMode)` invalidates the deployment
configuration. In particular, switching from `FastDeploy2` to legacy
`FastDeploy` removes the FastDeploy2-managed override tree before
`xamarin.sync` runs, so legacy deployment never attempts to overwrite
FastDeploy2 symlinks. The installed package and unrelated application data are
preserved.
Changing `$(_AndroidFastDeployAppFileTransferMode)` invalidates the deployment
configuration so the override tree is rebuilt using the selected transfer mode.
The installed package and unrelated application data are preserved.

## Stages

Expand All @@ -72,7 +66,7 @@ is passed to every subsequent command as `adb -s <id> …`.

### 2. Validate warm device state

When the APK and local FastDeploy2 manifest are current, one tagged
When the APK and local FastDeploy manifest are current, one tagged
`adb shell` probe performs the warm-path validation. It reads both compatibility
properties, the staging marker, the app-private path and override marker through
`run-as`, and the current process id. If the app is running, the same shell
Expand Down Expand Up @@ -149,7 +143,7 @@ This is the incremental core (`DeployFastDevFilesWithAdbPush`):
`{ relative-path → (size, mtime) }` forms the manifest. A single SHA256 hash
over the whole manifest is used as the device readiness marker (see below).
2. **Compare against the device.** The previous manifest is read from `obj`, and
the on-device `.fastdeploy2-manifest-hash` markers are read to confirm the
the on-device `.fastdeploy-manifest-hash` markers are read to confirm the
device still matches it. If the staging directory is not in the expected
state it is reset:
```
Expand Down Expand Up @@ -192,7 +186,7 @@ This is the incremental core (`DeployFastDevFilesWithAdbPush`):

The marker match is intentionally the fast-path filesystem contract; the task
does not probe every expected directory before each upload. If a push reports
that an expected remote path is missing or has the wrong file type, FastDeploy2
that an expected remote path is missing or has the wrong file type, FastDeploy
discards the incremental state, clears the staging and override trees, and
retries once as a full deployment. A successful retry rewrites both remote
markers and the local manifest.
Expand All @@ -206,23 +200,23 @@ diagnostics map to `XA0131`–`XA0137`. See the

## Command Compatibility

.NET for Android supports Android 7.0 (API level 24) and later. FastDeploy2's
.NET for Android supports Android 7.0 (API level 24) and later. FastDeploy's
device-side commands are available by Android 6.0 (API level 23), before the
supported device floor. The API levels below are approximate because shell
utilities are not Android SDK APIs.

Host-side `adb` commands depend on the installed Android SDK Platform-Tools
version rather than the device API level:

| Command | FastDeploy2 use | Compatibility |
| Command | FastDeploy use | Compatibility |
| --- | --- | --- |
| `adb devices`, `adb -s <device> shell ...` | Device selection and all device-side operations | Standard Platform-Tools commands |
| `adb install -r -d [-t] [--user <id>]` | APK installation and replacement | Standard Platform-Tools command; `--user` corresponds to Android multi-user support introduced in API 17 |
| `adb push -z <algorithm>` | Batched compressed staging-file upload | Modern Platform-Tools capability; not controlled by the device application API level |

FastDeploy2 uses these device-side commands and shell features:
FastDeploy uses these device-side commands and shell features:

| Command or shell feature | FastDeploy2 use | Approximate availability |
| Command or shell feature | FastDeploy use | Approximate availability |
| --- | --- | --- |
| `sh`/mksh syntax, `[ ... ]`, `test`, `command -v`, `cd`, `pwd`, `echo`, globbing, command/parameter/arithmetic expansion, and redirection | Combined checks, override updates, and cleanup control flow | API 14; Android has used mksh since Android 4.0 |
| `getprop` | Validate `run-as` compatibility properties | API 1 |
Expand Down
1 change: 0 additions & 1 deletion Microsoft.Android.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
<Project Path="src/Xamarin.Installer.AndroidSDK/Xamarin.Installer.AndroidSDK.csproj" />
<Project Path="src/Xamarin.Installer.Build.Tasks/Xamarin.Installer.Build.Tasks.csproj" />
<Project Path="src/Xamarin.Installer.Common/Xamarin.Installer.Common.csproj" />
<Project Path="tools/fastdev/fastdevtools.csproj" />
</Folder>
<Folder Name="/Tests/">
<Project Path="src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj" />
Expand Down
48 changes: 7 additions & 41 deletions THIRD-PARTY-NOTICES.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ implication, estoppel or otherwise.
15. KonradKuczynski/ELFSharp (https://elfsharp.it/)
16. libunwind/libunwind (https://github.com/libunwind/libunwind)
17. lovettchris/SgmlReader (https://github.com/lovettchris/SgmlReader/)
18. lz4/lz4 (https://github.com/lz4/lz4/)
19. MiloszKrajewski/K4os.Compression.LZ4 (https://github.com/MiloszKrajewski/K4os.Compression.LZ4/)
20. mono/cecil (https://github.com/mono/cecil/)
21. mono/linker (https://github.com/mono/linker/)
22. nih-at/libzip (https://github.com/nih-at/libzip/)
23. NuGet/NuGet.Client (https://github.com/NuGet/NuGet.Client)
24. tessil/robin-map (https://github.com/Tessil/robin-map)
25. xamarin/LibZipSharp (https://github.com/xamarin/LibZipSharp/)
18. MiloszKrajewski/K4os.Compression.LZ4 (https://github.com/MiloszKrajewski/K4os.Compression.LZ4/)
19. mono/cecil (https://github.com/mono/cecil/)
20. mono/linker (https://github.com/mono/linker/)
21. nih-at/libzip (https://github.com/nih-at/libzip/)
22. NuGet/NuGet.Client (https://github.com/NuGet/NuGet.Client)
23. tessil/robin-map (https://github.com/Tessil/robin-map)
24. xamarin/LibZipSharp (https://github.com/xamarin/LibZipSharp/)

%% Android API documentation NOTICES AND INFORMATION BEGIN HERE
================================================================
Expand Down Expand Up @@ -2281,38 +2280,6 @@ END OF libunwind/libunwind NOTICES AND INFORMATION
END OF lovettchris/SgmlReader NOTICES AND INFORMATION


%% lz4/lz4 NOTICES AND INFORMATION BEGIN HERE
=============================================
LZ4 Library
Copyright (c) 2011-2020, Yann Collet
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


=============================================
END OF lz4/lz4 NOTICES AND INFORMATION


%% MiloszKrajewski/K4os.Compression.LZ4 NOTICES AND INFORMATION BEGIN HERE
==========================================================================
MIT License
Expand Down Expand Up @@ -2520,4 +2487,3 @@ SOFTWARE.
=========================================================
END OF xamarin/LibZipSharp NOTICES AND INFORMATION


6 changes: 1 addition & 5 deletions build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
</ItemGroup>
<!-- monodroid: in-tree installer/debugging projects under src/Xamarin.Installer.*,
src/Mono.AndroidTools, src/Xamarin.AndroidTools,
src/Xamarin.Android.Build.Debugging.Tasks, and tools/fastdev. -->
and src/Xamarin.Android.Build.Debugging.Tasks. -->
<ItemGroup>
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)ICSharpCode.SharpZipLib.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)ICSharpCode.SharpZipLib.pdb" />
Expand All @@ -214,10 +214,6 @@
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Installer.Common.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Installer.Common.props" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Installer.Common.targets" />
<_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MicrosoftAndroidSdkOutDir)lib\%(Identity)\xamarin.sync')" />
<_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MicrosoftAndroidSdkOutDir)lib\%(Identity)\xamarin.find')" />
<_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MicrosoftAndroidSdkOutDir)lib\%(Identity)\xamarin.stat')" />
<_MSBuildFiles Include="@(AndroidSupportedTargetJitAbi->'$(MicrosoftAndroidSdkOutDir)lib\%(Identity)\xamarin.cp')" />
</ItemGroup>
<!-- end monodroid -->
<Target Name="ConstructInstallerItems"
Expand Down
1 change: 0 additions & 1 deletion external/lz4
Submodule lz4 deleted from 69f1e9

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,6 @@ ABI - is an acronym for Application Binary Interface.
{0} - the target name the user supplied
</comment>
</data>
<data name="XA0126_UnableToCopyFastDevTools" xml:space="preserve">
<value>Unable to copy Fast Deployment tools to '{0}/{1}' on the target device.
This device might not be compatible with Fast Deployment.
Please set the 'EmbedAssembliesIntoApk' MSBuild property to 'true' to disable Fast Deployment in the Visual Studio project property pages, or edit the project file in a text editor.</value>
<comment>The following are literal names and should not be translated:
{0} - A device path
{1} - A filename</comment>
</data>
<data name="XA0127_ErrorDeployingFile" xml:space="preserve">
<value>Error deploying '{0}' using '{1}: {2}'.
Please set the 'EmbedAssembliesIntoApk' MSBuild property to 'true' to disable Fast Deployment in the Visual Studio project property pages, or edit the project file in a text editor.</value>
<comment>The following are literal names and should not be translated:
{0} - A filename
{1} - The tool that was used to deploy the file.
{2} - The actual error that occured.</comment>
</data>
<data name="XA0128_RedirectStdioIsEnabled" xml:space="preserve">
Comment thread
jonathanpeppers marked this conversation as resolved.
Resolved
<value>The 'log.redirect-stdio' Android system property is set to 'true' on the target device or emulator.
To enable compatibility with Fast Deployment, set the property to 'false' or reboot the device or emulator to clear the value.</value>
Expand All @@ -165,10 +149,6 @@ To enable compatibility with Fast Deployment, set the property to 'false' or reb
Please set the 'EmbedAssembliesIntoApk' MSBuild property to 'true' to disable Fast Deployment in the Visual Studio project property pages, or edit the project file in a text editor.</value>
<comment>The following are literal names and should not be translated:
{0} - A filename</comment>
</data>
<data name="XA0130_FastDevNotSupported" xml:space="preserve">
<value>Sorry. Fast Deployment is only supported on devices running Android 5.0 (API level 21) or higher.
Please set the 'EmbedAssembliesIntoApk' MSBuild property to 'true' to disable Fast Deployment in the Visual Studio project property pages, or edit the project file in a text editor.</value>
</data>
<data name="XA0131_DeveloperModeNotEnabled" xml:space="preserve">
<value>The 'run-as' tool has been disabled on this device. Either enable it by activating the developer options on the device or by setting `ro.boot.disable_runas` to `false`.</value>
Expand Down
Loading
Loading