[Xamarin.Android.Build.Tasks] stop redistributing `apksigner` (#7984)
Fixes: https://github.com/xamarin/xamarin-android/issues/6307
This reverts c50df1c5
.
In the past, we had to redistribute `apksigner.jar`, because it
required JDK 11. This happened for build-tools 30.0.0 and was fixed in
built-tools 30.0.3. At the time we were nowhere close able to use JDK
11, and so we built it ourselves for JDK 1.8 and redistributed it.
However, .NET 6+ now *requires* JDK 11, because targets API-31 and
higher. "Classic" Xamarin.Android requires JDK 11 if you are targeting
API-31.
We can remove `apksigner` from `main` going forward in .NET 8.
Other changes:
* Update `XASdkTests.cs` to account for `*.apk.sig` files.
This commit is contained in:
Родитель
56875061ca
Коммит
9a96a59613
|
@ -2,10 +2,6 @@
|
|||
path = external/android-api-docs
|
||||
url = https://github.com/xamarin/android-api-docs
|
||||
branch = main
|
||||
[submodule "external/apksig"]
|
||||
path = external/apksig
|
||||
url = https://android.googlesource.com/platform/tools/apksig
|
||||
branch = platform-tools-30.0.3
|
||||
[submodule "external/debugger-libs"]
|
||||
path = external/debugger-libs
|
||||
url = https://github.com/mono/debugger-libs
|
||||
|
|
|
@ -126,8 +126,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Java.Interop.Tools.Generato
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.SourceWriter", "external\Java.Interop\src\Xamarin.SourceWriter\Xamarin.SourceWriter.csproj", "{86A8DEFE-7ABB-4097-9389-C249581E243D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "apksigner", "src\apksigner\apksigner.csproj", "{9A9EF774-6EA6-414F-9D2F-DCD66C56B92A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "java-source-utils", "external\Java.Interop\tools\java-source-utils\java-source-utils.csproj", "{37FCD325-1077-4603-98E7-4509CAD648D6}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "decompress-assemblies", "tools\decompress-assemblies\decompress-assemblies.csproj", "{88B746FF-8D6E-464D-9D66-FF2ECCF148E0}"
|
||||
|
@ -364,10 +362,6 @@ Global
|
|||
{86A8DEFE-7ABB-4097-9389-C249581E243D}.Debug|AnyCPU.Build.0 = Debug|Any CPU
|
||||
{86A8DEFE-7ABB-4097-9389-C249581E243D}.Release|AnyCPU.ActiveCfg = Release|Any CPU
|
||||
{86A8DEFE-7ABB-4097-9389-C249581E243D}.Release|AnyCPU.Build.0 = Release|Any CPU
|
||||
{9A9EF774-6EA6-414F-9D2F-DCD66C56B92A}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
|
||||
{9A9EF774-6EA6-414F-9D2F-DCD66C56B92A}.Debug|AnyCPU.Build.0 = Debug|Any CPU
|
||||
{9A9EF774-6EA6-414F-9D2F-DCD66C56B92A}.Release|AnyCPU.ActiveCfg = Release|Any CPU
|
||||
{9A9EF774-6EA6-414F-9D2F-DCD66C56B92A}.Release|AnyCPU.Build.0 = Release|Any CPU
|
||||
{37FCD325-1077-4603-98E7-4509CAD648D6}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
|
||||
{37FCD325-1077-4603-98E7-4509CAD648D6}.Debug|AnyCPU.Build.0 = Debug|Any CPU
|
||||
{37FCD325-1077-4603-98E7-4509CAD648D6}.Release|AnyCPU.ActiveCfg = Release|Any CPU
|
||||
|
@ -463,7 +457,6 @@ Global
|
|||
{1FED3F23-1175-42AA-BE87-EF1E8DB52F8B} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
|
||||
{2CE4CD4B-B7B7-4EAE-A9BE-2699824D6096} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
|
||||
{86A8DEFE-7ABB-4097-9389-C249581E243D} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
|
||||
{9A9EF774-6EA6-414F-9D2F-DCD66C56B92A} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
|
||||
{37FCD325-1077-4603-98E7-4509CAD648D6} = {864062D3-A415-4A6F-9324-5820237BA058}
|
||||
{88B746FF-8D6E-464D-9D66-FF2ECCF148E0} = {864062D3-A415-4A6F-9324-5820237BA058}
|
||||
{1A273ED2-AE84-48E9-9C23-E978C2D0CB34} = {864062D3-A415-4A6F-9324-5820237BA058}
|
||||
|
|
|
@ -184,7 +184,6 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)android-support-multidex.jar" />
|
||||
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)apksigner.jar" />
|
||||
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)aprofutil.exe" ExcludeFromAndroidNETSdk="true" />
|
||||
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)aprofutil.pdb" ExcludeFromAndroidNETSdk="true" />
|
||||
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)cil-strip.exe" ExcludeFromAndroidNETSdk="true" />
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Xamarin.Android.Prepare
|
||||
{
|
||||
[TPN]
|
||||
class apksigner_google_TPN : ThirdPartyNotice
|
||||
{
|
||||
static readonly Uri url = new Uri ("https://android.googlesource.com/platform/tools/apksig/");
|
||||
|
||||
public override string LicenseFile => CommonLicenses.Apache20Path;
|
||||
public override string Name => "google/apksig";
|
||||
public override Uri SourceUrl => url;
|
||||
public override string LicenseText => String.Empty;
|
||||
|
||||
public override bool Include (bool includeExternalDeps, bool includeBuildDeps) => includeExternalDeps;
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 264d99ce7922a8952c6d4f06c90888e9c75b95fc
|
|
@ -51,6 +51,8 @@ called for "legacy" projects in Xamarin.Android.Legacy.targets.
|
|||
<Output TaskParameter="ZipAlignPath" PropertyName="ZipAlignToolPath" Condition="'$(ZipAlignToolPath)' == ''" />
|
||||
<Output TaskParameter="AndroidSequencePointsMode" PropertyName="_SequencePointsMode" Condition="'$(_SequencePointsMode)' == ''" />
|
||||
<Output TaskParameter="LintToolPath" PropertyName="LintToolPath" Condition="'$(LintToolPath)' == ''" />
|
||||
<Output TaskParameter="ApkSignerJar" PropertyName="ApkSignerJar" Condition="'$(ApkSignerJar)' == ''" />
|
||||
<Output TaskParameter="AndroidUseApkSigner" PropertyName="AndroidUseApkSigner" Condition="'$(AndroidUseApkSigner)' == ''" />
|
||||
<Output TaskParameter="Aapt2Version" PropertyName="_Aapt2Version" />
|
||||
<Output TaskParameter="Aapt2ToolPath" PropertyName="Aapt2ToolPath" Condition="'$(Aapt2ToolPath)' == ''" />
|
||||
</ResolveAndroidTooling>
|
||||
|
|
|
@ -59,6 +59,12 @@ namespace Xamarin.Android.Tasks
|
|||
[Output]
|
||||
public string LintToolPath { get; set; }
|
||||
|
||||
[Output]
|
||||
public string ApkSignerJar { get; set; }
|
||||
|
||||
[Output]
|
||||
public bool AndroidUseApkSigner { get; set; }
|
||||
|
||||
[Output]
|
||||
public string Aapt2Version { get; set; }
|
||||
|
||||
|
@ -133,6 +139,9 @@ namespace Xamarin.Android.Tasks
|
|||
return false;
|
||||
}
|
||||
|
||||
ApkSignerJar = Path.Combine (AndroidSdkBuildToolsBinPath, "lib", ApkSigner);
|
||||
AndroidUseApkSigner = File.Exists (ApkSignerJar);
|
||||
|
||||
if (AndroidUseAapt2) {
|
||||
if (string.IsNullOrEmpty (Aapt2ToolPath)) {
|
||||
var osBinPath = MonoAndroidHelper.GetOSBinPath ();
|
||||
|
@ -189,6 +198,8 @@ namespace Xamarin.Android.Tasks
|
|||
Log.LogDebugMessage ($" {nameof (ZipAlignPath)}: {ZipAlignPath}");
|
||||
Log.LogDebugMessage ($" {nameof (AndroidSequencePointsMode)}: {AndroidSequencePointsMode}");
|
||||
Log.LogDebugMessage ($" {nameof (LintToolPath)}: {LintToolPath}");
|
||||
Log.LogDebugMessage ($" {nameof (ApkSignerJar)}: {ApkSignerJar}");
|
||||
Log.LogDebugMessage ($" {nameof (AndroidUseApkSigner)}: {AndroidUseApkSigner}");
|
||||
Log.LogDebugMessage ($" {nameof (Aapt2Version)}: {Aapt2Version}");
|
||||
Log.LogDebugMessage ($" {nameof (Aapt2ToolPath)}: {Aapt2ToolPath}");
|
||||
}
|
||||
|
|
|
@ -295,6 +295,9 @@ namespace Xamarin.Android.Build.Tests {
|
|||
Assert.AreEqual (androidTooling.AndroidSequencePointsMode, "None", "AndroidSequencePointsMode should be None");
|
||||
expected = Path.Combine (androidSdkPath, "tools");
|
||||
Assert.AreEqual (androidTooling.LintToolPath, expected, $"LintToolPath should be {expected}");
|
||||
expected = Path.Combine (androidSdkPath, "build-tools", "26.0.3", "lib", "apksigner.jar");
|
||||
Assert.AreEqual (androidTooling.ApkSignerJar, expected, $"ApkSignerJar should be {expected}");
|
||||
Assert.AreEqual (androidTooling.AndroidUseApkSigner, false, "AndroidUseApkSigner should be false");
|
||||
Assert.AreEqual (validateJavaVersion.JdkVersion, "1.8.0", "JdkVersion should be 1.8.0");
|
||||
Assert.AreEqual (validateJavaVersion.MinimumRequiredJdkVersion, "1.8", "MinimumRequiredJdkVersion should be 1.8");
|
||||
Directory.Delete (Path.Combine (Root, path), recursive: true);
|
||||
|
|
|
@ -740,31 +740,23 @@ public class FooA {
|
|||
.Select (Path.GetFileName)
|
||||
.OrderBy (f => f, StringComparer.OrdinalIgnoreCase)
|
||||
.ToArray ();
|
||||
IEnumerable<string> expectedFiles;
|
||||
var expectedFiles = new List<string> {
|
||||
$"{proj.PackageName}-Signed.apk",
|
||||
"es",
|
||||
$"{proj.ProjectName}.dll",
|
||||
$"{proj.ProjectName}.pdb",
|
||||
$"{proj.ProjectName}.runtimeconfig.json",
|
||||
$"{proj.ProjectName}.xml",
|
||||
};
|
||||
if (isRelease) {
|
||||
expectedFiles = new string[] {
|
||||
$"{proj.PackageName}.aab",
|
||||
$"{proj.PackageName}-Signed.aab",
|
||||
$"{proj.PackageName}-Signed.apk",
|
||||
"es",
|
||||
$"{proj.ProjectName}.dll",
|
||||
$"{proj.ProjectName}.pdb",
|
||||
$"{proj.ProjectName}.runtimeconfig.json",
|
||||
$"{proj.ProjectName}.xml",
|
||||
};
|
||||
expectedFiles.Add ($"{proj.PackageName}.aab");
|
||||
expectedFiles.Add ($"{proj.PackageName}-Signed.aab");
|
||||
} else {
|
||||
expectedFiles = new string[] {
|
||||
$"{proj.PackageName}.apk",
|
||||
$"{proj.PackageName}-Signed.apk",
|
||||
"es",
|
||||
$"{proj.ProjectName}.dll",
|
||||
$"{proj.ProjectName}.pdb",
|
||||
$"{proj.ProjectName}.runtimeconfig.json",
|
||||
$"{proj.ProjectName}.xml",
|
||||
};
|
||||
expectedFiles.Add ($"{proj.PackageName}.apk");
|
||||
expectedFiles.Add ($"{proj.PackageName}-Signed.apk.idsig");
|
||||
}
|
||||
|
||||
expectedFiles = expectedFiles.OrderBy(f => f, StringComparer.OrdinalIgnoreCase);
|
||||
expectedFiles.Sort(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
CollectionAssert.AreEquivalent (expectedFiles, files, $"Expected: {string.Join (";", expectedFiles)}\n Found: {string.Join (";", files)}");
|
||||
|
||||
|
|
|
@ -447,9 +447,6 @@
|
|||
<ProjectReference Include="..\aapt2\aapt2.csproj">
|
||||
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\apksigner\apksigner.csproj">
|
||||
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\bundletool\bundletool.csproj">
|
||||
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
|
|
|
@ -722,12 +722,6 @@ because xbuild doesn't support framework reference assemblies.
|
|||
/>
|
||||
</CreateProperty>
|
||||
|
||||
<CreateProperty Value="$(MonoAndroidToolsDirectory)\apksigner.jar">
|
||||
<Output TaskParameter="Value" PropertyName="ApkSignerJar"
|
||||
Condition="'$(ApkSignerJar)' == ''"
|
||||
/>
|
||||
</CreateProperty>
|
||||
|
||||
<CreateProperty Value="$(MonoAndroidToolsDirectory)\manifestmerger.jar">
|
||||
<Output TaskParameter="Value" PropertyName="AndroidManifestMergerJarPath"
|
||||
Condition="'$(AndroidManifestMergerJarPath)' == ''"
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
.idea/
|
||||
build/
|
||||
out/
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
|
@ -1,26 +0,0 @@
|
|||
<Project Sdk="Microsoft.Build.NoTargets">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\..\Configuration.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputPath>$(MicrosoftAndroidSdkOutDir)</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="**" />
|
||||
<None Include="build.gradle" />
|
||||
<None Include="build\libs\apksigner.jar" CopyToOutputDirectory="PreserveNewest" Link="apksigner.jar" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- There isn't an actual dependency here, but we can only build one 'gradlew' project
|
||||
at a time, and adding <ProjectReference> between them ensures they run sequentially. -->
|
||||
<ProjectReference Include="..\..\external\Java.Interop\tools\java-source-utils\java-source-utils.csproj" ReferenceOutputAssembly="False" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="apksigner.targets" />
|
||||
</Project>
|
|
@ -1,23 +0,0 @@
|
|||
<Project Sdk="Microsoft.Build.NoTargets">
|
||||
|
||||
<Target Name="_BuildGradle"
|
||||
BeforeTargets="GetCopyToOutputDirectoryItems"
|
||||
Inputs="$(MSBuildThisFile);build.gradle"
|
||||
Outputs="build\libs\apksigner.jar">
|
||||
<Exec
|
||||
Command=""$(GradleWPath)" jar $(GradleArgs) -PjavaSourceVer=$(JavacSourceVersion) -PjavaTargetVer=$(JavacTargetVersion)"
|
||||
EnvironmentVariables="JAVA_HOME=$(Java8SdkDirectory);APP_HOME=$(GradleHome)"
|
||||
WorkingDirectory="$(MSBuildThisFileDirectory)"
|
||||
/>
|
||||
<Touch Files="build\libs\apksigner.jar" />
|
||||
</Target>
|
||||
|
||||
<Target Name="_CleanGradle" BeforeTargets="Clean">
|
||||
<Exec
|
||||
Command=""$(GradleWPath)" clean $(GradleArgs)"
|
||||
EnvironmentVariables="JAVA_HOME=$(Java8SdkDirectory);APP_HOME=$(GradleHome)"
|
||||
WorkingDirectory="$(MSBuildThisFileDirectory)"
|
||||
/>
|
||||
</Target>
|
||||
|
||||
</Project>
|
|
@ -1,38 +0,0 @@
|
|||
apply plugin: 'java'
|
||||
apply plugin: 'idea'
|
||||
|
||||
java {
|
||||
ext.javaSourceVer = project.hasProperty('javaSourceVer') ? JavaVersion.toVersion(project.getProperty('javaSourceVer')) : JavaVersion.VERSION_1_8
|
||||
ext.javaTargetVer = project.hasProperty('javaTargetVer') ? JavaVersion.toVersion(project.getProperty('javaTargetVer')) : JavaVersion.VERSION_1_8
|
||||
|
||||
sourceCompatibility = ext.javaSourceVer
|
||||
targetCompatibility = ext.javaTargetVer
|
||||
}
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs '../../external/apksig/src/main/java'
|
||||
srcDirs '../../external/apksig/src/apksigner/java'
|
||||
}
|
||||
resources {
|
||||
srcDirs '../../external/apksig/src/main/java'
|
||||
srcDirs '../../external/apksig/src/apksigner/java'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
duplicatesStrategy = 'exclude'
|
||||
manifest {
|
||||
attributes 'Main-Class': 'com.android.apksigner.ApkSignerTool'
|
||||
}
|
||||
from {
|
||||
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
|
||||
}
|
||||
archiveName 'apksigner.jar'
|
||||
}
|
|
@ -7,12 +7,6 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\..\Configuration.props" />
|
||||
|
||||
<ItemGroup>
|
||||
<!-- There isn't an actual dependency here, but we can only build one 'gradlew' project
|
||||
at a time, and adding <ProjectReference> between them ensures they run sequentially. -->
|
||||
<ProjectReference Include="..\apksigner\apksigner.csproj" ReferenceOutputAssembly="False" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="manifestmerger.targets" />
|
||||
</Project>
|
Загрузка…
Ссылка в новой задаче