committed by
GitHub
6 changed files with 109 additions and 86 deletions
@ -0,0 +1,57 @@ |
|||||
|
using System.Globalization; |
||||
|
using JetBrains.Annotations; |
||||
|
using Nuke.Common.Tools.DotNet; |
||||
|
// ReSharper disable ReturnValueOfPureMethodIsNotUsed
|
||||
|
|
||||
|
public class DotNetConfigHelper |
||||
|
{ |
||||
|
public DotNetBuildSettings Build; |
||||
|
public DotNetPackSettings Pack; |
||||
|
public DotNetTestSettings Test; |
||||
|
|
||||
|
public DotNetConfigHelper(DotNetBuildSettings s) |
||||
|
{ |
||||
|
Build = s; |
||||
|
} |
||||
|
|
||||
|
public DotNetConfigHelper(DotNetPackSettings s) |
||||
|
{ |
||||
|
Pack = s; |
||||
|
} |
||||
|
|
||||
|
public DotNetConfigHelper(DotNetTestSettings s) |
||||
|
{ |
||||
|
Test = s; |
||||
|
} |
||||
|
|
||||
|
public DotNetConfigHelper AddProperty(string key, bool value) => |
||||
|
AddProperty(key, value.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()); |
||||
|
public DotNetConfigHelper AddProperty(string key, string value) |
||||
|
{ |
||||
|
Build = Build?.AddProperty(key, value); |
||||
|
Pack = Pack?.AddProperty(key, value); |
||||
|
Test = Test?.AddProperty(key, value); |
||||
|
|
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public DotNetConfigHelper SetConfiguration(string configuration) |
||||
|
{ |
||||
|
Build = Build?.SetConfiguration(configuration); |
||||
|
Pack = Pack?.SetConfiguration(configuration); |
||||
|
Test = Test?.SetConfiguration(configuration); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public DotNetConfigHelper SetVerbosity(DotNetVerbosity verbosity) |
||||
|
{ |
||||
|
Build = Build?.SetVerbosity(verbosity); |
||||
|
Pack = Pack?.SetVerbostiy(verbosity); |
||||
|
Test = Test?.SetVerbosity(verbosity); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
public static implicit operator DotNetConfigHelper(DotNetBuildSettings s) => new DotNetConfigHelper(s); |
||||
|
public static implicit operator DotNetConfigHelper(DotNetPackSettings s) => new DotNetConfigHelper(s); |
||||
|
public static implicit operator DotNetConfigHelper(DotNetTestSettings s) => new DotNetConfigHelper(s); |
||||
|
} |
||||
Loading…
Reference in new issue