dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.92k stars 526 forks source link

`_GeneratePackageManagerJava` runs on every incremental build #9212

Closed jonathanpeppers closed 1 month ago

jonathanpeppers commented 1 month ago

Android framework version

net9.0-android

Affected platform version

.NET 9

Description

I was testing our incremental build and noticed:

  1. An incremental build of a MAUI project, where I changed either C# or XAML

  2. This value changes each time:

image

image

This generates a new obj\Debug\net9.0-android\android\environment.arm64-v8a.ll each time, causing us to run _CompileNativeAssemblySources each time.

Could we use the same Guid for most Debug builds? Would only Release builds need a unique Guid?

/cc @grendello

Steps to Reproduce

  1. dotnet new maui
  2. F5 in VS
  3. Make a small code changes
  4. F5 in VS

Did you find any workaround?

No

Relevant log output

hellomaui_Debug_AnyCPU_Build_2024-08-16T11_28_53.1332631-05_00.binlog.zip

grendello commented 1 month ago

I don't think even Release builds need a unique build id, as far as we are concerned. The Guids we care about are the assembly MVIDs, and that only in Release builds when marshal methods are enabled. So we should be fine forcing the same build id in Debug (I wouldn't force it in Release, as something else somewhere may expect the id to be different).