Skip to content

Commit e5a2454

Browse files
committed
New target to build embedded assembly store
1 parent 6b2b074 commit e5a2454

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.After.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ This file is imported *after* the Microsoft.NET.Sdk/Sdk.targets.
2929
<Import Project="Microsoft.Android.Sdk.Publish.targets" />
3030
<Import Project="Microsoft.Android.Sdk.RuntimeConfig.targets" />
3131
<Import Project="Microsoft.Android.Sdk.Tooling.targets" />
32+
<Import Project="Microsoft.Android.Sdk.AssemblyStores.targets" />
3233
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<UsingTask TaskName="Xamarin.Android.Tasks.CreateEmbeddedAssemblyStore" AssemblyFile="$(_XamarinAndroidBuildTasksAssembly)" />
4+
5+
<Target Name="_PrepareCreateEmbeddedAssemblyStoreOutputItems">
6+
<!-- NOTE: the `embed_` prefix and `assembly_store` stem must be identical to the values used in ELFEmbeddingHelper -->
7+
<ItemGroup>
8+
<_EmbeddedAssemblyStoreObjectFile Include="$(_NativeAssemblySourceDir)embed_assembly_store.%(_BuildTargetAbis.Identity).o" />
9+
</ItemGroup>
10+
</Target>
11+
12+
<Target Name="_CreateEmbeddedAssemblyStore"
13+
Condition=" '$(_AndroidEmbedAssemblyStoreInRuntime)' == 'True' "
14+
DependsOnTargets="_PrepareCreateEmbeddedAssemblyStoreOutputItems"
15+
Inputs="@(_ShrunkUserAssemblies);@(_AndroidResolvedSatellitePaths);@(_ShrunkFrameworkAssemblies)"
16+
Outputs="@(_EmbeddedAssemblyStoreObjectFile)">
17+
<CreateEmbeddedAssemblyStore
18+
AndroidBinUtilsDirectory="$(AndroidBinUtilsDirectory)"
19+
AppSharedLibrariesDir="$(_AndroidApplicationSharedLibraryPath)"
20+
ResolvedUserAssemblies="@(_ShrunkUserAssemblies);@(_AndroidResolvedSatellitePaths)"
21+
ResolvedFrameworkAssemblies="@(_ShrunkFrameworkAssemblies)">
22+
<Output TaskParameter="EmbeddedObjectFiles" ItemName="_NativeAssemblyTarget" />
23+
<Output TaskParameter="NativeAssemblySources" ItemName="_EmbeddedAssemblyStoreSourceFiles" />
24+
</CreateEmbeddedAssemblyStore>
25+
26+
<ItemGroup>
27+
<FileWrites Include="@(_NativeAssemblyTarget)" />
28+
<FileWrites Include="@(_EmbeddedAssemblyStoreSourceFiles)" />
29+
</ItemGroup>
30+
</Target>
31+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Xamarin.Android.Tools;
2+
using Microsoft.Android.Build.Tasks;
3+
4+
namespace Xamarin.Android.Tasks;
5+
6+
public class CreateEmbeddedAssemblyStore : AndroidTask
7+
{
8+
public override string TaskPrefix => "CEAS";
9+
10+
public override bool RunTask ()
11+
{
12+
return !Log.HasLoggedErrors;
13+
}
14+
}

0 commit comments

Comments
 (0)