Skip to content

Conversation

@jpobst
Copy link
Contributor

@jpobst jpobst commented May 22, 2023

Context: https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management
Context: https://learn.microsoft.com/en-us/nuget/consume-packages/package-source-mapping

Switch to NuGet's Central Package Management. Although this is very similar to the "homegrown" central package management we currently have, using the "official" version means that there is additional tooling support available, such as being supported by dotnet add package, Visual Studio, and dependabot.

Central Package Management also requires Package Source Mapping, so we also add that information to our NuGet.config.

@jpobst jpobst marked this pull request as ready for review May 22, 2023 20:31
@jonpryor
Copy link
Contributor

Context: b46598a

@jonpryor
Copy link
Contributor

"Switch to" feels like a bit of a misnomer, as we're still using the dotnet-public feed and not using nuget.org. Instead, this adds @(PackageVersion) (instead of %(PackageReference.Update)) and <packageSourceMapping/>, neither of which change the existing "use only dotnet-public to obtain packages" mechanic we've used since b46598a.

@jpobst
Copy link
Contributor Author

jpobst commented May 22, 2023

"Central Package Management" is a feature introduced by NuGet last year:
https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management

It does not refer to nuget.org, if that's the confusion?

@jonpryor
Copy link
Contributor

Part of the problem is that I am easily confused. :-)

Apparently "Central Package Management" doesn't include "distribution". I'm reading too much into words.

@jonpryor jonpryor merged commit 8c9eece into main May 26, 2023
@jonpryor jonpryor deleted the central-nuget branch May 26, 2023 00:17
jonpryor pushed a commit to dotnet/android that referenced this pull request May 30, 2023
Changes: dotnet/java-interop@93c50fe...8c9eece

  * dotnet/java-interop@8c9eece2: [build] Enable NuGet's Central Package Management (dotnet/java-interop#1114)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
jonathanpeppers added a commit that referenced this pull request Aug 22, 2023
jonathanpeppers added a commit to jonathanpeppers/java.interop that referenced this pull request Aug 23, 2023
Context: dotnet/android#8279

This reverts commit 8c9eece.

Near the end of .NET 8 RC 1, the .NET 8 SDK depends on nightly packages
for .NET 6 and .NET 7:

* dotnet/runtime 7.0.11
* dotnet/runtime 6.0.22

These come from feeds such as:

    <!-- Added manually for dotnet/runtime 7.0.11 -->
    <add key="darc-pub-dotnet-runtime-a2ad4f0" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-a2ad4f03/nuget/v3/index.json" />
    <!-- Added manually for dotnet/runtime 6.0.22 -->
    <add key="darc-pub-dotnet-runtime-762f437" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-762f4379/nuget/v3/index.json" />

The version number is stable, so the .NET releng team has infrastructure
to create a new feed per git commit.

Unfortunately, this makes NuGet central package management unusable for
us. 😢

As seen in dotnet/android#8279, we get errors like:

    Package source mapping matches found for package ID 'Microsoft.NETCore.App.Ref' are: 'dotnet-public'.
    ...
    external\Java.Interop\src\Java.Interop.Tools.Expressions\Java.Interop.Tools.Expressions.csproj error NU1102: Unable to find package Microsoft.NETCore.App.Ref with version (= 7.0.11)
    - Found 83 version(s) in dotnet-public [ Nearest version: 8.0.0-preview.1.23110.8 ]
    - Versions from dotnet-eng were not considered [Xamarin.Android.sln]

This is because it can only possibly resolve this package from
`dotnet-public`:

    <packageSource key="dotnet-public">
      <package pattern="*" />
    </packageSource>

Because 7.0.11 hasn't shipped yet, it is not on NuGet.org or `dotnet-public`.

For this to work, we would somehow need this added to the java.interop
repo at the time xamarin/xamarin-android gets a newer .NET 8 SDK:

    <packageSource key="darc-pub-dotnet-runtime-a2ad4f0">
      <package pattern="Microsoft.NETCore.App.Ref" />
    </packageSource>

For now, let's revert 8c9eece. Maybe there is some solution we can come
up with to use this in the future.
jonpryor pushed a commit that referenced this pull request Aug 23, 2023
…1138)

Context: dotnet/android#8279

This reverts commit 8c9eece.

Near the end of .NET 8 RC 1, the .NET 8 SDK depends on nightly
packages for .NET 6 and .NET 7:

  * dotnet/runtime 7.0.11
  * dotnet/runtime 6.0.22

These come from feeds within `NuGet.config` such as:

	<packageSources>
	  <clear/>
	  <!-- Added manually for dotnet/runtime 7.0.11 -->
	  <add key="darc-pub-dotnet-runtime-a2ad4f0" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-a2ad4f03/nuget/v3/index.json" />
	  <!-- Added manually for dotnet/runtime 6.0.22 -->
	  <add key="darc-pub-dotnet-runtime-762f437" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-762f4379/nuget/v3/index.json" />
	</packageSources>

The version number is stable, so the .NET releng team has
infrastructure to create a new feed per git commit.

Unfortunately, this makes NuGet central package management unusable
for us. 😢

As seen in dotnet/android#8279, we get errors like:

	Package source mapping matches found for package ID 'Microsoft.NETCore.App.Ref' are: 'dotnet-public'.
	…
	external\Java.Interop\src\Java.Interop.Tools.Expressions\Java.Interop.Tools.Expressions.csproj error NU1102: Unable to find package Microsoft.NETCore.App.Ref with version (= 7.0.11)
	- Found 83 version(s) in dotnet-public [ Nearest version: 8.0.0-preview.1.23110.8 ]
	- Versions from dotnet-eng were not considered [Xamarin.Android.sln]

This is because it can only possibly resolve this package from
`dotnet-public`:

	<packageSourceMapping>
	  <packageSource key="dotnet-public">
	    <package pattern="*" />
	  </packageSource>
	</packageSourceMapping>

Because 7.0.11 hasn't shipped yet, it is on neither NuGet.org nor
`dotnet-public`.

For this to work, we would somehow need this `NuGet.config` fragment
to be added to the xamarin/java.interop repo whenever
xamarin/xamarin-android gets a newer .NET 8 SDK:

	<packageSourceMapping>
	  <packageSource key="darc-pub-dotnet-runtime-[HASH]">
	    <package pattern="Microsoft.NETCore.App.Ref" />
	  </packageSource>
	</packageSourceMapping>

For now, let's revert 8c9eece.  Maybe there is some solution we can
come up with to use this in the future.
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Sep 1, 2023
Changes: dotnet/java-interop@5adb4d4...5bb0d24

  * dotnet/java-interop@5bb0d24b: [build] Add support for JDK 17 (dotnet/java-interop#1141)
  * dotnet/java-interop@7e3bd2f2: Revert "[build] Enable NuGet's Central Package Management (dotnet/java-interop#1114)" (dotnet/java-interop#1138)
  * dotnet/java-interop@7961b360: [build] set `$(DisableTransitiveFrameworkReferenceDownloads)`=true (dotnet/java-interop#1137)

Context: dotnet#8304
Context: dotnet#8029
Context: https://web.archive.org/web/20230507035529/https://developer.android.com/studio/releases/#jdk-17

> Starting from Android Studio Flamingo Canary 3, the Studio IDE is
> bundled with JDK 17.

Because of dotnet#8029 we know we *can* use JDK 17.

Because of dotnet#8304 we know we *should* use JDK 17.

Update `xaprepare` so that Microsoft OpenJDK 17.0.8 is provisioned
for the build.  Note: `$(_JavacSourceVersion)` and
`$(_JavacTargetVersion)` are *not* changed, so that our built
`.jar` tooling can still *run* on JDK-11.

Update to use Gradle 8.1.1.  This is needed for JDK-17 support.

Update `$(LatestSupportedJavaVersion)` to 17.0.99 so that JDK 17 can
be used by .NET Android projects by default.
jonpryor added a commit to dotnet/android that referenced this pull request Sep 2, 2023
Changes: dotnet/java-interop@5adb4d4...5bb0d24

  * dotnet/java-interop@5bb0d24b: [build] Add support for JDK 17 (dotnet/java-interop#1141)
  * dotnet/java-interop@7e3bd2f2: Revert "[build] Enable NuGet's Central Package Management (dotnet/java-interop#1114)" (dotnet/java-interop#1138)
  * dotnet/java-interop@7961b360: [build] set `$(DisableTransitiveFrameworkReferenceDownloads)`=true (dotnet/java-interop#1137)

Context: #8304
Context: #8029
Context: https://web.archive.org/web/20230507035529/https://developer.android.com/studio/releases/#jdk-17

> Starting from Android Studio Flamingo Canary 3, the Studio IDE is
> bundled with JDK 17.

Because of #8029 we know we *can* use JDK 17.

Because of #8304 we know we *should* use JDK 17.

Update `xaprepare` so that Microsoft OpenJDK 17.0.8 is provisioned
for the build.  Note: `$(_JavacSourceVersion)` and
`$(_JavacTargetVersion)` are *not* changed, so that our built
`.jar` tooling can still *run* on JDK-11.

Update to use Gradle 8.1.1.  This is needed for JDK-17 support.

Update `$(LatestSupportedJavaVersion)` to 17.0.99 so that JDK 17 can
be used by .NET Android projects by default.
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
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