Skip to content

[build] Remove Step_PrepareProps; fold values into eng/Versions.props#11613

Merged
simonrozsival merged 7 commits into
mainfrom
jonathanpeppers/remove-step-prepareprops
Jun 11, 2026
Merged

[build] Remove Step_PrepareProps; fold values into eng/Versions.props#11613
simonrozsival merged 7 commits into
mainfrom
jonathanpeppers/remove-step-prepareprops

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Jun 9, 2026

Copy link
Copy Markdown
Member

Continues the slow xaprepare removal. Recent precedent: #11568 (CopyExtraResultFilesForCI → YAML), #11580 (configuration.mk removal), #11529 (android-platform-support consolidation, which also dropped Step_PrepareExternalGitDependencies).

What

Step_PrepareProps generated external/Java.Interop/Configuration.Override.props (inside the submodule) by substituting two placeholders into build-tools/scripts/Configuration.Java.Interop.Override.in.props. The substituted properties (_XamarinAndroidCecilVersion, UtilityOutputFullPathCoreApps, XamarinAndroidToolsDirectory) are now supplied directly via the checked-in static file external/Java.Interop.override.props, which Java.Interop's own Directory.Build.props already auto-imports via the parent-dir convention added in dotnet/java-interop#872.

The shared version values (MonoCecilVersion, AndroidPackVersion, AndroidPackVersionSuffix) move into eng/Versions.props. Directory.Build.props and external/Java.Interop.override.props both <Import> it. No duplicate-import sentinel is needed because every code path that imports Configuration.props has already loaded Directory.Build.props (either via MSBuild auto-load or via the explicit <Import> in external/xamarin-android-tools.override.props).

MicrosoftAndroidSdkPackName stays in Configuration.props (it is OS-conditioned, not version-shaped, so it doesn't belong in Versions.props). The same 3-line OS-conditioned block is mirrored privately in external/Java.Interop.override.props as _MicrosoftAndroidSdkPackName, used only to compute UtilityOutputFullPathCoreApps for the Java.Interop build.

Also dropped:

  • Configurables.Paths.InstallMSBuildDir and its backing field — the only consumer was Step_PrepareProps.
  • The dead UtilityOutputFullPath line in the old template — Java.Interop's TargetFrameworkDependentValues.props unconditionally routes it to $(UtilityOutputFullPathCoreApps) anyway, so it was a no-op.

Updated build-tools/scripts/XAVersionInfo.targets (the GitBlame for <AndroidPackVersion> now points at eng/Versions.props) and Documentation/guides/HowToBranch.md to reflect the moves.

Why not just <Import> Directory.Build.props from the Java.Interop override?

That was the original idea. I prototyped it: importing dotnet/android's full props chain from external/Java.Interop.override.props flips DotNetTargetFrameworkVersion from 10.0 to 11.0 inside Java.Interop, and dotnet restore Java.Interop.csproj then fails with:

NETSDK1045: The current .NET SDK does not support targeting .NET 11.0

xamarin-android-tools.override.props gets away with the same trick only because its sole csproj sets AndroidToolsDisableMultiTargeting=true, which makes the TFM-clobber harmless. Java.Interop has no equivalent escape hatch.

eng/Versions.props is collision-free with Java.Interop (verified against the submodule sources — none of the existing entries collide), has no <Import> of its own, and is the safe minimal shared file.

Verification

On Windows:

  • dotnet build build-tools/xaprepare/xaprepare/xaprepare.csproj — 0 warnings, 0 errors.
  • From src/Xamarin.Android.Build.Tasks/: dotnet msbuild --getProperty:MonoCecilVersion,AndroidPackVersion,AndroidPackVersionSuffix,MicrosoftAndroidSdkPackName,MicrosoftAndroidSdkOutDir — values unchanged from baseline.
  • From external/Java.Interop/src/Java.Interop/:
    • dotnet msbuild --getProperty:DotNetTargetFramework,_XamarinAndroidCecilVersion,UtilityOutputFullPathCoreApps returns net10.0, 0.11.5, the expected packs/tools path.
    • dotnet restore Java.Interop.csproj succeeds (no NETSDK1045).

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Continues the slow xaprepare removal (precedent: #11568, #11580, #11529).

`Step_PrepareProps` generated `external/Java.Interop/Configuration.Override.props`
inside the submodule by substituting two placeholders into
`build-tools/scripts/Configuration.Java.Interop.Override.in.props`. The same
properties are now supplied directly via `external/Java.Interop.override.props`
(a checked-in static file at `external/` that Java.Interop's `Directory.Build.props`
auto-imports via the parent-dir convention added in dotnet/java-interop#872).

The shared properties (`MonoCecilVersion`, `AndroidPackVersion`,
`MicrosoftAndroidSdkPackName`) move into `eng/Versions.props`, which is then
imported from `Directory.Build.props`, `Configuration.props`, and the
Java.Interop override. A `_XAVersionsPropsImported` sentinel guards each
import to avoid an MSB4011 duplicate-import warning.

Why not import dotnet/android's full `Directory.Build.props` from the Java.Interop
override? Because that flips `DotNetTargetFrameworkVersion` from 10.0 to 11.0
inside Java.Interop, causing `dotnet restore` to fail with
`NETSDK1045: The current .NET SDK does not support targeting .NET 11.0`.
`eng/Versions.props` is collision-free with Java.Interop and safe to import.

Also dropped:
* `Configurables.Paths.InstallMSBuildDir` and its backing field
  (only consumer was `Step_PrepareProps`).
* The dead `UtilityOutputFullPath` line in the old template -- Java.Interop's
  `TargetFrameworkDependentValues.props` unconditionally routes it to
  `$(UtilityOutputFullPathCoreApps)` anyway.

Updated `build-tools/scripts/XAVersionInfo.targets` and
`Documentation/guides/HowToBranch.md` to reflect that `AndroidPackVersion`
now lives in `eng/Versions.props`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 9, 2026 18:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Removes the xaprepare-driven Step_PrepareProps generation step by moving shared version properties into eng/Versions.props and wiring Java.Interop overrides to consume those values via a checked-in external/Java.Interop.override.props.

Changes:

  • Introduced eng/Versions.props as the shared location for MonoCecilVersion, AndroidPackVersion, and MicrosoftAndroidSdkPackName, plus an _XAVersionsPropsImported sentinel to avoid duplicate-import warnings.
  • Updated Directory.Build.props, Configuration.props, and external/Java.Interop.override.props to import eng/Versions.props (guarded by the sentinel).
  • Deleted the obsolete Step_PrepareProps and its template input file, and updated supporting docs/targets to reference the new source of AndroidPackVersion.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
external/Java.Interop.override.props Imports eng/Versions.props and provides static Java.Interop override properties (incl. Cecil version + tools path).
eng/Versions.props Adds sentinel + centralizes shared version properties for dotnet/android and Java.Interop.
Documentation/guides/HowToBranch.md Updates branching guidance to point AndroidPackVersion edits to eng/Versions.props.
Directory.Build.props Imports eng/Versions.props and removes local definitions now centralized there.
Configuration.props Imports eng/Versions.props with sentinel guard; removes duplicated MicrosoftAndroidSdkPackName definitions.
build-tools/xaprepare/xaprepare/Steps/Step_PrepareProps.cs Deletes the xaprepare step that generated Java.Interop override props.
build-tools/xaprepare/xaprepare/Scenarios/Scenario_Standard.cs Removes the deleted step from the standard scenario.
build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs Removes InstallMSBuildDir path that was only used by the deleted step.
build-tools/scripts/XAVersionInfo.targets Updates GitBlame to track AndroidPackVersion in eng/Versions.props.
build-tools/scripts/Configuration.Java.Interop.Override.in.props Deletes the unused template file previously consumed by Step_PrepareProps.

jonathanpeppers and others added 3 commits June 9, 2026 13:17
Configuration.props no longer needs to import eng/Versions.props itself.
In every MSBuild path that imports Configuration.props, Directory.Build.props
has already been loaded (either by MSBuild auto-load, or by the explicit
<Import Project="..\Directory.Build.props" /> in
external/xamarin-android-tools.override.props). Since Directory.Build.props
imports eng/Versions.props, the properties are always available.

This means there is no duplicate-import scenario, so the
_XAVersionsPropsImported sentinel can be removed too.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
It is OS-conditioned, not version-shaped, so it does not belong in
eng/Versions.props. Mirror the same 3-line block inline in
external/Java.Interop.override.props (as a private _MicrosoftAndroidSdkPackName
so it cannot leak into the Java.Interop build) to keep Versions.props limited
to pure version values.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sits next to AndroidPackVersion now, where it logically belongs. Updated
Documentation/guides/HowToBranch.md to reflect the new location.

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 and others added 3 commits June 9, 2026 19:06
…e-step-prepareprops

# Conflicts:
#	Directory.Build.props
CodeBehindTests.PrepareProject copies the repo Directory.Build.props into
a per-test temp root so the synthesized project under temp/CodeBehind/...
sees our shared MSBuild props. After this PR, Directory.Build.props
unconditionally imports eng/Versions.props, so the copy must include that
file too -- otherwise MSB4019 fires on every CodeBehindTests build:

  Directory.Build.props(3,3): error MSB4019: The imported project
  ".../temp/CodeBehind/.../eng/Versions.props" was not found.

CopyFile already creates intermediate directories, so a single extra line
that places it under tempRoot/eng/Versions.props is sufficient.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Accidentally rolled back in d459a69 by `git add -A` while the submodule
worktree still pointed at the pre-merge commit. The merge with main had
correctly taken b881d21 from origin/main; this re-applies that pointer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@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 10, 2026
@simonrozsival simonrozsival merged commit ee0392c into main Jun 11, 2026
40 checks passed
@simonrozsival simonrozsival deleted the jonathanpeppers/remove-step-prepareprops branch June 11, 2026 08:31
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.

3 participants