Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 4, 2025

This PR simplifies MSBuild integration test code by removing redundant explicit directory parameters from CreateDllBuilder() and CreateApkBuilder() calls where the default behavior already provides the same result.

Changes Made

The BaseTest.CreateDllBuilder() and BaseTest.CreateApkBuilder() methods have default parameters that automatically use Path.Combine("temp", TestName) when no directory is specified. Many tests were explicitly passing this same path, making the code more verbose than necessary.

Before:

using (var b = CreateApkBuilder(Path.Combine("temp", TestName))) {
    // test code
}

After:

using (var b = CreateApkBuilder()) {
    // test code
}

Scope

  • 67 method calls simplified across 17 test files
  • Modified files in both test directories:
    • src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ (11 files)
    • tests/MSBuildDeviceIntegration/Tests/ (6 files)

What Was NOT Changed

To preserve intentional test behavior, the following patterns were left unchanged:

  • Calls using variables or project names (e.g., Path.Combine("temp", TestName, libproj.ProjectName))
  • Calls with non-default cleanup parameters (e.g., cleanupOnDispose: false)
  • Calls with intentional descriptive directory names (e.g., "temp/ApplicationJavaClassProperties")
  • BuildHelper.CreateApkBuilder calls (different method with different signature)

Validation

  • ✅ All tests build successfully
  • ✅ Test path generation verified working correctly
  • ✅ No functional changes to test behavior - only code simplification

This cleanup makes the test code more concise and consistent by leveraging the existing default parameter behavior.

Fixes #10372.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

…plicit Path.Combine("temp", TestName) with default parameters

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] [tests] simplify CreateDllBuilder() and CreateApkBuilder() calls [tests] Simplify CreateDllBuilder() and CreateApkBuilder() calls to use default parameters Aug 4, 2025
Copilot AI requested a review from jonathanpeppers August 4, 2025 16:43
Copilot finished work on behalf of jonathanpeppers August 4, 2025 16:43
@jonathanpeppers
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jonathanpeppers jonathanpeppers marked this pull request as ready for review August 4, 2025 18:43
@jonathanpeppers jonathanpeppers enabled auto-merge (squash) August 4, 2025 18:44
@jonathanpeppers jonathanpeppers merged commit e044f97 into main Aug 4, 2025
23 of 60 checks passed
@jonathanpeppers jonathanpeppers deleted the copilot/fix-10372 branch August 4, 2025 19:38
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2025
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.

[tests] simplify CreateDllBuilder() and CreateApkBuilder() calls

2 participants