forked from NuGet/NuGet.Client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(NuGet#9) Add package information fields
Extend Nuspec metadata to include: - Project source url - Package source url - Docs url - Wiki Url - Mailing List Url - Bug Tracker Url Adding the following elements, reserving for future use with respect to package relationships. - Replaces - Provides - Conflicts This brings forward these commits: chocolatey/nuget-chocolatey@9b703a8 chocolatey/nuget-chocolatey@4e28997 chocolatey/nuget-chocolatey@b9c4bc5 Co-Authored-By: Rob Reynolds <[email protected]>
- Loading branch information
Showing
16 changed files
with
751 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
////////////////////////////////////////////////////////// | ||
// Chocolatey Specific Modification | ||
////////////////////////////////////////////////////////// | ||
|
||
|
||
using NuGet.Packaging.Core; | ||
|
||
namespace NuGet.Packaging | ||
{ | ||
/// <summary> | ||
/// Reads .nuspec files | ||
/// </summary> | ||
public partial class NuspecReader : NuspecCoreReaderBase | ||
{ | ||
public string GetProjectSourceUrl() | ||
{ | ||
return GetMetadataValue("projectSourceUrl"); | ||
} | ||
|
||
public string GetPackageSourceUrl() | ||
{ | ||
return GetMetadataValue("packageSourceUrl"); | ||
} | ||
|
||
public string GetDocsUrl() | ||
{ | ||
return GetMetadataValue("docsUrl"); | ||
} | ||
|
||
public string GetWikiUrl() | ||
{ | ||
return GetMetadataValue("wikiUrl"); | ||
} | ||
|
||
public string GetMailingListUrl() | ||
{ | ||
return GetMetadataValue("mailingListUrl"); | ||
} | ||
|
||
public string GetBugTrackerUrl() | ||
{ | ||
return GetMetadataValue("bugTrackerUrl"); | ||
} | ||
|
||
public string GetReplaces() | ||
{ | ||
return GetMetadataValue("replaces"); | ||
} | ||
|
||
public string GetProvides() | ||
{ | ||
return GetMetadataValue("provides"); | ||
} | ||
|
||
public string GetConflicts() | ||
{ | ||
return GetMetadataValue("conflicts"); | ||
} | ||
|
||
public string GetSoftwareDisplayName() | ||
{ | ||
return GetMetadataValue("softwareDisplayName"); | ||
} | ||
|
||
public string GetSoftwareDisplayVersion() | ||
{ | ||
return GetMetadataValue("softwareDisplayVersion"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
174 changes: 174 additions & 0 deletions
174
src/NuGet.Core/NuGet.Packaging/PackageCreation/Authoring/ChocolateyManifestMetadata.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
////////////////////////////////////////////////////////// | ||
// Chocolatey Specific Modification | ||
////////////////////////////////////////////////////////// | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace NuGet.Packaging | ||
{ | ||
public partial class ManifestMetadata : IPackageMetadata | ||
{ | ||
private IEnumerable<string> _replaces = Enumerable.Empty<string>(); | ||
private IEnumerable<string> _provides = Enumerable.Empty<string>(); | ||
private IEnumerable<string> _conflicts = Enumerable.Empty<string>(); | ||
|
||
private string _projectSourceUrl; | ||
private string _packageSourceUrl; | ||
private string _docsUrl; | ||
private string _wikiUrl; | ||
private string _mailingListUrl; | ||
private string _bugTrackerUrl; | ||
|
||
private void FinishContruction(IPackageMetadata copy) | ||
{ | ||
_projectSourceUrl = copy.ProjectSourceUrl?.OriginalString; | ||
_packageSourceUrl = copy.PackageSourceUrl?.OriginalString; | ||
_docsUrl = copy.DocsUrl?.OriginalString; | ||
_wikiUrl = copy.WikiUrl?.OriginalString; | ||
_mailingListUrl = copy.MailingListUrl?.OriginalString; | ||
_bugTrackerUrl = copy.BugTrackerUrl?.OriginalString; | ||
Replaces = copy.Replaces; | ||
Provides = copy.Provides; | ||
Conflicts = copy.Conflicts; | ||
SoftwareDisplayName = copy.SoftwareDisplayName; | ||
SoftwareDisplayVersion = copy.SoftwareDisplayVersion; | ||
} | ||
|
||
public void SetProjectSourceUrl(string projectSourceUrl) | ||
{ | ||
_projectSourceUrl = projectSourceUrl; | ||
} | ||
|
||
public Uri ProjectSourceUrl | ||
{ | ||
get | ||
{ | ||
if (_projectSourceUrl == null) | ||
{ | ||
return null; | ||
} | ||
|
||
return new Uri(_projectSourceUrl); | ||
} | ||
} | ||
|
||
public void SetPackageSourceUrl(string packageSourceUrl) | ||
{ | ||
_packageSourceUrl = packageSourceUrl; | ||
} | ||
|
||
public Uri PackageSourceUrl | ||
{ | ||
get | ||
{ | ||
if (_packageSourceUrl == null) | ||
{ | ||
return null; | ||
} | ||
|
||
return new Uri(_packageSourceUrl); | ||
} | ||
} | ||
|
||
public void SetDocsUrl(string docsUrl) | ||
{ | ||
_docsUrl = docsUrl; | ||
} | ||
|
||
public Uri DocsUrl | ||
{ | ||
get | ||
{ | ||
if (_docsUrl == null) | ||
{ | ||
return null; | ||
} | ||
|
||
return new Uri(_docsUrl); | ||
} | ||
} | ||
|
||
public void SetWikiUrl(string wikiUrl) | ||
{ | ||
_wikiUrl = wikiUrl; | ||
} | ||
|
||
public Uri WikiUrl | ||
{ | ||
get | ||
{ | ||
if (_wikiUrl == null) | ||
{ | ||
return null; | ||
} | ||
|
||
return new Uri(_wikiUrl); | ||
} | ||
} | ||
|
||
public void SetMailingListUrl(string mailingListUrl) | ||
{ | ||
_mailingListUrl = mailingListUrl; | ||
} | ||
|
||
public Uri MailingListUrl | ||
{ | ||
get | ||
{ | ||
if (_mailingListUrl == null) | ||
{ | ||
return null; | ||
} | ||
|
||
return new Uri(_mailingListUrl); | ||
} | ||
} | ||
|
||
public void SetBugTrackerUrl(string bugTrackerUrl) | ||
{ | ||
_bugTrackerUrl = bugTrackerUrl; | ||
} | ||
|
||
public Uri BugTrackerUrl | ||
{ | ||
get | ||
{ | ||
if (_bugTrackerUrl == null) | ||
{ | ||
return null; | ||
} | ||
|
||
return new Uri(_bugTrackerUrl); | ||
} | ||
} | ||
|
||
public IEnumerable<string> Replaces | ||
{ | ||
get { return _replaces; } | ||
set { _replaces = value ?? Enumerable.Empty<string>(); } | ||
} | ||
|
||
public IEnumerable<string> Provides | ||
{ | ||
get { return _provides; } | ||
set { _provides = value ?? Enumerable.Empty<string>(); } | ||
} | ||
|
||
public IEnumerable<string> Conflicts | ||
{ | ||
get { return _conflicts; } | ||
set { _conflicts = value ?? Enumerable.Empty<string>(); } | ||
} | ||
|
||
public string SoftwareDisplayName { get; set; } | ||
|
||
public string SoftwareDisplayVersion { get; set; } | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
src/NuGet.Core/NuGet.Packaging/PackageCreation/Authoring/ChocolateyPackageBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
////////////////////////////////////////////////////////// | ||
// Chocolatey Specific Modification | ||
////////////////////////////////////////////////////////// | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace NuGet.Packaging | ||
{ | ||
public partial class PackageBuilder : IPackageMetadata | ||
{ | ||
public Uri ProjectSourceUrl { get; set; } | ||
public Uri PackageSourceUrl { get; set; } | ||
public Uri DocsUrl { get; set; } | ||
public Uri WikiUrl { get; set; } | ||
public Uri MailingListUrl { get; set; } | ||
public Uri BugTrackerUrl { get; set; } | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "<Pending>")] | ||
public ISet<string> Replaces { get; set; } | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "<Pending>")] | ||
public ISet<string> Provides { get; set; } | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "<Pending>")] | ||
public ISet<string> Conflicts { get; set; } | ||
public string SoftwareDisplayName { get; set; } | ||
public string SoftwareDisplayVersion { get; set; } | ||
|
||
IEnumerable<string> IPackageMetadata.Replaces | ||
{ | ||
get | ||
{ | ||
return Replaces; | ||
} | ||
} | ||
|
||
IEnumerable<string> IPackageMetadata.Provides | ||
{ | ||
get | ||
{ | ||
return Provides; | ||
} | ||
} | ||
|
||
IEnumerable<string> IPackageMetadata.Conflicts | ||
{ | ||
get | ||
{ | ||
return Conflicts; | ||
} | ||
} | ||
|
||
private void FinishPopulate(IPackageMetadata metadata) | ||
{ | ||
ProjectSourceUrl = metadata.ProjectSourceUrl; | ||
PackageSourceUrl = metadata.PackageSourceUrl; | ||
DocsUrl = metadata.DocsUrl; | ||
WikiUrl = metadata.WikiUrl; | ||
MailingListUrl = metadata.MailingListUrl; | ||
BugTrackerUrl = metadata.BugTrackerUrl; | ||
SoftwareDisplayName = metadata.SoftwareDisplayName; | ||
SoftwareDisplayVersion = metadata.SoftwareDisplayVersion; | ||
|
||
Replaces.AddRange(metadata.Replaces); | ||
Provides.AddRange(metadata.Provides); | ||
Conflicts.AddRange(metadata.Conflicts); | ||
} | ||
|
||
private void FinishContruction() | ||
{ | ||
Replaces = new HashSet<string>(); | ||
Provides = new HashSet<string>(); | ||
Conflicts = new HashSet<string>(); | ||
} | ||
} | ||
} |
Oops, something went wrong.