Skip to content

[tests] Remove always-true AssertCommercialBuild() / CommercialBuildAvailable#11577

Open
jonathanpeppers wants to merge 2 commits into
mainfrom
jonathanpeppers/drop-assert-commercial-build
Open

[tests] Remove always-true AssertCommercialBuild() / CommercialBuildAvailable#11577
jonathanpeppers wants to merge 2 commits into
mainfrom
jonathanpeppers/drop-assert-commercial-build

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

Context

PR #11529 inlined external/android-platform-support into dotnet/android. Xamarin.Android.Common.Debugging.targets is now always built and shipped, so TestEnvironment.CommercialBuildAvailable is always true and AssertCommercialBuild() is a no-op.

Changes

  • Removed TestEnvironment.CommercialBuildAvailable property.
  • Removed BaseTest.AssertCommercialBuild() helper.
  • Dropped every AssertCommercialBuild (); callsite (~40 lines across 19 files).
  • Simplified all CommercialBuildAvailable predicate usages, since the value is always true:
    • if (TestEnvironment.CommercialBuildAvailable) { X } → unwrapped to X
    • if (!TestEnvironment.CommercialBuildAvailable) { X } → block deleted
    • if (isRelease || !TestEnvironment.CommercialBuildAvailable)if (isRelease)
    • TestEnvironment.CommercialBuildAvailable ? "debug" : "release""debug"
    • !(TestEnvironment.CommercialBuildAvailable && !isRelease)isRelease
    • !TestEnvironment.CommercialBuildAvailable && !isReleasefalse
  • In InstallAndRunTests.cs, the if (TestEnvironment.CommercialBuildAvailable) { ... } else { ... } block keeps only the (now always-taken) true branch.

Out of scope

The MSBuild gates (_HasCommercialFiles, _AndroidFastDeploymentSupported, etc.) are intentionally left alone — those will follow in a separate PR.

Verification

  • git grep -n AssertCommercialBuild → 0 hits
  • git grep -n CommercialBuildAvailable → 0 hits
  • Brace-balance check on every modified .cs file matches the baseline (HEAD) delta exactly.

…vailable

PR #11529 inlined `external/android-platform-support` into dotnet/android.
`Xamarin.Android.Common.Debugging.targets` is now always built and shipped,
so `TestEnvironment.CommercialBuildAvailable` is always `true` and
`AssertCommercialBuild()` is a no-op.

Remove the dead predicate and helper, and drop all callsites:

* `TestEnvironment.CommercialBuildAvailable` property removed.
* `BaseTest.AssertCommercialBuild()` method removed.
* All ~50 callsites simplified:
  - `AssertCommercialBuild ();` lines deleted.
  - `if (TestEnvironment.CommercialBuildAvailable) { X }` unwrapped to `X`.
  - `if (!TestEnvironment.CommercialBuildAvailable) { X }` blocks deleted.
  - `if (isRelease || !TestEnvironment.CommercialBuildAvailable)` simplified
    to `if (isRelease)`.
  - `TestEnvironment.CommercialBuildAvailable ? "debug" : "release"` simplified
    to `"debug"`.
  - `!(TestEnvironment.CommercialBuildAvailable && !isRelease)` simplified
    to `isRelease`.
  - `!TestEnvironment.CommercialBuildAvailable && !isRelease` simplified
    to `false`.

The MSBuild gates (`_HasCommercialFiles`, `_AndroidFastDeploymentSupported`,
etc.) are intentionally left alone -- those will follow in a separate PR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 4, 2026 15:02
@jonathanpeppers
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the now-redundant “commercial build” gating in the test suite. Since Xamarin.Android.Common.Debugging.targets is now built and shipped as part of the repo consolidation, TestEnvironment.CommercialBuildAvailable was effectively always true and the related AssertCommercialBuild() calls were no-ops.

Changes:

  • Removed TestEnvironment.CommercialBuildAvailable and the BaseTest.AssertCommercialBuild() helper.
  • Deleted all AssertCommercialBuild (); callsites across device-integration and build-task test projects.
  • Simplified test logic that previously branched on CommercialBuildAvailable to the always-taken path.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/MSBuildDeviceIntegration/Tests/SystemApplicationTests.cs Removes redundant AssertCommercialBuild() gate.
tests/MSBuildDeviceIntegration/Tests/PerformanceTest.cs Removes redundant AssertCommercialBuild() gates from performance tests.
tests/MSBuildDeviceIntegration/Tests/MonoAndroidExportTest.cs Removes redundant AssertCommercialBuild() gates.
tests/MSBuildDeviceIntegration/Tests/InstantRunTest.cs Removes redundant AssertCommercialBuild() gates from fast-dev related tests.
tests/MSBuildDeviceIntegration/Tests/InstallTests.cs Removes redundant AssertCommercialBuild() gates from install/redeploy tests.
tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs Removes AssertCommercialBuild() gates and collapses CommercialBuildAvailable branches to the always-taken path.
tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs Simplifies runtime-ID logic and removes redundant AssertCommercialBuild() gates.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/TestEnvironment.cs Removes CommercialBuildAvailable property (formerly file-existence probe).
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/BaseTest.cs Removes AssertCommercialBuild() helper.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/TrimmableTypeMapBuildTests.cs Removes redundant AssertCommercialBuild() gate.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs Removes CommercialBuildAvailable conditional around incremental target-skip assertions.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ManifestTest.cs Removes redundant AssertCommercialBuild() gate.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/InvalidConfigTests.cs Removes redundant AssertCommercialBuild() gates.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/IncrementalBuildTest.cs Removes AssertCommercialBuild() gates and simplifies CommercialBuildAvailable-based assertions.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/DebuggingTasksTests.cs Removes redundant one-time AssertCommercialBuild() gate.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildWithLibraryTests.cs Removes redundant AssertCommercialBuild() gate.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs Removes CommercialBuildAvailable branching in incremental assertions.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.TestCaseSource.cs Replaces CommercialBuildAvailable-derived expected values with constants.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs Simplifies expectations that previously depended on CommercialBuildAvailable.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BindingBuildTest.cs Removes redundant AssertCommercialBuild() gate and simplifies incremental assertions.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AssetPackTests.cs Removes CommercialBuildAvailable conditional around target-skip assertions.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AotTests.cs Removes CommercialBuildAvailable conditionals around target-skip assertions.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs Removes AssertCommercialBuild() gates and simplifies CommercialBuildAvailable-based assertions.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidGradleProjectTests.cs Removes redundant AssertCommercialBuild() gate.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidDependenciesTests.cs Removes redundant AssertCommercialBuild() gate.

Comment thread tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants