dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.93k stars 530 forks source link

[build] Update package metadata #9230

Closed pjcollins closed 2 months ago

pjcollins commented 2 months ago

Looking at the package explorer for recent .NET 9 preview 7 builds I noticed that other packages do not include sha metadata in the version element. Compare the following by clicking "View Metadata source":

https://nuget.info/packages/Microsoft.Android.Runtime.35.android-arm/35.0.0-preview.7.41 https://nuget.info/packages/Microsoft.NETCore.App.Runtime.Mono.android-arm/9.0.0-preview.7.24405.7 https://nuget.info/packages/Microsoft.Maui.Sdk/9.0.0-preview.7.24407.4

I believe the sha metadata was added when we were initially figuring out a package versioning schema that would produce unique package versions, however our usage of commit distance in both preview and stable versions should address this concern.

The sha metadata inclusion in the version element but not the .nupkg name also causes conflicts with the latest version of the arcade publishing tooling which expects these to be in sync.

The short hash in the metadata has been replaced by a repository element which will contain the repo url and full commit hash.

The icon and other package metadata have been updated to better match other .NET packages.

pjcollins commented 2 months ago

Comparing nuspec output from a local build and recent one from CI:

--- ci/Microsoft.Android.Ref.35.nuspec  2024-08-20 08:41:14
+++ local/Microsoft.Android.Ref.35.nuspec   2024-08-20 12:11:46
@@ -1,17 +1,18 @@
-<?xml version="1.0" encoding="utf-8"?>
-<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
-  <metadata>
-    <id>Microsoft.Android.Ref.35</id>
-    <version>35.0.0-rc.1.64+sha.eb5455a</version>
-    <authors>Microsoft</authors>
-    <requireLicenseAcceptance>false</requireLicenseAcceptance>
-    <license type="file">LICENSE.TXT</license>
-    <licenseUrl>https://aka.ms/deprecateLicenseUrl</licenseUrl>
-    <projectUrl>https://github.com/dotnet/android</projectUrl>
-    <description>Microsoft.Android reference assemblies for API 35. Please do not reference directly.</description>
-    <copyright>© Microsoft Corporation. All rights reserved.</copyright>
-    <packageTypes>
-      <packageType name="DotnetPlatform" />
-    </packageTypes>
-  </metadata>
+<?xml version="1.0" encoding="utf-8"?>
+<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
+  <metadata>
+    <id>Microsoft.Android.Ref.35</id>
+    <version>35.0.0-ci.dev-pjc-pack-repo-meta.64</version>
+    <authors>Microsoft</authors>
+    <license type="file">LICENSE.TXT</license>
+    <licenseUrl>https://aka.ms/deprecateLicenseUrl</licenseUrl>
+    <icon>Icon.png</icon>
+    <projectUrl>https://dot.net/</projectUrl>
+    <description>Microsoft.Android reference assemblies for API 35. Please do not reference directly.</description>
+    <copyright>© Microsoft Corporation. All rights reserved.</copyright>
+    <packageTypes>
+      <packageType name="DotnetPlatform" />
+    </packageTypes>
+    <repository type="git" url="https://github.com/dotnet/android" branch="refs/heads/dev/pjc/pack-repo-meta" commit="eb5455aaecd59ca979f184e7992624819e263315" />
+  </metadata>
 </package>
jonpryor commented 2 months ago

It's a pity that diff shows that every line changed, when every line didn't? I guess line endings changed?