Skip to content

[Xamarin.Android.Build.Tasks] _LinkAssembliesNoShrink inputs #2945

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

Closed

Conversation

jonathanpeppers
Copy link
Member

Context: jonathanpeppers@5ec3e3a

In 5ec3e3a, I used a new @(_ResolvedUserMonoAndroidAssemblies) item
group to improve incremental build performance. Targets that only need
to perform work with MonoAndroid assemblies, can be skipped unless a
MonoAndroid assembly changes.

We can use this same technique with the linker for builds with
LinkMode=None. The only steps in this case are:

if (options.LinkNone) {
    pipeline.AppendStep (new FixAbstractMethodsStep ());
    pipeline.AppendStep (new OutputStep ());
    return pipeline;
}

FixAbstractMethodsStep only applies to MonoAndroid assemblies, so
we can use @(_ResolvedUserMonoAndroidAssemblies) to decide if
_LinkAssembliesNoShrink can be skipped.

For an incremental build with a XAML change, this target was taking:

424 ms  LinkAssemblies                             1 calls

This was the Xamarin.Forms app in this repo. I would say this improves
incremental build times by about 400ms for small apps.

Context: 5ec3e3a

In 5ec3e3a, I used a new `@(_ResolvedUserMonoAndroidAssemblies)` item
group to improve incremental build performance. Targets that only need
to perform work with `MonoAndroid` assemblies, can be skipped unless a
`MonoAndroid` assembly changes.

We can use this same technique with the linker for builds with
`LinkMode=None`. The only steps in this case are:

    if (options.LinkNone) {
        pipeline.AppendStep (new FixAbstractMethodsStep ());
        pipeline.AppendStep (new OutputStep ());
        return pipeline;
    }

`FixAbstractMethodsStep` only applies to `MonoAndroid` assemblies, so
we can use `@(_ResolvedUserMonoAndroidAssemblies)` to decide if
`_LinkAssembliesNoShrink` can be skipped.

For an incremental build with a XAML change, this target was taking:

    424 ms  LinkAssemblies                             1 calls

This was the Xamarin.Forms app in this repo. I would say this improves
incremental build times by about 400ms for small apps.
@jonpryor
Copy link
Contributor

jonpryor commented Apr 9, 2019

There are unit test failures, some of which aren't due to the typical "transient network errors": https://jenkins.mono-project.com/job/xamarin-android-pr-pipeline-release/476/testReport/junit/Xamarin.Android.Build.Tests/BuildTest/BuildIncrementingClassName___Release/

  Expected: not equal to "md52d9cf6333b8e95e8683a477bc589eda5/
md52d9cf6333b8e95e8683a477bc589eda5/MainActivity.class
md549c303d4c646be87691169f0a0012130/
md549c303d4c646be87691169f0a0012130/World1.class
mono/
mono/MonoPackageManager_Resources.class
mono/MonoRuntimeProvider.class
unnamedproject/
mono/android/
mono/android/app/
mono/android/app/ApplicationRegistration.class
mono/android/app/XamarinAndroidEnvironmentVariables.class
unnamedproject/unnamedproject/
unnamedproject/unnamedproject/R$drawable.class
unnamedproject/unnamedproject/R$id.class
unnamedproject/unnamedproject/R$layout.class
unnamedproject/unnamedproject/R$string.class
unnamedproject/unnamedproject/R.class
"
  But was:  "md52d9cf6333b8e95e8683a477bc589eda5/
md52d9cf6333b8e95e8683a477bc589eda5/MainActivity.class
md549c303d4c646be87691169f0a0012130/
md549c303d4c646be87691169f0a0012130/World1.class
mono/
mono/MonoPackageManager_Resources.class
mono/MonoRuntimeProvider.class
unnamedproject/
mono/android/
mono/android/app/
mono/android/app/ApplicationRegistration.class
mono/android/app/XamarinAndroidEnvironmentVariables.class
unnamedproject/unnamedproject/
unnamedproject/unnamedproject/R$drawable.class
unnamedproject/unnamedproject/R$id.class
unnamedproject/unnamedproject/R$layout.class
unnamedproject/unnamedproject/R$string.class
unnamedproject/unnamedproject/R.class
"

@jonathanpeppers
Copy link
Member Author

After more thought (and looking at build logs), this change would break things.

<LinkAssemblies/> is what puts assemblies in obj\Debug\android\assets for the APK or Fast Deployment. If we skipped when only a NetStandard assembly changed--it wouldn't make it on-device.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2024
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