Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[android] Internal Android sample build improvements #111545

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ivanpovazan
Copy link
Member

@ivanpovazan ivanpovazan commented Jan 17, 2025

Description

In context of runtime consolidation efforts, this PR simplifies the Android sample build process by moving default AOT properties to a common props file and using AndroidBuild.targets in AndroidSampleApp.


Fixes: #110811

@ivanpovazan ivanpovazan added NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) NO-REVIEW Experimental/testing PR, do NOT review it labels Jan 17, 2025
@ivanpovazan
Copy link
Member Author

/azp run runtime-android, runtime-androidemulator

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@ivanpovazan
Copy link
Member Author

/azp run runtime-android, runtime-androidemulator

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@ivanpovazan
Copy link
Member Author

/azp run runtime-android, runtime-androidemulator

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@ivanpovazan
Copy link
Member Author

/azp run runtime-android, runtime-androidemulator

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@ivanpovazan ivanpovazan changed the title [WIP][android] Internal Android build improvements [android] Internal Android sample build improvements Jan 19, 2025
@ivanpovazan ivanpovazan added os-android and removed NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) NO-REVIEW Experimental/testing PR, do NOT review it labels Jan 19, 2025
@ivanpovazan ivanpovazan added this to the 10.0.0 milestone Jan 19, 2025
@ivanpovazan ivanpovazan marked this pull request as ready for review January 19, 2025 19:21
@ivanpovazan ivanpovazan requested review from jkurdek and steveisok and removed request for steveisok, akoeplinger and vitek-karas January 19, 2025 19:21
@ivanpovazan
Copy link
Member Author

/azp run runtime-android, runtime-androidemulator

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@ivanpovazan
Copy link
Member Author

/azp run runtime-ioslike-mono

Copy link

No pipelines are associated with this pull request.

@ivanpovazan
Copy link
Member Author

/azp run runtime-ioslike

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

TaskName="NdkToolFinderTask"
AssemblyFile="$(MobileBuildTasksAssemblyPath)" />
<!-- Import default AOT arguments -->
<Import Condition="'$(RunAOTCompilation)' == 'true'" Project="$(RepoTasksDir)AotCompilerTask\MonoAOTCompiler.props" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path to the props file needs generically set similarly to how we locate the task assembly.

See

<UsingTask TaskName="MonoAOTCompiler" AssemblyFile="$(MonoAOTCompilerTasksAssemblyPath)" />

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll need to be shipped as well, so whatever property you define, add one here too.

<PropertyGroup>
<MonoTargetsTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tasks\${NetCoreAppToolCurrent}\MonoTargetsTasks.dll</MonoTargetsTasksAssemblyPath>
<MonoTargetsTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tasks\${NetFrameworkToolCurrent}\MonoTargetsTasks.dll</MonoTargetsTasksAssemblyPath>
</PropertyGroup>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, please see: 0b338b8

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Added a functional tests for testing library mode on CI,
  • Verified that the LibraryBuilder.Sdk.10.0.0-dev.nupkg contains the props file:
x _rels/.rels
x Microsoft.NET.Runtime.LibraryBuilder.Sdk.nuspec
x Icon.png
x LICENSE.TXT
x Sdk/AutoImport.props
x Sdk/Sdk.props
x Sdk/AndroidBuild.props
x Sdk/AndroidBuild.targets
x Sdk/AppleBuild.props
x Sdk/AppleBuild.targets
x Sdk/LibraryBuilder.props
x Sdk/LibraryBuilder.targets
x Sdk/CommonMobileBuild.props
x Sdk/MonoAOTCompiler.props
...
  • Verified that the properties are properly included with E2E test

@jkurdek
Copy link
Member

jkurdek commented Jan 21, 2025

I think we can close #110811 after the PR is merged

<ItemGroup Condition="'$(TargetOS)' == 'android' or '$(TargetOS)' == 'ios' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'maccatalyst'">
<!-- Default trampolines run out for libraries tests -->
<MonoAOTCompilerDefaultAotArguments Include="nimt-trampolines=2000" />
<MonoAOTCompilerDefaultAotArguments Include="ntrampolines=10000" />
<MonoAOTCompilerDefaultAotArguments Include="nrgctx-fetch-trampolines=256" />
<MonoAOTCompilerDefaultAotArguments Include="ngsharedvt-trampolines=4400" />
<MonoAOTCompilerDefaultAotArguments Include="nftnptr-arg-trampolines=4000" />
<MonoAOTCompilerDefaultAotArguments Include="nrgctx-trampolines=21000" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, seems we had different values between sample and android/build. Great to see it unified

@ivanpovazan
Copy link
Member Author

/azp run runtime-android, runtime-androidemulator, runtime-ioslike

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@ivanpovazan
Copy link
Member Author

/azp run runtime-android, runtime-androidemulator, runtime-ioslike

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@@ -94,7 +93,7 @@
<PropertyGroup>
<_AOTMode Condition="'$(UseMonoJustInterp)' != 'true'">Normal</_AOTMode>
<_AOTMode Condition="'$(UseMonoJustInterp)' == 'true'">JustInterp</_AOTMode>
<_AOTMode Condition="'$(ForceFullAOT)' == 'true'">Full</_AOTMode>
<_AOTMode Condition="'$(ForceAOT)' == 'true' and '$(AOTWithLibraryFiles)' != 'true'">Full</_AOTMode>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@steveisok not sure if this is correct but I noticed we were using an undocumented property ForceFullAOT (I found its usage only on your library sample repo).
So I switched it to this combination, maybe it needs a refinement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] [MonoAOT] Unify configuration between sample app and CI build
5 participants