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

[build] Generate workload-dependencies.json #9613

Merged
merged 7 commits into from
Dec 18, 2024
Merged

Conversation

jonpryor
Copy link
Member

Context: Releases.json loop
Context: xamarin/xamarin-macios#21779 (comment)

There is a desire to have the .NET Workloads have a machine readable description of what dependencies they require in order to run, in order to facilitate tooling that would check for these dependencies.

Add tools/workload-dependencies, a new tool which parses a "Xamarin Manifest" to generate workload-dependencies.json. The "canonical" location for the "Xamarin Manifest" is within external/android-platform-support/Feeds/AndroidManifestFeed_d17.12.xml; failing that, https://aka.ms/AndroidManifestFeed/d17-12 can be used.

Output of the tool is a JSON document specifying ther required JDK and Android SDK packages which the .NET for Android workload requires:

{
  "microsoft.net.sdk.android": {
    "workload": {
      "alias": [
        "android"
      ],
      "version": "35.0.100"
    },
    "jdk": {
      "version": "[17.0,18.0)",
      "recommendedVersion": "17.0.12"
    },
    "androidsdk": {
      "packages": [
        {
          "desc": "Android SDK Build-Tools 35",
          "sdkPackage": {
            "id": "build-tools;*",
            "version": "[30.0.2,30.0.3,31.0.0,32.0.0,33.0.0,33.0.1,33.0.2,33.0.3,34.0.0,35.0.0]",
            "recommendedId": "build-tools;35.0.0",
            "recommendedVersion": "35.0.0"
          },
          "optional": "false"
        },
        {
          "desc": "Android SDK Command-line Tools",
          "sdkPackage": {
            "id": "cmdline-tools;*",
            "version": "[5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0]",
            "recommendedId": "cmdline-tools;13.0",
            "recommendedVersion": "13.0"
          },
          "optional": "false"
        },
        {
          "desc": "Android SDK Platform 28",
          "sdkPackage": {
            "id": "platforms;android-*",
            "version": "[1,1,1,2,2,2,2,3,3,3,3,3,3,5,6]",
            "recommendedId": "platforms;android-28",
            "recommendedVersion": "6"
          },
          "optional": "false"
        },
        {
          "desc": "Android SDK Platform-Tools",
          "sdkPackage": {
            "id": "platform-tools",
            "version": "[33.0.2,33.0.3,34.0.1,34.0.3,34.0.4,34.0.5,35.0.1,35.0.2]",
            "recommendedId": "platform-tools",
            "recommendedVersion": "35.0.2"
          },
          "optional": "false"
        },
        …
      ]
    }
  }
}

@jonpryor jonpryor force-pushed the dev/jonp/jonp-release-json branch from e813874 to 6c1525c Compare December 12, 2024 17:07
@jonpryor jonpryor requested a review from Copilot December 12, 2024 17:18

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 3 changed files in this pull request and generated no suggestions.

Files not reviewed (2)
  • build-tools/create-packs/Microsoft.NET.Sdk.Android.proj: Language not supported
  • tools/workload-dependencies/workload-dependencies.csproj: Language not supported
Comments skipped due to low confidence (2)

tools/workload-dependencies/Program.cs:277

  • The error message should specify the element that is missing the required attribute for better debugging.
throw new InvalidOperationException ($"Missing required attribute `{attribute}` in: `{e}");

tools/workload-dependencies/Program.cs:219

  • The CreatePackagesArray method should have test coverage to ensure its correctness.
JArray CreatePackagesArray (XDocument doc)
Context: [`Releases.json` loop][0]
Context: xamarin/xamarin-macios#21779 (comment)

There is a desire to have the .NET Workloads have a machine readable
description of what dependencies they require in order to run, in
order to facilitate tooling that would check for these dependencies.

Add `tools/workload-dependencies`, a new tool which parses a
"Xamarin Manifest" to generate `workload-dependencies.json`.
The "canonical" location for the "Xamarin Manifest" is within
`external/android-platform-support/Feeds/AndroidManifestFeed_d17.12.xml`;
failing that, <https://aka.ms/AndroidManifestFeed/d17-12> can be used.

Output of the tool is a JSON document specifying ther required JDK
and Android SDK packages which the .NET for Android workload requires:

	{
	  "microsoft.net.sdk.android": {
	    "workload": {
	      "alias": [
	        "android"
	      ],
	      "version": "35.0.100"
	    },
	    "jdk": {
	      "version": "[17.0,18.0)",
	      "recommendedVersion": "17.0.12"
	    },
	    "androidsdk": {
	      "packages": [
	        {
	          "desc": "Android SDK Build-Tools 35",
	          "sdkPackage": {
	            "id": "build-tools;*",
	            "version": "[30.0.2,30.0.3,31.0.0,32.0.0,33.0.0,33.0.1,33.0.2,33.0.3,34.0.0,35.0.0]",
	            "recommendedId": "build-tools;35.0.0",
	            "recommendedVersion": "35.0.0"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Android SDK Command-line Tools",
	          "sdkPackage": {
	            "id": "cmdline-tools;*",
	            "version": "[5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0]",
	            "recommendedId": "cmdline-tools;13.0",
	            "recommendedVersion": "13.0"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Android SDK Platform 35",
	          "sdkPackage": {
	            "id": "platforms;android-*",
	            "version": "[2,2,3,2,3,2,3,6,5,3,1,1,3,3,1]",
	            "recommendedId": "platforms;android-35",
	            "recommendedVersion": "1"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Android SDK Platform-Tools",
	          "sdkPackage": {
	            "id": "platform-tools",
	            "version": "[33.0.2,33.0.3,34.0.1,34.0.3,34.0.4,34.0.5,35.0.1,35.0.2]",
	            "recommendedId": "platform-tools",
	            "recommendedVersion": "35.0.2"
	          },
	          "optional": "false"
	        },
	        …
	      ]
	    }
	  }
	}

[0]: https://loop.cloud.microsoft/p/eyJ1IjoiaHR0cHM6Ly9taWNyb3NvZnQuc2hhcmVwb2ludC1kZi5jb20vc2l0ZXMvYzIyZmVjMDMtN2I4OS00OTJhLTgzNzQtZmZjMTI4YjMwMWRhP25hdj1jejBsTWtaemFYUmxjeVV5Um1NeU1tWmxZekF6TFRkaU9Ea3RORGt5WVMwNE16YzBMV1ptWXpFeU9HSXpNREZrWVNaa1BXSWxNakZXTUhSeU9XY3dRbk5WYlhVdFJWUjNRVEZNY0dOSmQwdG1VVEZUZFVFeFRuRk5XbVZ3TUhVd1dUaEhkVVpKVlRSUGIxWnlVMWxoZFRaT2RFODRTamhISm1ZOU1ERlhSelkwU0RNMU56TlZRbEpITWs1TU1rSkdTemRZV1ZCWFJqSlNTRVJQVENaalBTVXlSaVpoUFV4dmIzQkJjSEFtY0QwbE5EQm1iSFZwWkhnbE1rWnNiMjl3TFhCaFoyVXRZMjl1ZEdGcGJtVnlKbmc5SlRkQ0pUSXlkeVV5TWlVelFTVXlNbFF3VWxSVlNIaDBZVmRPZVdJelRuWmFibEYxWXpKb2FHTnRWbmRpTW14MVpFTXhhMXBwTldwaU1qRTRXV2xHVjAxSVVubFBWMk4zVVc1T1ZtSllWWFJTVmxJelVWUkdUV05IVGtwa01IUnRWVlJHVkdSVlJYaFVia1pPVjIxV2QwMUlWWGRYVkdoSVpGVmFTbFpVVWxCaU1WcDVWVEZzYUdSVVdrOWtSVGcwVTJwb1NHWkVRWGhXTUdNeVRrVm5lazU2VGtwVU1WRXdWMnQwUmxGNldrdFRSbXhaVlRCYVVWUlZhRlJXUlVaRFYyeEZKVE5FSlRJeUpUSkRKVEl5YVNVeU1pVXpRU1V5TWprNE5HUXhZMlpoTFRnMVpXUXROR1kyWXkxaU9EWmlMVFJtTXpZMU1EQXlaak5tTnlVeU1pVTNSQT09In0%3D?ct=1728330820992&
@jonpryor jonpryor force-pushed the dev/jonp/jonp-release-json branch from 6c1525c to 26e4019 Compare December 12, 2024 17:53
<_Feed Condition=" Exists($(_AndroidPlatformSupportFeed)) ">$(_AndroidPlatformSupportFeed)</_Feed>
<_Feed Condition=" '$(_Feed)' == '' ">https://aka.ms/AndroidManifestFeed/d17-12</_Feed>
<_Project>$(MSBuildThisFileDirectory)/../../tools/workload-dependencies/workload-dependencies.csproj</_Project>
<WorkloadDependenciesPath Condition="'$(WorkloadDependenciesPath)' == ''">$(OutputPath)workload-manifest\workload-dependencies.json</WorkloadDependenciesPath>
Copy link
Member

Choose a reason for hiding this comment

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

Is this the right file name? Because this puts the file alongside:

data/workload-dependencies.json
data/WorkloadManifest.json
data/WorkloadManifest.targets

It's named WorkloadDependencies.json on the xamarin-macios PR:

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question! The spec called for workload-dependencies.json, but has since changed. I'll need to update.

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

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

Regarding the block:

        {
          "desc": "Android SDK Platform 28",
          "sdkPackage": {
            "id": "platforms;android-*",
            "version": "[1,1,1,2,2,2,2,3,3,3,3,3,3,5,6]",
            "recommendedId": "platforms;android-28",
            "recommendedVersion": "6"
          },
          "optional": "false"
        },

In .NET 9 Preview 6:

We required API-34 for the android workload and API-35 for the preview android-35 workload.

Do we need the ability to have different requirements per workload? This file gives one version for every workload in the manifest.

@jonpryor
Copy link
Member Author

@jonathanpeppers wrote:

Regarding the block…

I had a chat with @Redth, and I'm gonna need to simplify and constrain the output. For starters:

  • No more version keys; I don't see how they're helpful.
  • No more wildcards; platforms/android-* isn't helpful either!
  • No more "bizarro optional" packages; extras such as extras;google;instantapps are not helpful.
  • More integration with dotnet/android: we should list one platforms/android-* value, and it should be the default API level as per $(AndroidLatestStableApiLevel)
  • Ditto for the JDK, and should be based on some form of $(JavaSdkVersion), so that if/when we bump that to 21, it's correctly updated.

Context: #9613 (comment)

A lot of the previous output was nonsensical, especially around
`version`s, in large part because I was trying to associate
the `//*/@revision` attribute in the Feed to a version.
This sometimes works, e.g. for build-tools and platform-tools,
but would fail horribly for things like `<platform/>`, resulting
in JSON fragments such as:

	{
	  "desc": "Android SDK Platform 28",
	  "sdkPackage": {
	    "id": "platforms;android-*",
	    "version": "[1,1,1,2,2,2,2,3,3,3,3,3,3,5,6]",
	    "recommendedId": "platforms;android-28",
	    "recommendedVersion": "6"
	  },
	  "optional": "false"
	},

Make to fundamental architectural changes:

 1. Instead of trying to emit JSON for *everything* in the feed,
    only emit JSON for a minimal subset of known required+optional
    pieces, such as platform-tools (required) and the emulator
    and system images (optional).

 2. Drop the idea of "version", "recommendedId", and
    "recommendedVersion".

This results in a much smaller and more sensible:

	{
	  "microsoft.net.sdk.android": {
	    "workload": {
	      "alias": [
	        "android"
	      ],
	      "version": "35.0.100"
	    },
	    "jdk": {
	      "version": "[17.0,18.0)",
	      "recommendedVersion": "17.0.12"
	    },
	    "androidsdk": {
	      "packages": [
	        {
	          "desc": "Android SDK Build-Tools 35",
	          "sdkPackage": {
	            "id": "build-tools;35.0.0"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Android SDK Command-line Tools",
	          "sdkPackage": {
	            "id": "cmdline-tools;13.0"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Android Emulator",
	          "sdkPackage": {
	            "id": "emulator"
	          },
	          "optional": "true"
	        },
	        {
	          "desc": "NDK (Side by side) 27.1.12297006",
	          "sdkPackage": {
	            "id": "ndk;27.1.12297006"
	          },
	          "optional": "true"
	        },
	        {
	          "desc": "Android SDK Platform 35",
	          "sdkPackage": {
	            "id": "platforms;android-35"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Android SDK Platform Baklava (Preview)",
	          "sdkPackage": {
	            "id": "platforms;android-Baklava"
	          },
	          "optional": "true"
	        },
	        {
	          "desc": "Android SDK Platform-Tools",
	          "sdkPackage": {
	            "id": "platform-tools"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Google APIs ARM 64 v8a System Image",
	          "sdkPackage": {
	            "id": {
	              "win-x64": "system-images;android-35;google_apis;x86_64",
	              "mac-x64": "system-images;android-35;google_apis;x86_64",
	              "linux-x64": "system-images;android-35;google_apis;x86_64",
	              "mac-arm64": "system-images;android-35;google_apis;arm64-v8a",
	              "linux-arm64": "system-images;android-35;google_apis;arm64-v8a"
	            }
	          },
	          "optional": "true"
	        }
	      ]
	    }
	  }
	}
@jonpryor
Copy link
Member Author

@Redth : how does the JSON mentioned here look? 52182a0

@jonpryor
Copy link
Member Author

@jonathanpeppers: the "Android SDK Platform" block is now:

        {
          "desc": "Android SDK Platform 35",
          "sdkPackage": {
            "id": "platforms;android-35"
          },
          "optional": "false"
        },

This also has a "solution" around preview packages: list is as optional:

        {
          "desc": "Android SDK Platform Baklava (Preview)",
          "sdkPackage": {
            "id": "platforms;android-Baklava"
          },
          "optional": "true"
        },

@jonpryor
Copy link
Member Author

jonpryor commented Dec 16, 2024

Draft commit message:

Context: [`Releases.json` loop][0]
Context: https://github.com/xamarin/xamarin-macios/pull/21779#discussion_r1876519440
Context: 51151d727a0438dd049ad2678f9039d8f255d7b2
Context: 60bb447b869de9bce3d9f0bf754ea2a493d0709f
Context: f9b2c972263f279aba52919d2b442a319d7c7ad0

The `GetAndroidDependencies` target (f9b2c972) and the
`InstallAndroidDependencies` target (60bb447b) are used to determine
and install the Android SDK dependencies required to build a project.

Unfortunately, in order to run these targets, a project must exist!

There is a desire to have the .NET Workloads contain machine readable
descriptions of what dependencies they require in order to run, in
order to facilitate tooling that would check for these dependencies
*without* requiring that a project exist.

Add `tools/workload-dependencies`, a new tool which parses a
"Xamarin Manifest" to generate `WorkloadDependencies.json`,
with versions controlled by `Xamarin.Installer.Common.props`
(51151d72).  The "canonical" location for the "Xamarin Manifest" is
`external/android-platform-support/Feeds/AndroidManifestFeed_d17.12.xml`;
failing that, <https://aka.ms/AndroidManifestFeed/d17-12> can be used.

Output of the tool is a JSON document specifying ther required JDK
and Android SDK packages which the .NET for Android workload requires:

	{
	  "microsoft.net.sdk.android": {
	    "workload": {
	      "alias": [
	        "android"
	      ],
	      "version": "35.99.0-ci.pr.gh9613.79"
	    },
	    "jdk": {
	      "version": "[17.0,18.0)",
	      "recommendedVersion": "17.0.12"
	    },
	    "androidsdk": {
	      "packages": [
	        {
	          "desc": "Android SDK Build-Tools 35",
	          "sdkPackage": {
	            "id": "build-tools;35.0.0"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Android SDK Command-line Tools",
	          "sdkPackage": {
	            "id": "cmdline-tools;12.0"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Android Emulator",
	          "sdkPackage": {
	            "id": "emulator",
	            "recommendedVersion": "35.1.20"
	          },
	          "optional": "true"
	        },
	        {
	          "desc": "NDK (Side by side) 26.1.10909125",
	          "sdkPackage": {
	            "id": "ndk;26.1.10909125"
	          },
	          "optional": "true"
	        },
	        {
	          "desc": "Android SDK Platform 35",
	          "sdkPackage": {
	            "id": "platforms;android-35"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Android SDK Platform Baklava (Preview)",
	          "sdkPackage": {
	            "id": "platforms;android-Baklava"
	          },
	          "optional": "true"
	        },
	        {
	          "desc": "Android SDK Platform-Tools",
	          "sdkPackage": {
	            "id": "platform-tools",
	            "recommendedVersion": "34.0.5"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Google APIs ARM 64 v8a System Image",
	          "sdkPackage": {
	            "id": {
	              "win-x64": "system-images;android-35;google_apis;x86_64",
	              "mac-x64": "system-images;android-35;google_apis;x86_64",
	              "linux-x64": "system-images;android-35;google_apis;x86_64",
	              "mac-arm64": "system-images;android-35;google_apis;arm64-v8a",
	              "linux-arm64": "system-images;android-35;google_apis;arm64-v8a"
	            }
	          },
	          "optional": "true"
	        }
	      ]
	    }
	  }
	}

[0]: https://loop.cloud.microsoft/p/eyJ1IjoiaHR0cHM6Ly9taWNyb3NvZnQuc2hhcmVwb2ludC1kZi5jb20vc2l0ZXMvYzIyZmVjMDMtN2I4OS00OTJhLTgzNzQtZmZjMTI4YjMwMWRhP25hdj1jejBsTWtaemFYUmxjeVV5Um1NeU1tWmxZekF6TFRkaU9Ea3RORGt5WVMwNE16YzBMV1ptWXpFeU9HSXpNREZrWVNaa1BXSWxNakZXTUhSeU9XY3dRbk5WYlhVdFJWUjNRVEZNY0dOSmQwdG1VVEZUZFVFeFRuRk5XbVZ3TUhVd1dUaEhkVVpKVlRSUGIxWnlVMWxoZFRaT2RFODRTamhISm1ZOU1ERlhSelkwU0RNMU56TlZRbEpITWs1TU1rSkdTemRZV1ZCWFJqSlNTRVJQVENaalBTVXlSaVpoUFV4dmIzQkJjSEFtY0QwbE5EQm1iSFZwWkhnbE1rWnNiMjl3TFhCaFoyVXRZMjl1ZEdGcGJtVnlKbmc5SlRkQ0pUSXlkeVV5TWlVelFTVXlNbFF3VWxSVlNIaDBZVmRPZVdJelRuWmFibEYxWXpKb2FHTnRWbmRpTW14MVpFTXhhMXBwTldwaU1qRTRXV2xHVjAxSVVubFBWMk4zVVc1T1ZtSllWWFJTVmxJelVWUkdUV05IVGtwa01IUnRWVlJHVkdSVlJYaFVia1pPVjIxV2QwMUlWWGRYVkdoSVpGVmFTbFpVVWxCaU1WcDVWVEZzYUdSVVdrOWtSVGcwVTJwb1NHWkVRWGhXTUdNeVRrVm5lazU2VGtwVU1WRXdWMnQwUmxGNldrdFRSbXhaVlRCYVVWUlZhRlJXUlVaRFYyeEZKVE5FSlRJeUpUSkRKVEl5YVNVeU1pVXpRU1V5TWprNE5HUXhZMlpoTFRnMVpXUXROR1kyWXkxaU9EWmlMVFJtTXpZMU1EQXlaak5tTnlVeU1pVTNSQT09In0%3D?ct=1728330820992&

@jonpryor
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Context: 51151d7

Commit 51151d7 laid out a conundrum: dotnet/android builds against
one set of versioned dependencies, but we want the "Xamarin Manifest"
to *actually* dictate the preferred package versions, as this makes
it easier to keep versions in sync with the VS installer/etc.

The problem is that commits prior to this point ignored the
`Xamarin.Installer.Common.props` described in 51151d7.

Additionally, many of the MSBuild properties are (1) "conditional" --
only setting a value if not overridden -- and (2) have the same
names as the properties within `Xamarin.Installer.Common.props`.

Square this circle by doing two things:

 1. Add `tools/workload-dependencies/WorkloadDependencies.proj`
    alongside `tools/workload-dependencies/Directory.Build.props`,
    which allows for an "isolated" environment, one in which
    *only* `Xamarin.Installer.Common.props` and
    `Xamarin.Android.Common.props` are imported.

    This allows us to cleanly ensure that
    `Xamarin.Installer.Common.props` controls things.

 2. Update `Microsoft.NET.Sdk.Android.proj` to use the
    `<MSBuild/>` task to invoke `WorkloadDependencies.proj`,
    providing all MSBuild properties required for things to work.

This should ensure that package versions are consistent.

Additionally, update `Program.cs` so that the `platform-tools`
package contains a `requestedRevision` property.
The `platform-tools` package is *unversioned*, so this is the only
way to get some semblance of versioning involved.
@jonpryor jonpryor force-pushed the dev/jonp/jonp-release-json branch from 32bd57e to 1510e87 Compare December 17, 2024 20:30
@jonpryor
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jonpryor
Copy link
Member Author

Current JSON output:

{
  "microsoft.net.sdk.android": {
    "workload": {
      "alias": [
        "android"
      ],
      "version": "35.99.0-ci.pr.gh9613.79"
    },
    "jdk": {
      "version": "[17.0,18.0)",
      "recommendedVersion": "17.0.12"
    },
    "androidsdk": {
      "packages": [
        {
          "desc": "Android SDK Build-Tools 35",
          "sdkPackage": {
            "id": "build-tools;35.0.0"
          },
          "optional": "false"
        },
        {
          "desc": "Android SDK Command-line Tools",
          "sdkPackage": {
            "id": "cmdline-tools;12.0"
          },
          "optional": "false"
        },
        {
          "desc": "Android Emulator",
          "sdkPackage": {
            "id": "emulator",
            "requestedRevision": "35.1.20"
          },
          "optional": "true"
        },
        {
          "desc": "NDK (Side by side) 26.1.10909125",
          "sdkPackage": {
            "id": "ndk;26.1.10909125"
          },
          "optional": "true"
        },
        {
          "desc": "Android SDK Platform 35",
          "sdkPackage": {
            "id": "platforms;android-35"
          },
          "optional": "false"
        },
        {
          "desc": "Android SDK Platform Baklava (Preview)",
          "sdkPackage": {
            "id": "platforms;android-Baklava"
          },
          "optional": "true"
        },
        {
          "desc": "Android SDK Platform-Tools",
          "sdkPackage": {
            "id": "platform-tools",
            "requestedRevision": "34.0.5"
          },
          "optional": "false"
        },
        {
          "desc": "Google APIs ARM 64 v8a System Image",
          "sdkPackage": {
            "id": {
              "win-x64": "system-images;android-35;google_apis;x86_64",
              "mac-x64": "system-images;android-35;google_apis;x86_64",
              "linux-x64": "system-images;android-35;google_apis;x86_64",
              "mac-arm64": "system-images;android-35;google_apis;arm64-v8a",
              "linux-arm64": "system-images;android-35;google_apis;arm64-v8a"
            }
          },
          "optional": "true"
        }
      ]
    }
  }
}

@Redth
Copy link
Member

Redth commented Dec 17, 2024

For the android emulator... s/requestedVersion/recommendedVersion ?

and then also i think the logic will be if there's no version value, any version installed is considered acceptable, however if you have nothing installed, we'll install the recommendedVersion

@jonpryor
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).


<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
Copy link
Member

@jonathanpeppers jonathanpeppers Dec 17, 2024

Choose a reason for hiding this comment

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

Can this be either $(DotNetStableTargetFramework) or $(DotNetTargetFramework)? So would be net9.0 vs net10.0 when we get on .NET 10.

@jonpryor
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jonpryor jonpryor merged commit 0d4c1cb into main Dec 18, 2024
58 checks passed
@jonpryor jonpryor deleted the dev/jonp/jonp-release-json branch December 18, 2024 14:39
jonpryor added a commit that referenced this pull request Dec 18, 2024
Context: [`Releases.json` loop][0]
Context: xamarin/xamarin-macios#21779 (comment)
Context: 51151d7
Context: 60bb447
Context: f9b2c97

The `GetAndroidDependencies` target (f9b2c97) and the
`InstallAndroidDependencies` target (60bb447) are used to determine
and install the Android SDK dependencies required to build a project.

Unfortunately, in order to run these targets, a project must exist!

There is a desire to have the .NET Workloads contain machine readable
descriptions of what dependencies they require in order to run, in
order to facilitate tooling that would check for these dependencies
*without* requiring that a project exist.

Add `tools/workload-dependencies`, a new tool which parses a
"Xamarin Manifest" to generate `WorkloadDependencies.json`,
with versions controlled by `Xamarin.Installer.Common.props`
(51151d7).  The "canonical" location for the "Xamarin Manifest" is
`external/android-platform-support/Feeds/AndroidManifestFeed_d17.12.xml`;
failing that, <https://aka.ms/AndroidManifestFeed/d17-12> can be used.

Output of the tool is a JSON document specifying ther required JDK
and Android SDK packages which the .NET for Android workload requires.
This document is `data/WorkloadDependencies.json` within the
`Microsoft.NET.Sdk.Android.Manifest*.nupkg` NuGet package.

	{
	  "microsoft.net.sdk.android": {
	    "workload": {
	      "alias": [
	        "android"
	      ],
	      "version": "35.99.0-ci.pr.gh9613.79"
	    },
	    "jdk": {
	      "version": "[17.0,18.0)",
	      "recommendedVersion": "17.0.12"
	    },
	    "androidsdk": {
	      "packages": [
	        {
	          "desc": "Android SDK Build-Tools 35",
	          "sdkPackage": {
	            "id": "build-tools;35.0.0"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Android SDK Command-line Tools",
	          "sdkPackage": {
	            "id": "cmdline-tools;12.0"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Android Emulator",
	          "sdkPackage": {
	            "id": "emulator",
	            "recommendedVersion": "35.1.20"
	          },
	          "optional": "true"
	        },
	        {
	          "desc": "NDK (Side by side) 26.1.10909125",
	          "sdkPackage": {
	            "id": "ndk;26.1.10909125"
	          },
	          "optional": "true"
	        },
	        {
	          "desc": "Android SDK Platform 35",
	          "sdkPackage": {
	            "id": "platforms;android-35"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Android SDK Platform Baklava (Preview)",
	          "sdkPackage": {
	            "id": "platforms;android-Baklava"
	          },
	          "optional": "true"
	        },
	        {
	          "desc": "Android SDK Platform-Tools",
	          "sdkPackage": {
	            "id": "platform-tools",
	            "recommendedVersion": "34.0.5"
	          },
	          "optional": "false"
	        },
	        {
	          "desc": "Google APIs ARM 64 v8a System Image",
	          "sdkPackage": {
	            "id": {
	              "win-x64": "system-images;android-35;google_apis;x86_64",
	              "mac-x64": "system-images;android-35;google_apis;x86_64",
	              "linux-x64": "system-images;android-35;google_apis;x86_64",
	              "mac-arm64": "system-images;android-35;google_apis;arm64-v8a",
	              "linux-arm64": "system-images;android-35;google_apis;arm64-v8a"
	            }
	          },
	          "optional": "true"
	        }
	      ]
	    }
	  }
	}

[0]: https://loop.cloud.microsoft/p/eyJ1IjoiaHR0cHM6Ly9taWNyb3NvZnQuc2hhcmVwb2ludC1kZi5jb20vc2l0ZXMvYzIyZmVjMDMtN2I4OS00OTJhLTgzNzQtZmZjMTI4YjMwMWRhP25hdj1jejBsTWtaemFYUmxjeVV5Um1NeU1tWmxZekF6TFRkaU9Ea3RORGt5WVMwNE16YzBMV1ptWXpFeU9HSXpNREZrWVNaa1BXSWxNakZXTUhSeU9XY3dRbk5WYlhVdFJWUjNRVEZNY0dOSmQwdG1VVEZUZFVFeFRuRk5XbVZ3TUhVd1dUaEhkVVpKVlRSUGIxWnlVMWxoZFRaT2RFODRTamhISm1ZOU1ERlhSelkwU0RNMU56TlZRbEpITWs1TU1rSkdTemRZV1ZCWFJqSlNTRVJQVENaalBTVXlSaVpoUFV4dmIzQkJjSEFtY0QwbE5EQm1iSFZwWkhnbE1rWnNiMjl3TFhCaFoyVXRZMjl1ZEdGcGJtVnlKbmc5SlRkQ0pUSXlkeVV5TWlVelFTVXlNbFF3VWxSVlNIaDBZVmRPZVdJelRuWmFibEYxWXpKb2FHTnRWbmRpTW14MVpFTXhhMXBwTldwaU1qRTRXV2xHVjAxSVVubFBWMk4zVVc1T1ZtSllWWFJTVmxJelVWUkdUV05IVGtwa01IUnRWVlJHVkdSVlJYaFVia1pPVjIxV2QwMUlWWGRYVkdoSVpGVmFTbFpVVWxCaU1WcDVWVEZzYUdSVVdrOWtSVGcwVTJwb1NHWkVRWGhXTUdNeVRrVm5lazU2VGtwVU1WRXdWMnQwUmxGNldrdFRSbXhaVlRCYVVWUlZhRlJXUlVaRFYyeEZKVE5FSlRJeUpUSkRKVEl5YVNVeU1pVXpRU1V5TWprNE5HUXhZMlpoTFRnMVpXUXROR1kyWXkxaU9EWmlMVFJtTXpZMU1EQXlaak5tTnlVeU1pVTNSQT09In0%3D?ct=1728330820992&
grendello added a commit that referenced this pull request Jan 7, 2025
* main: (25 commits)
  [CI] Break "Linux Tests" into 2 parallel jobs. (#9642)
  Fix `WorkloadDependencies.proj` build. (#9648)
  [CI] Set "WearOS Tests" parallelization to 2 agents. (#9639)
  [CI] Break "Package Tests" into 2 parallel jobs. (#9638)
  Bump to DevDiv/android-platform-support@3b4e16f1 (#9632)
  [NativeAOT] improve build logic, part 2 (#9631)
  Bump to dotnet/java-interop@2c06b3c2 (#9633)
  [NativeAOT] improve build logic, part 1 (#9614)
  [build] Generate `WorkloadDependencies.json` (#9613)
  [monodroid] remove `monodroid_get_log_categories()` (#9625)
  [monodroid] remove `_monodroid_get_identity_hash_code` (#9622)
  Bump to dotnet/java-interop@f800ea52 (#9607)
  [XABT] Break BuildApk into individual tasks for each content type. (#9612)
  [Mono.Android] Bind Android API-Baklava DP1 (#9594)
  [Xamarin.Android.Build.Tasks] Extract `BuildArchive` from `BuildApk` (#9556)
  [NativeAOT] MSBuild-related logic to get projects to build (#9583)
  [build] remove remnants of `OpenTK-1.0.dll` (#9610)
  [build] remove `Xamarin.Android.CSharp.targets` (#9609)
  [build] runtime "flavors" part 2 (#9598)
  Bump com.android.tools.build:manifest-merger to 31.7.3 (#9600)
  ...
grendello added a commit that referenced this pull request Jan 7, 2025
* dev/grendel/use-libc++: (25 commits)
  [CI] Break "Linux Tests" into 2 parallel jobs. (#9642)
  Fix `WorkloadDependencies.proj` build. (#9648)
  [CI] Set "WearOS Tests" parallelization to 2 agents. (#9639)
  [CI] Break "Package Tests" into 2 parallel jobs. (#9638)
  Bump to DevDiv/android-platform-support@3b4e16f1 (#9632)
  [NativeAOT] improve build logic, part 2 (#9631)
  Bump to dotnet/java-interop@2c06b3c2 (#9633)
  [NativeAOT] improve build logic, part 1 (#9614)
  [build] Generate `WorkloadDependencies.json` (#9613)
  [monodroid] remove `monodroid_get_log_categories()` (#9625)
  [monodroid] remove `_monodroid_get_identity_hash_code` (#9622)
  Bump to dotnet/java-interop@f800ea52 (#9607)
  [XABT] Break BuildApk into individual tasks for each content type. (#9612)
  [Mono.Android] Bind Android API-Baklava DP1 (#9594)
  [Xamarin.Android.Build.Tasks] Extract `BuildArchive` from `BuildApk` (#9556)
  [NativeAOT] MSBuild-related logic to get projects to build (#9583)
  [build] remove remnants of `OpenTK-1.0.dll` (#9610)
  [build] remove `Xamarin.Android.CSharp.targets` (#9609)
  [build] runtime "flavors" part 2 (#9598)
  Bump com.android.tools.build:manifest-merger to 31.7.3 (#9600)
  ...
@github-actions github-actions bot locked and limited conversation to collaborators Jan 18, 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.

3 participants