12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using Nuke.Common;
- using Nuke.Common.Execution;
- using Nuke.Common.IO;
- using Nuke.Common.ProjectModel;
- using Nuke.Common.Tools.DotNet;
- using Nuke.Common.Utilities.Collections;
- using static Nuke.Common.IO.FileSystemTasks;
- using static Nuke.Common.Tools.DotNet.DotNetTasks;
- [UnsetVisualStudioEnvironmentVariables]
- class Build : NukeBuild {
- public static int Main() => Execute<Build>(x => x.Publish);
- [Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
- readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
- [Solution] readonly Solution Solution;
- AbsolutePath SourceDirectory => RootDirectory / "src";
- AbsolutePath OutputDirectory => RootDirectory / "output";
- Target Clean => _ => _
- .Before(Restore)
- .Executes(() => {
- SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
- EnsureCleanDirectory(OutputDirectory);
- });
- Target Restore => _ => _
- .Executes(() => {
- DotNetRestore(s => s
- .SetProjectFile(Solution));
- });
- Target Compile => _ => _
- .DependsOn(Restore)
- .Executes(() => {
- DotNetBuild(s => s
- .SetProjectFile(Solution)
- .SetConfiguration(Configuration)
- .EnableNoRestore());
- });
- Target Test => _ => _
- .DependsOn(Compile)
- .Executes(() => {
- DotNetTest(s => s
- .SetProjectFile(Solution)
- .EnableNoRestore());
- });
- Target Publish => _ => _
- .DependsOn(Test)
- .Executes(() => {
- DotNetPublish(s => s
- .SetProject(SourceDirectory / "Robware.Api.Projects/Robware.Api.Projects.csproj")
- .SetConfiguration(Configuration)
- .SetOutput(OutputDirectory));
- });
- }
|