[tests] Remove always-true AssertCommercialBuild() / CommercialBuildAvailable#11577
Open
jonathanpeppers wants to merge 2 commits into
Open
[tests] Remove always-true AssertCommercialBuild() / CommercialBuildAvailable#11577jonathanpeppers wants to merge 2 commits into
jonathanpeppers wants to merge 2 commits into
Conversation
…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>
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
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.CommercialBuildAvailableand theBaseTest.AssertCommercialBuild()helper. - Deleted all
AssertCommercialBuild ();callsites across device-integration and build-task test projects. - Simplified test logic that previously branched on
CommercialBuildAvailableto 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. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
PR #11529 inlined
external/android-platform-supportinto dotnet/android.Xamarin.Android.Common.Debugging.targetsis now always built and shipped, soTestEnvironment.CommercialBuildAvailableis alwaystrueandAssertCommercialBuild()is a no-op.Changes
TestEnvironment.CommercialBuildAvailableproperty.BaseTest.AssertCommercialBuild()helper.AssertCommercialBuild ();callsite (~40 lines across 19 files).CommercialBuildAvailablepredicate usages, since the value is alwaystrue:if (TestEnvironment.CommercialBuildAvailable) { X }→ unwrapped toXif (!TestEnvironment.CommercialBuildAvailable) { X }→ block deletedif (isRelease || !TestEnvironment.CommercialBuildAvailable)→if (isRelease)TestEnvironment.CommercialBuildAvailable ? "debug" : "release"→"debug"!(TestEnvironment.CommercialBuildAvailable && !isRelease)→isRelease!TestEnvironment.CommercialBuildAvailable && !isRelease→falseInstallAndRunTests.cs, theif (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 hitsgit grep -n CommercialBuildAvailable→ 0 hits.csfile matches the baseline (HEAD) delta exactly.