Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ They run in a context of an inner build with a single $(RuntimeIdentifier).
AotOutputDirectory="$(_AndroidAotBinDirectory)"
RuntimeIdentifier="$(RuntimeIdentifier)"
EnableLLVM="$(EnableLLVM)"
Profiles="@(AndroidAotProfile)">
Profiles="@(AndroidAotProfile)"
StripLibraries="$(_AndroidAotStripLibraries)">
<Output PropertyName="_Triple" TaskParameter="Triple" />
<Output PropertyName="_ToolPrefix" TaskParameter="ToolPrefix" />
<Output PropertyName="_MsymPath" TaskParameter="MsymPath" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,26 +204,6 @@ _ResolveAssemblies MSBuild target.
IncludeDebugSymbols="$(AndroidIncludeDebugSymbols)">
<Output TaskParameter="OutputLibraries" ItemName="FrameworkNativeLibrary" />
</ProcessNativeLibraries>
<ItemGroup>
<_StrippedFrameworkNativeLibrary Include="@(FrameworkNativeLibrary->'$(IntermediateOutputPath)native\%(RuntimeIdentifier)\%(Filename)%(Extension)')" />
</ItemGroup>
</Target>

<Target Name="_StripFrameworkNativeLibraries"
Condition=" '$(AndroidIncludeDebugSymbols)' != 'true' "
DependsOnTargets="_IncludeNativeSystemLibraries"
Inputs="@(FrameworkNativeLibrary)"
Outputs="@(_StrippedFrameworkNativeLibrary)">
<StripNativeLibraries
SourceFiles="@(FrameworkNativeLibrary)"
DestinationFiles="@(_StrippedFrameworkNativeLibrary)"
ToolPath="$(AndroidBinUtilsDirectory)"
/>
<ItemGroup Condition=" '$(AndroidIncludeDebugSymbols)' != 'true' ">
<FrameworkNativeLibrary Remove="@(FrameworkNativeLibrary)"/>
<FrameworkNativeLibrary Include="@(_StrippedFrameworkNativeLibrary)"/>
<FileWrites Include="@(_StrippedFrameworkNativeLibrary)" />
</ItemGroup>
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ projects, these properties are set in Xamarin.Android.Legacy.targets.
_CheckApkPerAbiFlag;
_LintChecks;
_IncludeNativeSystemLibraries;
_StripFrameworkNativeLibraries;
_CheckGoogleSdkRequirements;
</_PrepareBuildApkDependsOnTargets>
</PropertyGroup>
Expand Down
14 changes: 13 additions & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/GetAotArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public abstract class GetAotArguments : AndroidAsyncTask

public bool EnableLLVM { get; set; }

public bool StripLibraries { get; set; }

public string AndroidSequencePointsMode { get; set; } = "";

public ITaskItem [] Profiles { get; set; } = Array.Empty<ITaskItem> ();
Expand Down Expand Up @@ -291,7 +293,17 @@ string GetLdFlags(NdkTools ndk, AndroidTargetArch arch, int level, string toolPr

ldFlags = $"\\\"{string.Join ("\\\";\\\"", libs)}\\\"";
}
return ldFlags;

if (!StripLibraries) {
return ldFlags;
}

const string StripFlag = "-s";
if (ldFlags.Length == 0) {
return StripFlag;
}

return $"{ldFlags} {StripFlag}";
}

static string GetNdkToolchainLibraryDir (NdkTools ndk, string binDir, string archDir = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,13 +598,6 @@ public void DotNetBuild (string runtimeIdentifiers, bool isRelease, bool aot, bo
}

var rids = runtimeIdentifiers.Split (';');
if (isRelease) {
// Check for stripped native libraries
foreach (var rid in rids) {
FileAssert.Exists (Path.Combine (intermediateOutputPath, "native", rid, "libmono-android.release.so"));
FileAssert.Exists (Path.Combine (intermediateOutputPath, "native", rid, "libmonosgen-2.0.so"));
}
}

// Check AndroidManifest.xml
var manifestPath = Path.Combine (intermediateOutputPath, "android", "AndroidManifest.xml");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
</Choose>

<PropertyGroup>
<_AndroidAotStripLibraries Condition=" '$(_AndroidAotStripLibraries)' == '' And '$(AndroidIncludeDebugSymbols)' != 'true' ">True</_AndroidAotStripLibraries>
<AndroidUseAssemblyStore Condition=" '$(AndroidUseAssemblyStore)' == '' and ('$(EmbedAssembliesIntoApk)' != 'true' or '$(AndroidIncludeDebugSymbols)' == 'true' or '$(BundleAssemblies)' == 'true') ">false</AndroidUseAssemblyStore>
<AndroidUseAssemblyStore Condition=" '$(AndroidUseAssemblyStore)' == '' ">true</AndroidUseAssemblyStore>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,8 @@ projects. .NET 5 projects will not import this file.
AdditionalNativeLibraryReferences="@(_AdditionalNativeLibraryReferences)"
YieldDuringToolExecution="$(YieldDuringToolExecution)"
EnableLLVM="$(EnableLLVM)"
Profiles="@(_AotProfiles)">
Profiles="@(_AotProfiles)"
StripLibraries="$(_AndroidAotStripLibraries)">
<Output TaskParameter="NativeLibrariesReferences" ItemName="_AdditionalNativeLibraryReferences" />
</Aot>

Expand Down
Loading