Skip to content
Open
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
18 changes: 9 additions & 9 deletions build-tools/banned-apis/banned-apis.targets
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project>
<PropertyGroup>
<WarningsAsErrors>RS0030</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="4.14.0" PrivateAssets="All" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)BannedSymbols.txt" />
</ItemGroup>
</Project>
<Project>
<PropertyGroup>
<WarningsAsErrors>RS0030</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="4.14.0" PrivateAssets="All" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)BannedSymbols.txt" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
</Target>

<Target Name="_GeneratePostTrimTrimmableTypeMapJavaSources"
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' and '$(PublishTrimmed)' == 'true' and Exists('$(IntermediateOutputPath)linked/Link.semaphore') "
AfterTargets="ILLink"
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' and '$(PublishTrimmed)' == 'true' and '$(_ComputeFilesToPublishForRuntimeIdentifiers)' != 'true' "
AfterTargets="_ResolveAssemblies"
BeforeTargets="_GenerateJavaStubs;_CompileJava;_CompileToDalvik"
Inputs="$(IntermediateOutputPath)linked/Link.semaphore"
Inputs="@(ResolvedFileToPublish)"
Outputs="$(_PostTrimTrimmableTypeMapJavaStamp)">
<ItemGroup>
<_PostTrimTrimmableTypeMapInputAssemblies Include="@(ResolvedFileToPublish)"
Condition=" '%(Extension)' == '.dll' " />
Condition=" '%(Extension)' == '.dll' and ('%(RuntimeIdentifier)' == '' or '$(_PostTrimTypeMapFirstRuntimeIdentifier)' == '' or '%(RuntimeIdentifier)' == '$(_PostTrimTypeMapFirstRuntimeIdentifier)') " />
</ItemGroup>

<GenerateTrimmableTypeMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<_TypeMapJavaOutputDirectory>$(_TypeMapBaseOutputDir)typemap/java</_TypeMapJavaOutputDirectory>
<_TypeMapAssembliesListFile>$(_TypeMapOutputDirectory)typemap-assemblies.txt</_TypeMapAssembliesListFile>
<_PostTrimTypeMapJavaOutputDirectory>$(_TypeMapBaseOutputDir)typemap/linked-java</_PostTrimTypeMapJavaOutputDirectory>
<_PostTrimTypeMapFirstRuntimeIdentifier Condition=" '$(RuntimeIdentifiers)' != '' ">$([System.String]::Copy('$(RuntimeIdentifiers)').Split(';')[0])</_PostTrimTypeMapFirstRuntimeIdentifier>
<_PostTrimTypeMapFirstRuntimeIdentifier Condition=" '$(_PostTrimTypeMapFirstRuntimeIdentifier)' == '' ">$(RuntimeIdentifier)</_PostTrimTypeMapFirstRuntimeIdentifier>
<_TypeMapJavaStubsSourceDirectory Condition=" '$(_TypeMapJavaStubsSourceDirectory)' == '' and '$(_AndroidRuntime)' == 'CoreCLR' and '$(PublishTrimmed)' == 'true' ">$(_PostTrimTypeMapJavaOutputDirectory)</_TypeMapJavaStubsSourceDirectory>
<_TypeMapJavaStubsSourceDirectory Condition=" '$(_TypeMapJavaStubsSourceDirectory)' == '' ">$(_TypeMapJavaOutputDirectory)</_TypeMapJavaStubsSourceDirectory>
<_PostTrimTrimmableTypeMapJavaStamp>$(_TypeMapBaseOutputDir)stamp/_GeneratePostTrimTrimmableTypeMapJavaSources.stamp</_PostTrimTrimmableTypeMapJavaStamp>
Expand Down Expand Up @@ -251,8 +253,20 @@
We keep _GetGenerateJavaStubsInputs in DependsOnTargets so that downstream targets
(_GetGeneratePackageManagerJavaInputs) can still read @(_GenerateJavaStubsInputs).
-->
<!--
NOTE: _CleanIntermediateIfNeeded must NOT be listed here. It already runs early in the
normal build via _AndroidBuildDependsOn (BuildOrder.targets). During an incremental
`dotnet run` without a build, the entry point is the Install/DeployToDevice chain, which does
not run the early Build chain, so listing _CleanIntermediateIfNeeded here would make it run
for the first time *after* _PrepareAssemblies has already populated
obj/<config>/android/assets/<abi>/*.dll. It would then delete obj/<config>/android, but
_PrepareAssemblies (already executed this invocation) would be skipped and not recreate the
assemblies, causing _GeneratePackageManagerJava to fail with XAGCA7023
(DirectoryNotFoundException on assets/<abi>/Mono.Android.dll). This mirrors the llvm-ir
_GenerateJavaStubs target, which also omits _CleanIntermediateIfNeeded.
-->
<Target Name="_GenerateJavaStubs"
DependsOnTargets="_SetLatestTargetFrameworkVersion;_CleanIntermediateIfNeeded;_PrepareAssemblies;_GetGenerateJavaStubsInputs;_DefineBuildTargetAbis;_PrepareNativeAssemblySources"
DependsOnTargets="_SetLatestTargetFrameworkVersion;_PrepareAssemblies;_GetGenerateJavaStubsInputs;_DefineBuildTargetAbis;_PrepareNativeAssemblySources"
Inputs="$(_TypeMapOutputDirectory)$(_TypeMapAssemblyName).dll;@(_EnvironmentFiles)"
Outputs="$(_AndroidStampDirectory)_GenerateJavaStubs.stamp">

Expand Down
4 changes: 4 additions & 0 deletions tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ static IEnumerable<object[]> Get_DotNetRun_Data ()
//AddTestData (false, "managed", runtime);
}

AddTestData (true, "trimmable", AndroidRuntime.CoreCLR);
AddTestData (false, "trimmable", AndroidRuntime.CoreCLR);
AddTestData (true, "trimmable", AndroidRuntime.NativeAOT);
Comment thread
simonrozsival marked this conversation as resolved.

return ret;

void AddTestData (bool isRelease, string typemapImplementation, AndroidRuntime runtime)
Expand Down