Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mholo65-feature/GH-787' into develop
- Loading branch information
Showing
3 changed files
with
63 additions
and
40 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/Cake.NuGet/Install/Extensions/PackageReferenceExtensions.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,39 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Linq; | ||
using Cake.Core.Configuration; | ||
using Cake.Core.Packaging; | ||
|
||
namespace Cake.NuGet.Install.Extensions | ||
{ | ||
internal static class PackageReferenceExtensions | ||
{ | ||
private const string LoadDependenciesKey = "loaddependencies"; | ||
|
||
public static bool ShouldLoadDependencies(this PackageReference packageReference, ICakeConfiguration config) | ||
{ | ||
bool loadDependencies; | ||
if (packageReference.Parameters.ContainsKey(LoadDependenciesKey)) | ||
{ | ||
bool.TryParse(packageReference.Parameters[LoadDependenciesKey].FirstOrDefault() ?? bool.TrueString, out loadDependencies); | ||
} | ||
else | ||
{ | ||
bool.TryParse(config.GetValue(Constants.NuGet.LoadDependencies) ?? bool.FalseString, out loadDependencies); | ||
} | ||
return loadDependencies; | ||
} | ||
|
||
public static bool IsPrerelease(this PackageReference packageReference) | ||
{ | ||
var isPreRelease = false; | ||
if (packageReference.Parameters.ContainsKey("prerelease")) | ||
{ | ||
bool.TryParse(packageReference.Parameters["prerelease"].FirstOrDefault() ?? bool.TrueString, out isPreRelease); | ||
} | ||
return isPreRelease; | ||
} | ||
} | ||
} |
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