forked from dotnet/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NuGetUtils.NuGet.cs
41 lines (36 loc) · 1.3 KB
/
NuGetUtils.NuGet.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NuGet.Frameworks;
using NuGet.Packaging.Core;
using NuGet.ProjectModel;
namespace Microsoft.NET.Build.Tasks
{
internal static partial class NuGetUtils
{
public static bool IsPlaceholderFile(string path)
{
return string.Equals(Path.GetFileName(path), PackagingCoreConstants.EmptyFolder, StringComparison.Ordinal);
}
public static IEnumerable<LockFileItem> FilterPlaceHolderFiles(this IEnumerable<LockFileItem> files)
{
return files.Where(f => !IsPlaceholderFile(f.Path));
}
public static string GetLockFileLanguageName(string projectLanguage)
{
switch (projectLanguage)
{
case "C#": return "cs";
case "F#": return "fs";
default: return projectLanguage?.ToLowerInvariant();
}
}
public static NuGetFramework ParseFrameworkName(string frameworkName)
{
return frameworkName == null ? null : NuGetFramework.Parse(frameworkName);
}
}
}