Skip to content

Commit 73a5c54

Browse files
authored
Merge pull request #6654 from NuGet/dev
RI dev to master 2018-11-12
2 parents 0b177de + 7e8af2d commit 73a5c54

90 files changed

Lines changed: 2982 additions & 374 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/NuGetGallery.Core/CoreConstants.cs

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public static class CoreConstants
99

1010
public const string PackageFileSavePathTemplate = "{0}.{1}{2}";
1111
public const string PackageFileBackupSavePathTemplate = "{0}/{1}/{2}.{3}";
12+
public const string PackageContentFileSavePathTemplate = "{0}/{1}";
1213

1314
public const string NuGetPackageFileExtension = ".nupkg";
1415
public const string CertificateFileExtension = ".cer";
@@ -18,26 +19,33 @@ public static class CoreConstants
1819
public const string PackageContentType = "binary/octet-stream";
1920
public const string OctetStreamContentType = "application/octet-stream";
2021
public const string TextContentType = "text/plain";
22+
public const string MarkdownContentType = "text/markdown"; // rfc7763
2123
public const string CertificateContentType = "application/pkix-cert";
2224
public const string JsonContentType = "application/json";
2325

2426
public const string DefaultCacheControl = "max-age=120";
2527

26-
public const string UserCertificatesFolderName = "user-certificates";
27-
public const string ContentFolderName = "content";
28-
public const string DownloadsFolderName = "downloads";
29-
public const string PackageBackupsFolderName = "package-backups";
30-
public const string PackageReadMesFolderName = "readmes";
31-
public const string PackagesFolderName = "packages";
32-
public const string UploadsFolderName = "uploads";
33-
public const string ValidationFolderName = "validation";
34-
public const string RevalidationFolderName = "revalidation";
35-
public const string StatusFolderName = "status";
36-
37-
public const string SymbolPackagesFolderName = "symbol-packages";
28+
public static class Folders
29+
{
30+
public const string UserCertificatesFolderName = "user-certificates";
31+
public const string ContentFolderName = "content";
32+
public const string DownloadsFolderName = "downloads";
33+
public const string PackageBackupsFolderName = "package-backups";
34+
public const string PackageReadMesFolderName = "readmes";
35+
public const string PackagesFolderName = "packages";
36+
public const string PackagesContentFolderName = "packages-content";
37+
public const string UploadsFolderName = "uploads";
38+
public const string ValidationFolderName = "validation";
39+
public const string RevalidationFolderName = "revalidation";
40+
public const string StatusFolderName = "status";
41+
public const string SymbolPackagesFolderName = "symbol-packages";
42+
public const string SymbolPackageBackupsFolderName = "symbol-package-backups";
43+
}
44+
3845
public const string NuGetSymbolPackageFileExtension = ".snupkg";
39-
public const string SymbolPackageBackupsFolderName = "symbol-package-backups";
4046

4147
public const string UploadTracingKeyHeaderName = "upload-id";
48+
49+
public const string LicenseFileName = "license";
4250
}
4351
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
namespace NuGetGallery
5+
{
6+
/// <summary>
7+
/// Specifies the type of the license file used in the package
8+
/// </summary>
9+
public enum EmbeddedLicenseFileType
10+
{
11+
/// <summary>
12+
/// Indicates that package has no license file embedded.
13+
/// </summary>
14+
Absent = 0,
15+
16+
/// <summary>
17+
/// Indicates that embedded license file is plain text.
18+
/// </summary>
19+
PlainText = 1,
20+
21+
/// <summary>
22+
/// Indicates that embedded license file is markdown.
23+
/// </summary>
24+
Markdown = 2,
25+
}
26+
}

src/NuGetGallery.Core/NuGetGallery.Core.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
</ItemGroup>
204204
<ItemGroup>
205205
<PackageReference Include="NuGet.Services.Messaging.Email">
206-
<Version>2.36.0-sb-noemailrecipients-2192794</Version>
206+
<Version>2.36.0</Version>
207207
</PackageReference>
208208
<PackageReference Include="NuGet.StrongName.AnglicanGeek.MarkdownMailer">
209209
<Version>1.2.0</Version>
@@ -236,7 +236,7 @@
236236
<PrivateAssets>all</PrivateAssets>
237237
</PackageReference>
238238
<PackageReference Include="NuGet.Packaging">
239-
<Version>4.8.0</Version>
239+
<Version>5.0.0-preview1.5665</Version>
240240
</PackageReference>
241241
<PackageReference Include="WindowsAzure.Storage">
242242
<Version>7.1.2</Version>

src/NuGetGallery.Core/Packaging/PackageMetadata.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public PackageMetadata(
5151
IEnumerable<FrameworkSpecificGroup> frameworkGroups,
5252
IEnumerable<NuGet.Packaging.Core.PackageType> packageTypes,
5353
NuGetVersion minClientVersion,
54-
RepositoryMetadata repositoryMetadata)
54+
RepositoryMetadata repositoryMetadata,
55+
LicenseMetadata licenseMetadata = null)
5556
{
5657
_metadata = new Dictionary<string, string>(metadata, StringComparer.OrdinalIgnoreCase);
5758
_dependencyGroups = dependencyGroups.ToList().AsReadOnly();
@@ -67,6 +68,8 @@ public PackageMetadata(
6768
RepositoryUrl = repoUrl;
6869
RepositoryType = repositoryMetadata.Type;
6970
}
71+
72+
LicenseMetadata = licenseMetadata;
7073
}
7174

7275
private void SetPropertiesFromMetadata()
@@ -123,6 +126,12 @@ private void SetPropertiesFromMetadata()
123126
public string Language { get; private set; }
124127
public NuGetVersion MinClientVersion { get; set; }
125128

129+
/// <summary>
130+
/// Contains license metadata taken from the 'license' node of the nuspec file.
131+
/// Null if no 'license' node present.
132+
/// </summary>
133+
public LicenseMetadata LicenseMetadata { get; }
134+
126135
public string GetValueFromMetadata(string key)
127136
{
128137
return GetValue(key, (string)null);
@@ -244,7 +253,8 @@ public static PackageMetadata FromNuspecReader(NuspecReader nuspecReader, bool s
244253
nuspecReader.GetFrameworkReferenceGroups(),
245254
nuspecReader.GetPackageTypes(),
246255
nuspecReader.GetMinClientVersion(),
247-
nuspecReader.GetRepositoryMetadata());
256+
nuspecReader.GetRepositoryMetadata(),
257+
nuspecReader.GetLicenseMetadata());
248258
}
249259

250260
private class StrictNuspecReader : NuspecReader

0 commit comments

Comments
 (0)