Skip to content

Commit 39dbc4d

Browse files
committed
Merge branch 'hotfix/0.10.1'
2 parents d29aa37 + ee758eb commit 39dbc4d

File tree

2 files changed

+34
-26
lines changed

2 files changed

+34
-26
lines changed

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [vNext]
88

9+
## [0.10.1] / 2018-10-02
10+
- Fixed wizard to pass definitions for project file template
11+
- Fixed wizard to create source and tests directory if selected
12+
- Fixed wizard to be disabled for legacy format
13+
914
## [0.10.0] / 2018-10-02
1015
- Removed `PathConstruction.GetRootRelativePath`
1116
- Removed `License` from specification files
@@ -156,7 +161,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
156161
- Added CLT tasks for Git
157162
- Fixed background color in console output
158163

159-
[vNext]: https://github.com/nuke-build/nuke/compare/0.10.0...HEAD
164+
[vNext]: https://github.com/nuke-build/nuke/compare/0.10.1...HEAD
165+
[0.10.1]: https://github.com/nuke-build/nuke/compare/0.10.0...0.10.1
160166
[0.10.0]: https://github.com/nuke-build/nuke/compare/0.9.1...0.10.0
161167
[0.9.1]: https://github.com/nuke-build/nuke/compare/0.9.0...0.9.1
162168
[0.9.0]: https://github.com/nuke-build/nuke/compare/0.8.0...0.9.0

source/Nuke.GlobalTool/Program.Setup.cs

+27-25
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@
44

55
using System;
66
using System.Collections.Generic;
7-
using System.ComponentModel;
87
using System.IO;
98
using System.Linq;
10-
using System.Linq.Expressions;
119
using System.Reflection;
1210
using System.Text;
13-
using System.Threading.Tasks;
14-
using System.Xml.XPath;
1511
using JetBrains.Annotations;
16-
using Newtonsoft.Json;
17-
using Newtonsoft.Json.Linq;
1812
using Nuke.Common;
1913
using Nuke.Common.IO;
2014
using Nuke.Common.Tooling;
@@ -103,58 +97,60 @@ private static void Setup([CanBeNull] string rootDirectory, string[] args)
10397

10498
#region Additional
10599

106-
var defaultBuildDefinitions = new List<string>();
100+
var definitions = new List<string>();
107101

108102
if (solutionFile != null &&
109-
ConsoleHelper.PromptForChoice("Do you need help getting started with a basic build?",
110-
(true, "Yes, get me started!"),
111-
(false, "No, I can do this myself...")))
103+
projectFormat == FORMAT_SDK &&
104+
ConsoleHelper.PromptForChoice(
105+
"Do you need help getting started with a basic build?",
106+
(true, "Yes, get me started!"),
107+
(false, "No, I can do this myself...")))
112108
{
113-
defaultBuildDefinitions.Add(
109+
definitions.Add(
114110
ConsoleHelper.PromptForChoice("Restore, compile, pack using ...",
115111
("DOTNET", "dotnet CLI"),
116112
("MSBUILD", "MSBuild/Mono"),
117113
(null, "Neither")));
118114

119-
defaultBuildDefinitions.Add(
115+
definitions.Add(
120116
ConsoleHelper.PromptForChoice("Source files are located in ...",
121117
("SOURCE_DIR", "./source"),
122118
("SRC_DIR", "./src"),
123119
(null, "Neither")));
124120

125-
defaultBuildDefinitions.Add(
121+
definitions.Add(
126122
ConsoleHelper.PromptForChoice("Move packages to ...",
127123
("OUTPUT_DIR", "./output"),
128124
("ARTIFACTS_DIR", "./artifacts"),
129125
(null, "Neither")));
130126

131-
defaultBuildDefinitions.Add(
127+
definitions.Add(
132128
ConsoleHelper.PromptForChoice("Where do test projects go?",
133129
("TESTS_DIR", "./tests"),
134130
(null, "Same as source")));
135131

136132
if (Directory.Exists(Path.Combine(rootDirectory, ".git")))
137-
defaultBuildDefinitions.Add("GIT");
133+
definitions.Add("GIT");
138134
else
139135
{
140-
defaultBuildDefinitions.Add(
136+
definitions.Add(
141137
ConsoleHelper.PromptForChoice("Do you use git?",
142138
("GIT", "Yes, just not setup yet"),
143139
(null, "No, something else")));
144140
}
145141

146142
if (File.Exists(Path.Combine(rootDirectory, "GitVersion.yml")))
147-
defaultBuildDefinitions.Add("GITVERSION");
148-
else if (defaultBuildDefinitions.Contains("GIT"))
143+
definitions.Add("GITVERSION");
144+
else if (definitions.Contains("GIT"))
149145
{
150-
defaultBuildDefinitions.Add(
146+
definitions.Add(
151147
ConsoleHelper.PromptForChoice("Do you use GitVersion?",
152148
("GITVERSION", "Yes, just not setup yet"),
153149
(null, "No, custom versioning")));
154150
}
155151
}
156152

157-
defaultBuildDefinitions.RemoveAll(x => x == null);
153+
definitions.RemoveAll(x => x == null);
158154

159155
#endregion
160156

@@ -171,7 +167,7 @@ private static void Setup([CanBeNull] string rootDirectory, string[] args)
171167

172168
if (solutionFile != null)
173169
{
174-
defaultBuildDefinitions.Add("SOLUTION_FILE");
170+
definitions.Add("SOLUTION_FILE");
175171

176172
var solutionFileContent = TextTasks.ReadAllLines(solutionFile).ToList();
177173
var buildProjectFileRelative = (WinRelativePath) GetRelativePath(solutionDirectory, buildProjectFile);
@@ -185,6 +181,7 @@ private static void Setup([CanBeNull] string rootDirectory, string[] args)
185181
buildProjectFile,
186182
TemplateUtility.FillTemplate(
187183
GetTemplate($"_build.{projectFormat}.csproj"),
184+
definitions,
188185
replacements: GetDictionary(
189186
new
190187
{
@@ -216,7 +213,7 @@ private static void Setup([CanBeNull] string rootDirectory, string[] args)
216213
Path.Combine(buildDirectory, "Build.cs"),
217214
TemplateUtility.FillTemplate(
218215
GetTemplate("Build.cs"),
219-
defaultBuildDefinitions,
216+
definitions,
220217
replacements: GetDictionary(
221218
new
222219
{
@@ -227,7 +224,6 @@ private static void Setup([CanBeNull] string rootDirectory, string[] args)
227224
Path.Combine(EnvironmentInfo.WorkingDirectory, "build.ps1"),
228225
TemplateUtility.FillTemplate(
229226
GetTemplate($"build.{targetPlatform}.ps1"),
230-
definitions: null,
231227
replacements: GetDictionary(
232228
new
233229
{
@@ -243,7 +239,6 @@ private static void Setup([CanBeNull] string rootDirectory, string[] args)
243239
Path.Combine(EnvironmentInfo.WorkingDirectory, "build.sh"),
244240
TemplateUtility.FillTemplate(
245241
GetTemplate($"build.{targetPlatform}.sh"),
246-
definitions: null,
247242
replacements: GetDictionary(
248243
new
249244
{
@@ -254,14 +249,21 @@ private static void Setup([CanBeNull] string rootDirectory, string[] args)
254249
buildProjectName,
255250
nugetVersion = "latest"
256251
})));
252+
253+
if (definitions.Contains("SRC_DIR"))
254+
FileSystemTasks.EnsureExistingDirectory(Path.Combine(rootDirectory, "src"));
255+
if (definitions.Contains("SOURCE_DIR"))
256+
FileSystemTasks.EnsureExistingDirectory(Path.Combine(rootDirectory, "source"));
257+
if (definitions.Contains("TESTS_DIR"))
258+
FileSystemTasks.EnsureExistingDirectory(Path.Combine(rootDirectory, "tests"));
257259

258260
#endregion
259261

260262
#region Wizard+Generation (addon)
261263

262264
if (new[]{"addon", "addin", "plugin"}.Any(x => x.EqualsOrdinalIgnoreCase(args.FirstOrDefault())))
263265
{
264-
ControlFlow.Assert(defaultBuildDefinitions.Contains("SOURCE_DIR"), "definitions.Contains('SOURCE_DIR')");
266+
ControlFlow.Assert(definitions.Contains("SOURCE_DIR"), "definitions.Contains('SOURCE_DIR')");
265267

266268
var organization = ConsoleHelper.PromptForInput("Organization name:", defaultValue: "nuke-build");
267269
var addonName = ConsoleHelper.PromptForInput("Organization name:", defaultValue: null);

0 commit comments

Comments
 (0)