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

[XABT] Break BuildApk into individual tasks for each content type. #9612

Merged
merged 4 commits into from
Dec 16, 2024

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Dec 11, 2024

Refactor BuildApk into individual tasks for each content type. This promotes easier understanding of which pieces are dependent on each other and on which MSBuild properties.

At this point, several of these tasks (like CollectAssemblyFilesForArchive) are still unconditionally creating and modifying files on every run. A future PR will separate these creations/modifications into separate targets that can be run incrementally.

Theoretically, this PR is likely a slight performance regression due to having more tasks and a little bit of duplicated logic, however this should be more than offset by the ability to run tasks incrementally in the future. (The performance difference is small enough that it isn't really measurable because it is within the variability of our build time.)

_BuildApkEmbed/_BuildApkFastDev target main This PR
Debug (FastDev) 2.674s 2.655s
Debug (EmbedAssembliesIntoApk = true) 64.384s 64.357s
Release 6.130s 6.094s

@jpobst jpobst force-pushed the break-apart-buildapk branch from 5a09742 to e4eaea9 Compare December 11, 2024 21:41
@jpobst jpobst force-pushed the break-apart-buildapk branch from 99aa87a to c9371c4 Compare December 12, 2024 18:57
@jpobst jpobst marked this pull request as ready for review December 13, 2024 00:06
Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

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

Overall looks good. 👍

I don't think we are going to notice the overhead of adding more MSBuild tasks that split up the work. And it seems nice to split up all this code!

It's probably in the order of microseconds/nanoseconds difference.

Comment on lines 294 to 296
// This method is used only for internal warnings which will never be shown to the end user, therefore there's
// no need to use coded warnings.
void LogSanitizerWarning (string message)
Copy link
Member

Choose a reason for hiding this comment

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

This is probably the original code, but what is a "internal warning"? This shows the warning to the user, how is it internal?

Copy link
Member

Choose a reason for hiding this comment

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

Seems like this should just use LogDebugMessage()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is original code, however it looks like it is only used for "checked" builds which requires the internal property $(_AndroidCheckedBuild) to be set. I updated the comment on it to mention this.


namespace Xamarin.Android.Tasks;

public class CollectNativeFilesForArchive : AndroidTask
Copy link
Member

Choose a reason for hiding this comment

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

The other ones had a summary, might be worth putting a quick one here, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Comment on lines +301 to +304
void LogSanitizerError (string message)
{
Log.LogError (message);
}
Copy link
Member

Choose a reason for hiding this comment

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

Similar to LogSanitizerWarning(), seems like we'd be better off using throw for some exception and get an automatic error code from our base MSBuild task class.

@jpobst jpobst force-pushed the break-apart-buildapk branch from 21d0b80 to 67a08df Compare December 13, 2024 18:39
@jpobst jpobst merged commit 6b91b04 into main Dec 16, 2024
55 of 58 checks passed
@jpobst jpobst deleted the break-apart-buildapk branch December 16, 2024 18:01
grendello added a commit that referenced this pull request Jan 7, 2025
* main: (25 commits)
  [CI] Break "Linux Tests" into 2 parallel jobs. (#9642)
  Fix `WorkloadDependencies.proj` build. (#9648)
  [CI] Set "WearOS Tests" parallelization to 2 agents. (#9639)
  [CI] Break "Package Tests" into 2 parallel jobs. (#9638)
  Bump to DevDiv/android-platform-support@3b4e16f1 (#9632)
  [NativeAOT] improve build logic, part 2 (#9631)
  Bump to dotnet/java-interop@2c06b3c2 (#9633)
  [NativeAOT] improve build logic, part 1 (#9614)
  [build] Generate `WorkloadDependencies.json` (#9613)
  [monodroid] remove `monodroid_get_log_categories()` (#9625)
  [monodroid] remove `_monodroid_get_identity_hash_code` (#9622)
  Bump to dotnet/java-interop@f800ea52 (#9607)
  [XABT] Break BuildApk into individual tasks for each content type. (#9612)
  [Mono.Android] Bind Android API-Baklava DP1 (#9594)
  [Xamarin.Android.Build.Tasks] Extract `BuildArchive` from `BuildApk` (#9556)
  [NativeAOT] MSBuild-related logic to get projects to build (#9583)
  [build] remove remnants of `OpenTK-1.0.dll` (#9610)
  [build] remove `Xamarin.Android.CSharp.targets` (#9609)
  [build] runtime "flavors" part 2 (#9598)
  Bump com.android.tools.build:manifest-merger to 31.7.3 (#9600)
  ...
grendello added a commit that referenced this pull request Jan 7, 2025
* dev/grendel/use-libc++: (25 commits)
  [CI] Break "Linux Tests" into 2 parallel jobs. (#9642)
  Fix `WorkloadDependencies.proj` build. (#9648)
  [CI] Set "WearOS Tests" parallelization to 2 agents. (#9639)
  [CI] Break "Package Tests" into 2 parallel jobs. (#9638)
  Bump to DevDiv/android-platform-support@3b4e16f1 (#9632)
  [NativeAOT] improve build logic, part 2 (#9631)
  Bump to dotnet/java-interop@2c06b3c2 (#9633)
  [NativeAOT] improve build logic, part 1 (#9614)
  [build] Generate `WorkloadDependencies.json` (#9613)
  [monodroid] remove `monodroid_get_log_categories()` (#9625)
  [monodroid] remove `_monodroid_get_identity_hash_code` (#9622)
  Bump to dotnet/java-interop@f800ea52 (#9607)
  [XABT] Break BuildApk into individual tasks for each content type. (#9612)
  [Mono.Android] Bind Android API-Baklava DP1 (#9594)
  [Xamarin.Android.Build.Tasks] Extract `BuildArchive` from `BuildApk` (#9556)
  [NativeAOT] MSBuild-related logic to get projects to build (#9583)
  [build] remove remnants of `OpenTK-1.0.dll` (#9610)
  [build] remove `Xamarin.Android.CSharp.targets` (#9609)
  [build] runtime "flavors" part 2 (#9598)
  Bump com.android.tools.build:manifest-merger to 31.7.3 (#9600)
  ...
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants