Skip to content

Commit 3905d61

Browse files
committed
Enable BuildApkArchive for FastDev builds.
1 parent 9109c70 commit 3905d61

File tree

1 file changed

+55
-50
lines changed

1 file changed

+55
-50
lines changed

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets

Lines changed: 55 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,25 +2182,50 @@ because xbuild doesn't support framework reference assemblies.
21822182
Inputs="$(_BuildApkFastDevStaticInputs)"
21832183
Outputs="$(_BuildApkEmbedOutputs)">
21842184

2185-
<!-- Put the assemblies and native libraries in the apk -->
2186-
<BuildApk
2187-
Condition=" '$(AndroidPackageFormat)' != 'aab' "
2185+
<PropertyGroup Condition=" '$(AndroidPackageFormat)' != 'aab' ">
2186+
<_AndroidCreatePackagePerAbi>$(AndroidCreatePackagePerAbi)</_AndroidCreatePackagePerAbi>
2187+
<_ApkOutputPath>$(ApkFileIntermediate)</_ApkOutputPath>
2188+
</PropertyGroup>
2189+
2190+
<ItemGroup Condition=" '$(AndroidPackageFormat)' != 'aab' ">
2191+
<_NativeLibraries Include="@(_AndroidNativeLibraryForFastDev)" />
2192+
<_DalvikClasses Include="@(_DexFileForFastDev)" />
2193+
</ItemGroup>
2194+
2195+
<PropertyGroup Condition=" '$(AndroidPackageFormat)' == 'aab' ">
2196+
<_AndroidCreatePackagePerAbi>False</_AndroidCreatePackagePerAbi>
2197+
<_ApkOutputPath>$(_BaseZipIntermediate)</_ApkOutputPath>
2198+
<_RootPath>root/</_RootPath>
2199+
<_DalvikPath>dex/</_DalvikPath>
2200+
<_BundleAssemblies>$(BundleAssemblies)</_BundleAssemblies>
2201+
<_BundleNativeLibraries>$(_BundleResultNativeLibraries)</_BundleNativeLibraries>
2202+
</PropertyGroup>
2203+
2204+
<ItemGroup Condition=" '$(AndroidPackageFormat)' == 'aab' ">
2205+
<_NativeLibraries Include="@(AndroidNativeLibrary)" />
2206+
<_DalvikClasses Include="@(_DexFile)" />
2207+
</ItemGroup>
2208+
2209+
<!-- Put the assemblies and native libraries in the apk -->
2210+
<BuildApkTemporary
21882211
AndroidNdkDirectory="$(_AndroidNdkDirectory)"
21892212
ApkInputPath="$(_PackagedResources)"
2190-
ApkOutputPath="$(ApkFileIntermediate)"
2213+
ApkOutputPath="$(_ApkOutputPath)"
21912214
AppSharedLibrariesDir="$(_AndroidApplicationSharedLibraryPath)"
2215+
BundleAssemblies="$(_BundleAssemblies)"
2216+
BundleNativeLibraries="$(_BundleNativeLibraries)"
21922217
EmbedAssemblies="$(EmbedAssembliesIntoApk)"
21932218
ResolvedUserAssemblies="@(_ResolvedUserAssemblies);@(_AndroidResolvedSatellitePaths)"
21942219
ResolvedFrameworkAssemblies="@(_ShrunkFrameworkAssemblies)"
21952220
FrameworkNativeLibraries="@(FrameworkNativeLibrary)"
2196-
NativeLibraries="@(_AndroidNativeLibraryForFastDev)"
2221+
NativeLibraries="@(_NativeLibraries)"
21972222
ApplicationSharedLibraries="@(_ApplicationSharedLibrary)"
21982223
AdditionalNativeLibraryReferences="@(_AdditionalNativeLibraryReferences)"
21992224
EmbeddedNativeLibraryAssemblies="$(OutDir)$(TargetFileName);@(ReferencePath);@(ReferenceDependencyPaths)"
2200-
DalvikClasses="@(_DexFileForFastDev)"
2225+
DalvikClasses="@(_DalvikClasses)"
22012226
SupportedAbis="@(_BuildTargetAbis)"
22022227
AndroidSequencePointsMode="$(_SequencePointsMode)"
2203-
CreatePackagePerAbi="$(AndroidCreatePackagePerAbi)"
2228+
CreatePackagePerAbi="$(_AndroidCreatePackagePerAbi)"
22042229
Debug="$(AndroidIncludeDebugSymbols)"
22052230
EnableCompression="$(AndroidEnableAssemblyCompression)"
22062231
TypeMappings="@(_AndroidTypeMaps)"
@@ -2218,50 +2243,30 @@ because xbuild doesn't support framework reference assemblies.
22182243
ExcludeFiles="@(AndroidPackagingOptionsExclude)"
22192244
IncludeFiles="@(AndroidPackagingOptionsInclude)"
22202245
AndroidBinUtilsDirectory="$(AndroidBinUtilsDirectory)"
2221-
IntermediateOutputPath="$(IntermediateOutputPath)">
2246+
IntermediateOutputPath="$(IntermediateOutputPath)"
2247+
RootPath="$(_RootPath)"
2248+
DalvikPath="$(_DalvikPath)">
22222249
<Output TaskParameter="OutputFiles" ItemName="ApkFiles" />
2223-
</BuildApk>
2224-
<BuildBaseAppBundle
2225-
Condition=" '$(AndroidPackageFormat)' == 'aab' "
2226-
AndroidNdkDirectory="$(_AndroidNdkDirectory)"
2227-
ApkInputPath="$(_PackagedResources)"
2228-
ApkOutputPath="$(_BaseZipIntermediate)"
2229-
AppSharedLibrariesDir="$(_AndroidApplicationSharedLibraryPath)"
2230-
BundleAssemblies="$(BundleAssemblies)"
2231-
BundleNativeLibraries="$(_BundleResultNativeLibraries)"
2232-
EmbedAssemblies="$(EmbedAssembliesIntoApk)"
2233-
ResolvedUserAssemblies="@(_ResolvedUserAssemblies);@(_AndroidResolvedSatellitePaths)"
2234-
ResolvedFrameworkAssemblies="@(_ShrunkFrameworkAssemblies)"
2235-
FrameworkNativeLibraries="@(FrameworkNativeLibrary)"
2236-
NativeLibraries="@(AndroidNativeLibrary)"
2237-
ApplicationSharedLibraries="@(_ApplicationSharedLibrary)"
2238-
AdditionalNativeLibraryReferences="@(_AdditionalNativeLibraryReferences)"
2239-
EmbeddedNativeLibraryAssemblies="$(OutDir)$(TargetFileName);@(ReferencePath);@(ReferenceDependencyPaths)"
2240-
DalvikClasses="@(_DexFile)"
2241-
SupportedAbis="@(_BuildTargetAbis)"
2242-
CreatePackagePerAbi="False"
2243-
Debug="$(AndroidIncludeDebugSymbols)"
2244-
EnableCompression="$(AndroidEnableAssemblyCompression)"
2245-
TypeMappings="@(_AndroidTypeMaps)"
2246-
JavaSourceFiles="@(AndroidJavaSource)"
2247-
JavaLibraries="@(AndroidJavaLibrary)"
2248-
AndroidSequencePointsMode="$(_SequencePointsMode)"
2249-
LibraryProjectJars="@(ExtractedJarImports)"
2250-
TlsProvider="$(AndroidTlsProvider)"
2251-
UncompressedFileExtensions="$(AndroidStoreUncompressedFileExtensions)"
2252-
ProjectFullPath="$(MSBuildProjectFullPath)"
2253-
IncludeWrapSh="$(AndroidIncludeWrapSh)"
2254-
CheckedBuild="$(_AndroidCheckedBuild)"
2255-
RuntimeConfigBinFilePath="$(_BinaryRuntimeConfigPath)"
2256-
ZipFlushFilesLimit="$(_ZipFlushFilesLimit)"
2257-
ZipFlushSizeLimit="$(_ZipFlushSizeLimit)"
2258-
ExcludeFiles="@(AndroidPackagingOptionsExclude)"
2259-
IncludeFiles="@(AndroidPackagingOptionsInclude)"
2260-
AndroidBinUtilsDirectory="$(AndroidBinUtilsDirectory)"
2261-
IntermediateOutputPath="$(IntermediateOutputPath)">
2262-
<Output TaskParameter="OutputFiles" ItemName="BaseZipFile" />
2263-
</BuildBaseAppBundle>
2264-
<BuildAppBundle
2250+
<Output TaskParameter="OutputApkFiles" ItemName="FilesToAddToApk" />
2251+
<Output TaskParameter="DSODirectoriesToDelete" ItemName="DSODirectoriesToDelete" />
2252+
</BuildApkTemporary>
2253+
2254+
<!-- This task uses MSBuild task batching. It will be called once for each unique '%(FilesToAddToApk.Abi)'. -->
2255+
<BuildApkArchive
2256+
Abi="%(FilesToAddToApk.Abi)"
2257+
AndroidPackageFormat="$(AndroidPackageFormat)"
2258+
ApkInputPath="$(_PackagedResources)"
2259+
ApkOutputPaths="@(ApkFiles)"
2260+
FilesToAddToApk="@(FilesToAddToApk)"
2261+
UncompressedFileExtensions="$(AndroidStoreUncompressedFileExtensions)"
2262+
ZipFlushFilesLimit="$(_ZipFlushFilesLimit)"
2263+
ZipFlushSizeLimit="$(_ZipFlushSizeLimit)" />
2264+
2265+
<!-- Hopefully this is temporary and doesn't actually need to be cleaned up. But for now let's not change existing behavior. -->
2266+
<RemoveDir
2267+
Directories="@(DSODirectoriesToDelete)" />
2268+
2269+
<BuildAppBundle
22652270
Condition=" '$(AndroidPackageFormat)' == 'aab' "
22662271
ToolPath="$(JavaToolPath)"
22672272
JavaMaximumHeapSize="$(JavaMaximumHeapSize)"

0 commit comments

Comments
 (0)