Skip to content
Draft
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
12 changes: 3 additions & 9 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,11 @@
<AllSupported32BitTargetAndroidAbis>armeabi-v7a;x86</AllSupported32BitTargetAndroidAbis>
<AllSupported64BitTargetAndroidAbis>arm64-v8a;x86_64</AllSupported64BitTargetAndroidAbis>
<AllSupportedTargetAndroidAbis>$(AllSupported32BitTargetAndroidAbis);$(AllSupported64BitTargetAndroidAbis)</AllSupportedTargetAndroidAbis>
<!--
For some reason, the URL for platform-tools/build-tools 32.0.0 is prefixed with what appears to be a GIT commit hash or some other checksum...
Linux packages don't have any prefix, but this forces us to have *some* mechanism to handle this...
-->
<XABuildToolsPackagePrefixMacOS></XABuildToolsPackagePrefixMacOS>
<XABuildToolsPackagePrefixWindows></XABuildToolsPackagePrefixWindows>
<XABuildToolsPackagePrefixLinux></XABuildToolsPackagePrefixLinux>
<XABuildToolsPackagePrefix Condition=" '$(HostOS)' == 'Darwin' ">$(XABuildToolsPackagePrefixMacOS)</XABuildToolsPackagePrefix>
<XABuildToolsPackagePrefix Condition=" '$(HostOS)' == 'Windows' ">$(XABuildToolsPackagePrefixWindows)</XABuildToolsPackagePrefix>
<XABuildToolsVersion>36</XABuildToolsVersion>
<XABuildToolsFolder Condition="'$(XABuildToolsFolder)' == ''">36.0.0</XABuildToolsFolder>
<XABuildToolsHashMacOS>04E7F3A72044DE4926FA038FA0E251A37BBA1E1C3FB8BEAB6F8401BFD9EB4BF3</XABuildToolsHashMacOS>
<XABuildToolsHashLinux>5D9AC77FB6FF43D9DA518A337B4FCF8F9097113DF531D99CCEFE80EF7CE8250B</XABuildToolsHashLinux>
<XABuildToolsHashWindows>AA1095CB14D83E483818A748A2C06FAAEB8E601561B06A356A119A1B2CA280D3</XABuildToolsHashWindows>
<XAPlatformToolsPackagePrefix Condition=" '$(HostOS)' == 'Darwin' "></XAPlatformToolsPackagePrefix>
<XAPlatformToolsVersion>36.0.0</XAPlatformToolsVersion>
<XABundleToolVersion Condition="'$(XABundleToolVersion)' == ''">1.18.3</XABundleToolVersion>
Expand Down
5 changes: 0 additions & 5 deletions build-tools/xaprepare/xaprepare/Application/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,6 @@ public string DebugFileExtension {
/// </summary>
public string? LocalDotNetSdkArchive { get; set; }

/// <summary>
/// Set by <see cref="Step_Get_Android_BuildTools"/> if the archive has been downloaded and validated.
/// </summary>
public bool BuildToolsArchiveDownloaded { get; set; }

/// <summary>
/// Determines whether or not we are running on a hosted azure pipelines agent.
/// These agents have certain limitations, the most pressing being the amount of available storage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ static class KnownProperties
public const string TestOutputDirectory = "TestOutputDirectory";
public const string XABuildToolsFolder = "XABuildToolsFolder";
public const string XABuildToolsVersion = "XABuildToolsVersion";
public const string XABuildToolsPackagePrefixMacOS = "XABuildToolsPackagePrefixMacOS";
public const string XABuildToolsPackagePrefixWindows = "XABuildToolsPackagePrefixWindows";
public const string XABuildToolsPackagePrefixLinux = "XABuildToolsPackagePrefixLinux";
public const string XABuildToolsPackagePrefix = "XABuildToolsPackagePrefix";
public const string XABinRelativeInstallPrefix = "XABinRelativeInstallPrefix";
public const string XAInstallPrefix = "XAInstallPrefix";
public const string XAPackagesDir = "XAPackagesDir";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ namespace Xamarin.Android.Prepare
properties.Add (KnownProperties.TestOutputDirectory, StripQuotes (@"@TestOutputDirectory@"));
properties.Add (KnownProperties.XABuildToolsFolder, StripQuotes (@"@XABuildToolsFolder@"));
properties.Add (KnownProperties.XABuildToolsVersion, StripQuotes ("@XABuildToolsVersion@"));
properties.Add (KnownProperties.XABuildToolsPackagePrefixMacOS, StripQuotes ("@XABuildToolsPackagePrefixMacOS@"));
properties.Add (KnownProperties.XABuildToolsPackagePrefixWindows, StripQuotes ("@XABuildToolsPackagePrefixWindows@"));
properties.Add (KnownProperties.XABuildToolsPackagePrefixLinux, StripQuotes ("@XABuildToolsPackagePrefixLinux@"));
properties.Add (KnownProperties.XABuildToolsPackagePrefix, StripQuotes ("@XABuildToolsPackagePrefix@"));
properties.Add (KnownProperties.XABinRelativeInstallPrefix, StripQuotes (@"@XABinRelativeInstallPrefix@"));
properties.Add (KnownProperties.XAInstallPrefix, StripQuotes (@"@XAInstallPrefix@"));
properties.Add (KnownProperties.XAPackagesDir, StripQuotes (@"@XAPackagesDir@"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public AndroidToolchain ()
string EmulatorPkgRevision = GetRequiredProperty (KnownProperties.EmulatorPkgRevision);
string XABuildToolsFolder = GetRequiredProperty (KnownProperties.XABuildToolsFolder);
string XABuildToolsVersion = GetRequiredProperty (KnownProperties.XABuildToolsVersion);
string XABuildToolsPackagePrefix = Context.Instance.Properties [KnownProperties.XABuildToolsPackagePrefix] ?? String.Empty;
string XAPlatformToolsVersion = GetRequiredProperty (KnownProperties.XAPlatformToolsVersion);
string XAPlatformToolsPackagePrefix = Context.Instance.Properties [KnownProperties.XAPlatformToolsPackagePrefix] ?? String.Empty;
bool isArm64Apple = Context.Instance.OS.Flavor == "macOS" && RuntimeInformation.OSArchitecture == Architecture.Arm64;
Expand Down Expand Up @@ -107,7 +106,7 @@ public AndroidToolchain ()
buildToolName: $"android-ndk-r{AndroidNdkVersion}",
buildToolVersion: AndroidPkgRevision
),
new AndroidToolchainComponent ($"{XABuildToolsPackagePrefix}build-tools_r{XABuildToolsVersion}_{altOsTag}",
new AndroidToolchainComponent ($"build-tools_r{XABuildToolsVersion}_{altOsTag}",
destDir: Path.Combine ("build-tools", XABuildToolsFolder),
isMultiVersion: true,
buildToolName: "android-sdk-build-tools",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ protected override void AddSteps (Context context)
Steps.Add (new Step_GenerateFiles (atBuildStart: true));
Steps.Add (new Step_PrepareProps ());
Steps.Add (new Step_GenerateCGManifest ());
Steps.Add (new Step_Get_Android_BuildTools ());
}

protected override void AddEndSteps (Context context)
Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions build-tools/xaprepare/xaprepare/xaprepare.targets
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@
<Replacement Include="@TestOutputDirectory@=$(TestOutputDirectory)" />
<Replacement Include="@XABuildToolsFolder@=$(XABuildToolsFolder)" />
<Replacement Include="@XABuildToolsVersion@=$(XABuildToolsVersion)" />
<Replacement Include="@XABuildToolsPackagePrefixMacOS@=$(XABuildToolsPackagePrefixMacOS)" />
<Replacement Include="@XABuildToolsPackagePrefixWindows@=$(XABuildToolsPackagePrefixWindows)" />
<Replacement Include="@XABuildToolsPackagePrefixLinux@=$(XABuildToolsPackagePrefixLinux)" />
<Replacement Include="@XABuildToolsPackagePrefix@=$(XABuildToolsPackagePrefix)" />
<Replacement Include="@XAPlatformToolsVersion@=$(XAPlatformToolsVersion)" />
<Replacement Include="@XAInstallPrefix@=$(XAInstallPrefix)" />
<Replacement Include="@XABinRelativeInstallPrefix@=$(_XABinRelativeInstallPrefix)" />
Expand Down
33 changes: 32 additions & 1 deletion src/aapt2/aapt2.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,60 @@
<Aapt2Version>4.0.0-6051327</Aapt2Version>
<_Destination>$(MicrosoftAndroidSdkOutDir)</_Destination>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<_AndroidRepositoryUrl>https://dl.google.com/android/repository/</_AndroidRepositoryUrl>
</PropertyGroup>

<!--
Google's SDK manifest (repository2-3.xml) only provides SHA-1 checksums,
but MSBuild's GetFileHash task only supports SHA-256 and above.
So we hardcode SHA-256 hashes in Configuration.props instead.
-->
<ItemGroup>
<_BuildTools Include="build-tools_r$(XABuildToolsVersion)_macosx.zip">
<Platform>osx</Platform>
<HostOS>Darwin</HostOS>
<Hash>$(XABuildToolsHashMacOS)</Hash>
<FilesToExtract>aapt2</FilesToExtract>
</_BuildTools>
<_BuildTools Include="build-tools_r$(XABuildToolsVersion)_linux.zip">
<Platform>linux</Platform>
<HostOS>Linux</HostOS>
<Hash>$(XABuildToolsHashLinux)</Hash>
<FilesToExtract>aapt2</FilesToExtract>
</_BuildTools>
<_BuildTools Include="build-tools_r$(XABuildToolsVersion)_windows.zip">
<Platform>windows</Platform>
<HostOS></HostOS>
<Hash>$(XABuildToolsHashWindows)</Hash>
<FilesToExtract>aapt2.exe</FilesToExtract>
</_BuildTools>
</ItemGroup>

<UsingTask AssemblyFile="$(BootstrapTasksAssembly)" TaskName="Xamarin.Android.Tools.BootstrapTasks.UnzipDirectoryChildren" TaskFactory="TaskHostFactory" Runtime="NET" />

<Target Name="_ExtractAapt2" BeforeTargets="Build">
<Target Name="_DownloadBuildTools"
Inputs="$(MSBuildThisFileFullPath);$(MSBuildProjectFullPath);..\..\Configuration.props"
Outputs="$(AndroidToolchainCacheDirectory)\%(_BuildTools.Identity)">
<DownloadFile
SourceUrl="$(_AndroidRepositoryUrl)%(_BuildTools.Identity)"
DestinationFolder="$(AndroidToolchainCacheDirectory)"
DestinationFileName="%(_BuildTools.Identity)"
Retries="3"
/>
<GetFileHash Files="$(AndroidToolchainCacheDirectory)\%(_BuildTools.Identity)" Algorithm="SHA256">
<Output TaskParameter="Hash" PropertyName="_ActualHash" />
</GetFileHash>
<Delete
Condition=" '$(_ActualHash)' != '%(_BuildTools.Hash)' "
Files="$(AndroidToolchainCacheDirectory)\%(_BuildTools.Identity)"
/>
<Error
Condition=" '$(_ActualHash)' != '%(_BuildTools.Hash)' "
Text="SHA256 mismatch for %(_BuildTools.Identity). Expected: %(_BuildTools.Hash) Actual: $(_ActualHash)"
/>
</Target>

<Target Name="_ExtractAapt2" BeforeTargets="Build" DependsOnTargets="_DownloadBuildTools">
<UnzipDirectoryChildren
NoSubdirectory="False"
SourceFiles="$(AndroidToolchainCacheDirectory)\%(_BuildTools.Identity)"
Expand Down