[Android] speed up development builds (#7834)

* speed up development builds android

* - remove extra property group

* - add cake descriptions

* - fix

* - remove shared runtime

* - add check for TF_Build
This commit is contained in:
Shane Neuville 2019-10-14 23:10:00 -06:00 коммит произвёл GitHub
Родитель 4658494caa
Коммит 773232214c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 34 добавлений и 48 удалений

Просмотреть файл

@ -18,18 +18,10 @@
<AndroidTargetFrameworkVersion Condition="$(AndroidTargetFrameworkVersion) == ''">v9.0</AndroidTargetFrameworkVersion>
<TargetFrameworkVersion>$(AndroidTargetFrameworkVersion)</TargetFrameworkVersion>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<AndroidSupportedAbis>armeabi-v7a,x86</AndroidSupportedAbis>
<AndroidStoreUncompressedFileExtensions />
<MandroidI18n />
<JavaOptions />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<AndroidTlsProvider>
</AndroidTlsProvider>
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<AndroidEnableMultiDex>true</AndroidEnableMultiDex>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
@ -42,38 +34,35 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;HAVE_OPENTK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>Full</AndroidLinkMode>
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
<AndroidLinkMode>None</AndroidLinkMode>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<AndroidSupportedAbis>armeabi-v7a;x86</AndroidSupportedAbis>
<Debugger>Xamarin</Debugger>
<DevInstrumentationEnabled>True</DevInstrumentationEnabled>
<NoWarn>
</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;HAVE_OPENTK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(TF_BUILD)' == 'true' OR '$(CI)' == 'true'">
<AndroidLinkMode>Full</AndroidLinkMode>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
<AndroidSupportedAbis>armeabi-v7a,x86</AndroidSupportedAbis>
<MandroidI18n />
<MonoDroidExtraArgs />
<NoWarn>
</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AndroidEnableMultiDex>true</AndroidEnableMultiDex>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
@ -396,4 +385,4 @@
</CreateItem>
<Copy SourceFiles="@(MapsKey)" DestinationFiles="Properties\MapsKey.cs" Condition="!Exists('Properties\MapsKey.cs')" />
</Target>
</Project>
</Project>

Просмотреть файл

@ -1,8 +1,10 @@
using System.Runtime.CompilerServices;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
[assembly: InternalsVisibleTo ("Xamarin.Forms.ControlGallery.Android")]
[assembly: XmlnsDefinition("http://xamarin.com/schemas/2014/forms/customurl1", "Xamarin.Forms.Controls.CustomNamespace1")]
[assembly: XmlnsDefinition("http://xamarin.com/schemas/2014/forms/customurl1", "Xamarin.Forms.Controls.CustomNamespace2")]
[assembly: XmlnsDefinition("http://xamarin.com/schemas/2014/forms/customurl2", "Xamarin.Forms.Controls.CustomNamespace3")]
[assembly: Preserve]

Просмотреть файл

@ -62,7 +62,7 @@ jobs:
displayName: Build Windows Phase
vmImage: $(winVmImage)
targetFolder: Xamarin.Forms.ControlGallery.Android/legacyRenderers/
msbuildExtraArguments: '/nowarn:VSX1000 /p:CreateAllAndroidTargets=true /bl:$(Build.ArtifactStagingDirectory)\win.binlog'
msbuildExtraArguments: '/nowarn:VSX1000 /p:CreateAllAndroidTargets=true'
buildConfiguration: $(DefaultBuildConfiguration)
buildPlatform: $(DefaultBuildPlatform)
provisionatorPath : 'build/provisioning/provisioning.csx'

Просмотреть файл

@ -50,9 +50,9 @@ string monoMajorVersion = "5.18.1";
string monoPatchVersion = "28";
string monoVersion = $"{monoMajorVersion}.{monoPatchVersion}";
string monoSDK_windows = $"https://download.mono-project.com/archive/{monoMajorVersion}/windows-installer/mono-{monoVersion}-x64-0.msi";
string androidSDK_windows = "https://aka.ms/xamarin-android-commercial-d15-9-windows";
string iOSSDK_windows = "https://download.visualstudio.microsoft.com/download/pr/71f33151-5db4-49cc-ac70-ba835a9f81e2/d256c6c50cd80ec0207783c5c7a4bc2f/xamarin.visualstudio.apple.sdk.4.12.3.83.vsix";
string monoSDK_windows = "";//$"https://download.mono-project.com/archive/{monoMajorVersion}/windows-installer/mono-{monoVersion}-x64-0.msi";
string androidSDK_windows = "";//"https://aka.ms/xamarin-android-commercial-d15-9-windows";
string iOSSDK_windows = "";//"https://download.visualstudio.microsoft.com/download/pr/71f33151-5db4-49cc-ac70-ba835a9f81e2/d256c6c50cd80ec0207783c5c7a4bc2f/xamarin.visualstudio.apple.sdk.4.12.3.83.vsix";
string macSDK_windows = "";
monoMajorVersion = "6.4.0";
@ -66,7 +66,7 @@ string macSDK_macos = $"https://bosstoragemirror.blob.core.windows.net/wrench/je
string androidSDK = IsRunningOnWindows() ? androidSDK_windows : androidSDK_macos;
string monoSDK = IsRunningOnWindows() ? monoSDK_windows : monoSDK_macos;
string iosSDK = IsRunningOnWindows() ? "" : iOSSDK_macos;
string iosSDK = IsRunningOnWindows() ? iOSSDK_windows : iOSSDK_macos;
string macSDK = IsRunningOnWindows() ? "" : macSDK_macos;
string[] androidSdkManagerInstalls = new string[0]; //new [] { "platforms;android-29"};
@ -76,6 +76,7 @@ string[] androidSdkManagerInstalls = new string[0]; //new [] { "platforms;androi
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Description("Deletes all the obj/bin directories")
.Does(() =>
{
CleanDirectories("./**/obj", (fsi)=> !fsi.Path.FullPath.Contains("XFCorePostProcessor") && !fsi.Path.FullPath.StartsWith("tools"));
@ -83,6 +84,7 @@ Task("Clean")
});
Task("provision-macsdk")
.Description("Install Xamarin.Mac SDK")
.Does(async () =>
{
if(!IsRunningOnWindows() && !String.IsNullOrWhiteSpace(macSDK))
@ -92,16 +94,15 @@ Task("provision-macsdk")
});
Task("provision-iossdk")
.Description("Install Xamarin.iOS SDK")
.Does(async () =>
{
if(!IsRunningOnWindows())
{
if(!String.IsNullOrWhiteSpace(iosSDK))
await Boots(iosSDK);
}
if(!String.IsNullOrWhiteSpace(iosSDK))
await Boots(iosSDK);
});
Task("provision-androidsdk")
.Description("Install Xamarin.Android SDK")
.Does(async () =>
{
Information ("ANDROID_HOME: {0}", ANDROID_HOME);
@ -122,6 +123,7 @@ Task("provision-androidsdk")
});
Task("provision-monosdk")
.Description("Install Mono SDK")
.Does(async () =>
{
if(IsRunningOnWindows())
@ -154,17 +156,20 @@ Task("provision-monosdk")
});
Task("provision")
.Description("Install SDKs required to build project")
.IsDependentOn("provision-macsdk")
.IsDependentOn("provision-iossdk")
.IsDependentOn("provision-monosdk")
.IsDependentOn("provision-androidsdk");
Task("NuGetPack")
.Description("Build and Create Nugets")
.IsDependentOn("Build")
.IsDependentOn("_NuGetPack");
Task("_NuGetPack")
.Description("Create Nugets without building anything")
.Does(() =>
{
Information("Nuget Version: {0}", nugetversion);
@ -187,6 +192,7 @@ Task("_NuGetPack")
Task("Restore")
.Description("Restore target on Xamarin.Forms.sln")
.Does(() =>
{
try{
@ -199,20 +205,9 @@ Task("Restore")
}
});
Task("BuildHack")
.IsDependentOn("Restore")
.Does(() =>
{
if(!IsRunningOnWindows())
{
MSBuild("./Xamarin.Forms.Build.Tasks/Xamarin.Forms.Build.Tasks.csproj", GetMSBuildSettings().WithRestore());
}
});
Task("Build")
.Description("Builds all necessary projects to create Nuget Packages")
.IsDependentOn("Restore")
.IsDependentOn("BuildHack")
.IsDependentOn("Android81")
.Does(() =>
{
@ -227,7 +222,7 @@ Task("Build")
});
Task("Android81")
.IsDependentOn("BuildHack")
.Description("Builds Monodroid81 targets")
.Does(() =>
{
string[] androidProjects =
@ -247,7 +242,7 @@ Task("Android81")
});
Task("VSMAC")
.IsDependentOn("BuildHack")
.Description("Builds projects necessary so solution compiles on VSMAC")
.Does(() =>
{
StartProcess("open", new ProcessSettings{ Arguments = "Xamarin.Forms.sln" });
@ -269,7 +264,7 @@ Task("DeployiOS")
});
*/
Task("DeployAndroid")
.IsDependentOn("BuildHack")
.Description("Builds and deploy Android Control Gallery")
.Does(() =>
{
MSBuild("./Xamarin.Forms.Build.Tasks/Xamarin.Forms.Build.Tasks.csproj", GetMSBuildSettings().WithRestore());

Просмотреть файл

@ -73,7 +73,7 @@ jobs:
solution: ${{ parameters.slnPath }}
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArguments: ${{ parameters.msbuildExtraArguments }} /p:JavaSdkDirectory="$(JAVA_HOME_8_X64)"
msbuildArguments: ${{ parameters.msbuildExtraArguments }} /p:JavaSdkDirectory="$(JAVA_HOME_8_X64)" /bl:$(Build.ArtifactStagingDirectory)\win-$(BuildConfiguration).binlog
- task: VSTest@2
displayName: 'Unit Tests'