Skip to content

Commit 45af0b5

Browse files
committed
[build] Update package metadata (#9230)
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 > <version>35.0.0-preview.7.41+sha.a9d10b4</version> * https://nuget.info/packages/Microsoft.NETCore.App.Runtime.Mono.android-arm/9.0.0-preview.7.24405.7 > <version>9.0.0-preview.7.24405.7</version> * https://nuget.info/packages/Microsoft.Maui.Sdk/9.0.0-preview.7.24407.4 > <version>9.0.0-preview.7.24407.4</version> 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][0] 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: <repository type="git" url="https://github.com/dotnet/android" branch="refs/heads/dev/pjc/pack-repo-meta" commit="eb5455aaecd59ca979f184e7992624819e263315" /> The icon and other package metadata have been updated to better match other .NET packages. [0]: https://github.com/dotnet/arcade/blob/b4f4d40741f161e2c0d96c19c51a4013850ef65f/src/Microsoft.DotNet.Build.Tasks.Feed/src/PushToBuildStorage.cs
1 parent 732db0c commit 45af0b5

File tree

6 files changed

+10
-22
lines changed

6 files changed

+10
-22
lines changed

Documentation/guides/OneDotNet.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ see the [net6-samples][net6-samples] repo.
299299

300300
## Package Versioning Scheme
301301

302-
This is the package version scheme: `OS-Major.OS-Minor.InternalRelease[-prereleaseX]+sha.1b2c3d4`.
302+
This is the package version scheme: `OS-Major.OS-Minor.InternalRelease[-prereleaseX].CommitDistance`.
303303

304304
* Major: The highest stable API level, such as 30. On Apple platforms, this is the major OS version.
305305
* Minor: Always 0 for Android. On Apple platforms, this is the minor OS version.
@@ -327,24 +327,6 @@ This is the package version scheme: `OS-Major.OS-Minor.InternalRelease[-prerelea
327327
referencing `*-android-r.beta.*`
328328
* It's still possible to sign up for all `android-r` builds, by
329329
referencing `*-ci.android-r.*`
330-
* Build metadata: Required Hash
331-
* This is `sha.` + the short commit hash.
332-
* Use the short hash because the long hash is quite long and
333-
cumbersome. This leaves the complete version open for duplication,
334-
but this is extremely unlikely.
335-
* Example: `30.0.100+sha.1a2b3c`
336-
* Example (CI build): `30.0.100-ci.master.1234+sha.1a2b3c`
337-
* Since the build metadata is required for all builds, we're able to
338-
recognize incomplete version numbers and determine if a particular
339-
version string refers to a stable version or not.
340-
* Example: `30.0.100`: incomplete version
341-
* Example: `30.0.100+sha.1a2b3c`: stable
342-
* Example: `30.0.100-ci.d17-0.1234+sha.1a2b3c`: CI build
343-
* Example: `30.0.100-android-r.beta.1+sha.1a2b3c`: official
344-
preview
345-
* Technically it's possible to remove the prerelease part, but
346-
we’d still be able to figure out it’s not a stable version by
347-
using the commit hash.
348330

349331

350332
[0]: https://github.com/dotnet/installer#installers-and-binaries

build-tools/create-packs/Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<PropertyGroup>
55
<TargetFramework>netstandard2.0</TargetFramework>
66
<PackageType>DotnetPlatform</PackageType>
7+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
8+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
79
<OutputPath>$(BootstrapOutputDirectory)nuget-unsigned\</OutputPath>
810
<GenerateDependencyFile>false</GenerateDependencyFile>
911
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

build-tools/create-packs/Directory.Build.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<Target Name="_GetDefaultPackageVersion"
4040
DependsOnTargets="GetXAVersionInfo" >
4141
<PropertyGroup>
42-
<PackageVersion>$(AndroidPackVersionLong)+sha.$(XAVersionHash)</PackageVersion>
42+
<PackageVersion>$(AndroidPackVersionLong)</PackageVersion>
4343
</PropertyGroup>
4444
</Target>
4545

build-tools/create-packs/Icon.png

2.09 KB
Loading

build-tools/create-packs/License.targets

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
<PropertyGroup>
44
<Authors>Microsoft</Authors>
55
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
6-
<PackageProjectUrl>https://github.com/xamarin/xamarin-android</PackageProjectUrl>
6+
<RepositoryUrl>https://github.com/dotnet/android</RepositoryUrl>
7+
<PackageProjectUrl>https://dot.net</PackageProjectUrl>
8+
<Owners>microsoft,dotnetframework</Owners>
79
<NuGetLicense Condition="Exists('$(XamarinAndroidSourcePath)external\monodroid\tools\scripts\License.txt')">$(XamarinAndroidSourcePath)external\monodroid\tools\scripts\License.txt</NuGetLicense>
810
<NuGetLicense Condition=" '$(NuGetLicense)' == '' or '$(PackageId)' != 'Microsoft.Android.Sdk.$(HostOS)' ">$(XamarinAndroidSourcePath)LICENSE.TXT</NuGetLicense>
911
<PackageLicenseFile>LICENSE.TXT</PackageLicenseFile>
12+
<PackageIcon>Icon.png</PackageIcon>
1013
<BeforePack>_GetLicense;$(BeforePack)</BeforePack>
1114
</PropertyGroup>
1215
<Target Name="_GetLicense">
@@ -18,6 +21,7 @@
1821
/>
1922
<ItemGroup>
2023
<_PackageFiles Include="$(IntermediateOutputPath)$(PackageLicenseFile)" PackagePath="\" />
24+
<_PackageFiles Include="$(MSBuildThisFileDirectory)Icon.png" PackagePath="\" />
2125
</ItemGroup>
2226
</Target>
2327
</Project>

src/Microsoft.Android.Templates/Directory.Build.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<Target Name="_GetDefaultPackageVersion"
1010
DependsOnTargets="GetXAVersionInfo" >
1111
<PropertyGroup>
12-
<TemplatePackVersion Condition="'$(TemplatePackVersion)' == ''">$(AndroidPackVersionLong)+sha.$(XAVersionHash)</TemplatePackVersion>
12+
<TemplatePackVersion Condition="'$(TemplatePackVersion)' == ''">$(AndroidPackVersionLong)</TemplatePackVersion>
1313
<PackageVersion>$(TemplatePackVersion)</PackageVersion>
1414
</PropertyGroup>
1515
</Target>

0 commit comments

Comments
 (0)