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
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ This file contains targets specific for Android application projects.

<PropertyGroup>
<!-- If Xamarin.Android.Common.Debugging.targets exists, we can rely on _Run for debugging. -->
<_RunDependsOn Condition=" '$(_XASupportsFastDev)' == 'true' ">
<_RunDependsOn Condition=" '$(_AndroidFastDeploymentSupported)' == 'true' ">
Install;
_Run;
</_RunDependsOn>
<_RunDependsOn Condition=" '$(_XASupportsFastDev)' != 'true' ">
<_RunDependsOn Condition=" '$(_AndroidFastDeploymentSupported)' != 'true' ">
Install;
StartAndroidActivity;
</_RunDependsOn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ properties that determine build ordering.
$(_MinimalSignAndroidPackageDependsOn);
</SignAndroidPackageDependsOn>
<!-- This should function similar to SignAndroidPackage inside VS plus also deploy -->
<DeployToDeviceDependsOnTargets Condition=" '$(_XASupportsFastDev)' == 'true' ">
<DeployToDeviceDependsOnTargets Condition=" '$(_AndroidFastDeploymentSupported)' == 'true' ">
$(_MinimalSignAndroidPackageDependsOn);
_Upload;
</DeployToDeviceDependsOnTargets>
<DeployToDeviceDependsOnTargets Condition=" '$(_XASupportsFastDev)' != 'true' ">
<DeployToDeviceDependsOnTargets Condition=" '$(_AndroidFastDeploymentSupported)' != 'true' ">
$(_MinimalSignAndroidPackageDependsOn);
_DeployApk;
_DeployAppBundle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<GenerateDependencyFile Condition=" '$(GenerateDependencyFile)' == '' ">false</GenerateDependencyFile>
<CopyLocalLockFileAssemblies Condition=" '$(CopyLocalLockFileAssemblies)' == '' ">false</CopyLocalLockFileAssemblies>
<ComputeNETCoreBuildOutputFiles Condition=" '$(ComputeNETCoreBuildOutputFiles)' == '' ">false</ComputeNETCoreBuildOutputFiles>
<_AndroidFastDeploymentSupported Condition=" Exists ('$(MSBuildThisFileDirectory)../tools/Xamarin.Android.Common.Debugging.targets') ">true</_AndroidFastDeploymentSupported>
<_AndroidFastDeploymentSupported Condition=" '$(_AndroidFastDeploymentSupported)' == '' ">False</_AndroidFastDeploymentSupported>

<!--
Disable @(Content) from referenced projects
See: https://github.com/dotnet/sdk/blob/955c0fc7b06e2fa34bacd076ed39f61e4fb61716/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets#L16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1207,9 +1207,9 @@ public void FastDeploymentDoesNotAddContentProvider ([Values (AndroidRuntime.Mon
EmbedAssembliesIntoApk = false,
};
proj.SetRuntime (runtime);
proj.SetProperty ("_XASupportsFastDev", "True");
proj.SetProperty ("_AndroidFastDeploymentSupported", "true");
using (var b = CreateApkBuilder ()) {
//NOTE: build will fail, due to $(_XASupportsFastDev)
//NOTE: build will fail, due to $(_AndroidFastDeploymentSupported)
b.ThrowOnBuildFailure = false;
b.Build (proj);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void XA0119 ()
AssertCommercialBuild ();

var proj = new XamarinAndroidApplicationProject ();
proj.SetProperty ("_XASupportsFastDev", "True");
proj.SetProperty ("_AndroidFastDeploymentSupported", "true");
proj.SetProperty (proj.DebugProperties, "AndroidLinkMode", "Full");
using (var b = CreateApkBuilder ()) {
b.Target = "Build"; // SignAndroidPackage would fail for OSS builds
Expand All @@ -94,7 +94,7 @@ public void XA0119AAB ()
AssertCommercialBuild ();

var proj = new XamarinAndroidApplicationProject ();
proj.SetProperty ("_XASupportsFastDev", "True");
proj.SetProperty ("_AndroidFastDeploymentSupported", "true");
proj.SetProperty ("AndroidPackageFormat", "aab");
using (var builder = CreateApkBuilder ()) {
builder.ThrowOnBuildFailure = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
<!-- Version/fx properties -->
<PropertyGroup>
<_XAMajorVersionNumber>1</_XAMajorVersionNumber>
<_XASupportsFastDev Condition=" Exists ('$(MSBuildThisFileDirectory)Xamarin.Android.Common.Debugging.targets') ">True</_XASupportsFastDev>
<_XASupportsFastDev Condition=" '$(_XASupportsFastDev)' == '' ">False</_XASupportsFastDev>
<AndroidUseInterpreter Condition=" '$(AndroidUseInterpreter)' == '' ">$(UseInterpreter)</AndroidUseInterpreter>
<AndroidUseInterpreter Condition=" '$(AndroidUseInterpreter)' == '' ">False</AndroidUseInterpreter>
<AndroidApplication Condition="'$(AndroidApplication)' == ''">false</AndroidApplication>
Expand All @@ -165,8 +163,8 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
<TargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == ''">MonoAndroid</TargetFrameworkIdentifier>
<MonoAndroidVersion>v$(_XAMajorVersionNumber).0</MonoAndroidVersion>
<AndroidUpdateResourceReferences Condition="'$(AndroidUpdateResourceReferences)' == ''">True</AndroidUpdateResourceReferences>
<EmbedAssembliesIntoApk Condition=" '$(EmbedAssembliesIntoApk)' == '' And '$(Optimize)' != 'True' And '$(_XASupportsFastDev)' == 'True' ">False</EmbedAssembliesIntoApk>
<EmbedAssembliesIntoApk Condition=" '$(_XASupportsFastDev)' == 'False' ">True</EmbedAssembliesIntoApk>
<EmbedAssembliesIntoApk Condition=" '$(EmbedAssembliesIntoApk)' == '' And '$(Optimize)' != 'True' And '$(_AndroidFastDeploymentSupported)' == 'True' ">False</EmbedAssembliesIntoApk>
<EmbedAssembliesIntoApk Condition=" '$(_AndroidFastDeploymentSupported)' == 'False' ">True</EmbedAssembliesIntoApk>
<EmbedAssembliesIntoApk Condition=" '$(EmbedAssembliesIntoApk)' == '' ">True</EmbedAssembliesIntoApk>
<AndroidPreferNativeLibrariesWithDebugSymbols Condition=" '$(AndroidPreferNativeLibrariesWithDebugSymbols)' == '' ">False</AndroidPreferNativeLibrariesWithDebugSymbols>
<AndroidSkipJavacVersionCheck Condition="'$(AndroidSkipJavacVersionCheck)' == ''">False</AndroidSkipJavacVersionCheck>
Expand Down
11 changes: 11 additions & 0 deletions tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ public void DeployToDevice (bool isRelease)
Assert.IsTrue (dotnet.Build (), "`dotnet build` should succeed");
Assert.IsTrue (dotnet.Build ("DeployToDevice"), "`dotnet build -t:DeployToDevice` should succeed");

// Verify correct targets ran based on FastDev support
if (TestEnvironment.CommercialBuildAvailable) {
dotnet.AssertTargetIsNotSkipped ("_Upload");
dotnet.AssertTargetIsSkipped ("_DeployApk", defaultIfNotUsed: true);
dotnet.AssertTargetIsSkipped ("_DeployAppBundle", defaultIfNotUsed: true);
} else {
dotnet.AssertTargetIsSkipped ("_Upload", defaultIfNotUsed: true);
dotnet.AssertTargetIsNotSkipped ("_DeployApk");
dotnet.AssertTargetIsNotSkipped ("_DeployAppBundle");
}

// Launch the app using adb
ClearAdbLogcat ();
var result = AdbStartActivity ($"{proj.PackageName}/{proj.JavaPackageName}.MainActivity");
Expand Down
Loading