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

[One .NET] no longer produce .apk for IDE builds #5570

Merged

Conversation

jonathanpeppers
Copy link
Member

Related: #5436

In "legacy" Xamarin.Android, we have the following behavior:

  1. The Build target does not produce an .apk or sign it.
  2. Only SignAndroidPackage (or Install) would do this.

So if you hit F6, Ctrl+B, Command+B, etc. in Visual Studio, you don't
have to wait on a valid .apk file to be produced to get build
results. This is useful for incremental build performance -- and
developers' habit of hitting build all the time.

dotnet build has different behavior, because it should inherently
produce something that is runnable. dotnet build currently produces
an .apk file and signs it.

To match "legacy" Xamarin.Android's behavior in IDEs we could do
something different while in Visual Studio when
$(BuildingInsideVisualStudio) is set. This way we get the desired
behavior:

  • dotnet build at the command-line produces a signed .apk file.
  • IDEs will not produce an .apk on Build. However, when "deploy"
    occurs, the Install target will handle producing an .apk file as
    needed.

This allowed me to update the PerformanceTest that was adding
additional time under .NET 6 for producing .apk files. Our MSBuild
tests always set $(BuildingInsideVisualStudio) for testing.

I also updated the [Retry] attributes so the value was in one place.

Related: dotnet#5436

In "legacy" Xamarin.Android, we have the following behavior:

1. The `Build` target does not produce an `.apk` or sign it.
2. Only `SignAndroidPackage` (or `Install`) would do this.

So if you hit F6, Ctrl+B, Command+B, etc. in Visual Studio, you don't
have to wait on a valid `.apk` file to be produced to get build
results. This is useful for incremental build performance -- and
developers' habit of hitting build all the time.

`dotnet build` has different behavior, because it should inherently
produce something that is runnable. `dotnet build` currently produces
an `.apk` file and signs it.

To match "legacy" Xamarin.Android's behavior in IDEs we could do
something different while in Visual Studio when
`$(BuildingInsideVisualStudio)` is set. This way we get the desired
behavior:

* `dotnet build` at the command-line produces a signed `.apk` file.
* IDEs will not produce an `.apk` on `Build`. However, when "deploy"
  occurs, the `Install` target will handle producing an `.apk` file as
  needed.

This allowed me to update the `PerformanceTest` that was adding
additional time under .NET 6 for producing `.apk` files. Our MSBuild
tests always set `$(BuildingInsideVisualStudio)` for testing.

I also updated the `[Retry]` attributes so the value was in one place.
@jonathanpeppers jonathanpeppers marked this pull request as ready for review January 29, 2021 21:03
@jonpryor jonpryor merged commit 8c4ed9d into dotnet:master Jan 29, 2021
@jonathanpeppers jonathanpeppers deleted the dotnet-buildinginsidevisualstudio branch January 29, 2021 21:43
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 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