Skip to content

Commit

Permalink
Merge branch 'hotfix/0.24.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Feb 7, 2020
2 parents 11693af + 81e4702 commit 67358e7
Show file tree
Hide file tree
Showing 14 changed files with 95 additions and 32 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [vNext]

## [0.24.1] / 2020-02-07
- Fixed `NuGetPackageResolver` to include dependencies during tool path resolution
- Fixed parsing of TeamCity environment variables
- Fixed execution flags for `build.sh` and `build.cmd` scripts during setup
- Fixed assertion message in `UnityTasks`
- Fixed `build.cmd` to have newline at end-of-file
- Fixed logo spacing

## [0.24.0] / 2020-02-02
- Removed NuGetPackage tasks and AutoMapper package reference
- Removed `NuGetPackage` tasks and AutoMapper package reference
- Removed TeamCity definitions for `VcsRoot` and trigger timezones
- Changed `AbsolutePath`, `RelativePath`, `WinRelativePath` and `UnixRelativePath` to outer scope
- Changed default package for `DotCoverTasks` to `JetBrains.dotCover.DotNetCliTool`
Expand Down Expand Up @@ -513,7 +521,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added CLT tasks for Git
- Fixed background color in console output

[vNext]: https://github.com/nuke-build/nuke/compare/0.24.0...HEAD
[vNext]: https://github.com/nuke-build/nuke/compare/0.24.1...HEAD
[0.24.1]: https://github.com/nuke-build/nuke/compare/0.24.0...0.24.1
[0.24.0]: https://github.com/nuke-build/nuke/compare/0.23.7...0.24.0
[0.23.7]: https://github.com/nuke-build/nuke/compare/0.23.6...0.23.7
[0.23.6]: https://github.com/nuke-build/nuke/compare/0.23.5...0.23.6
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
- [Description](#description)
- [Features](#features)
- [Example](#example)
- [Continuous Integration](#continues-integration)
- [Continuous Integration](#continuous-integration)
- [Contributing](#contributing)
- [Backers & Sponsors](#backers--sponsors)
- [Users](#users)
Expand Down Expand Up @@ -51,7 +51,7 @@ Here is a short list of some most-loved features:

<p align="center"><img width="800px" src="https://github.com/nuke-build/nuke/raw/develop/images/example-1.png" /></p>

## Continues Integration
## Continuous Integration

NUKE builds and tests itself on several different CI servers, which helps ensuring a working integration with those systems. At the same time, the individual configuration files serve as example for the [generation experience](https://www.nuke.build/docs/authoring-builds/ci-integration.html#configuration-generation):

Expand Down
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
:; exit $?

@ECHO OFF
powershell -ExecutionPolicy ByPass -NoProfile %0\..\build.ps1 %*
powershell -ExecutionPolicy ByPass -NoProfile %0\..\build.ps1 %*
9 changes: 9 additions & 0 deletions source/Nuke.Common.Tests/StringExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,14 @@ public void TestSplit()
"NuGetKeyGitHubKey".SplitCamelHumps("NuGet", "GitHub")
.Should().Equal("NuGet", "Key", "GitHub", "Key");
}

[Theory]
[InlineData("key_value", @"_", 3)]
[InlineData("dep.test.env.=ExitCode=000000", @"[^\.]=", 21)]
public void TestIndexOfRegex(string input, string expression, int expectedIndex)
{
var index = input.IndexOfRegex(expression);
index.Should().Be(expectedIndex);
}
}
}
2 changes: 1 addition & 1 deletion source/Nuke.Common/CI/TeamCity/TeamCity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private static IReadOnlyDictionary<string, string> ParseDictionary([CanBeNull] s
if (line[index: 0] == '#' || string.IsNullOrWhiteSpace(line))
continue;

var index = line.IndexOf(value: '=');
var index = line.IndexOfRegex(@"[^\.]=") + 1;
var key = line.Substring(startIndex: 0, length: index)
.Replace("secure:", string.Empty);
var value = line.Substring(index + 1);
Expand Down
4 changes: 4 additions & 0 deletions source/Nuke.Common/Execution/BuildManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ void ExecuteExtension<TExtension>(Action<TExtension> action)
ToolPathResolver.NuGetAssetsConfigFile = build.NuGetAssetsConfigFile;

if (!NukeBuild.NoLogo)
{
Logger.Normal();
Logger.OutputSink.WriteLogo();
Logger.Normal();
}

Logger.Info($"NUKE Execution Engine {typeof(BuildManager).Assembly.GetInformationalText()}");
Logger.Normal();
Expand Down
18 changes: 12 additions & 6 deletions source/Nuke.Common/Tooling/NuGetPackageResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static InstalledPackage GetLocalInstalledPackage(
string packageId,
string packagesConfigFile,
string version = null,
bool resolveDependencies = false)
bool resolveDependencies = true)
{
return GetLocalInstalledPackages(packagesConfigFile, resolveDependencies)
.SingleOrDefaultOrError(
Expand All @@ -62,6 +62,7 @@ public static IEnumerable<InstalledPackage> GetLocalInstalledPackages(
: GetLocalInstalledPackagesFromConfigFile(packagesConfigFile, resolveDependencies);
}

[ItemNotNull]
private static IEnumerable<InstalledPackage> GetLocalInstalledPackagesFromAssetsFile(
string packagesConfigFile,
bool resolveDependencies = true)
Expand Down Expand Up @@ -89,10 +90,15 @@ private static IEnumerable<InstalledPackage> GetLocalInstalledPackagesFromAssets
if (!resolveDependencies && !directReferences.Contains(name))
continue;

yield return GetGlobalInstalledPackage(name, version, packagesConfigFile);
var package = GetGlobalInstalledPackage(name, version, packagesConfigFile);
if (package == null)
continue;

yield return package;
}
}

[ItemNotNull]
private static IEnumerable<InstalledPackage> GetLocalInstalledPackagesFromConfigFile(
string packagesConfigFile,
bool resolveDependencies = true)
Expand All @@ -118,12 +124,12 @@ private static IEnumerable<InstalledPackage> GetLocalInstalledPackagesFromConfig

foreach (var version in versions)
{
var packageData = GetGlobalInstalledPackage(packageId, version, packagesConfigFile);
if (packageData == null)
var package = GetGlobalInstalledPackage(packageId, version, packagesConfigFile);
if (package == null)
continue;

installedPackages.Add(packageData);
yield return packageData;
installedPackages.Add(package);
yield return package;
}
}

Expand Down
26 changes: 13 additions & 13 deletions source/Nuke.Common/Tools/Unity/UnityTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,14 @@ private static string GetToolPathViaManualInstallation()
{
return EnvironmentInfo.Platform switch
{
PlatformFamily.Windows => $@"{EnvironmentInfo.SpecialFolder(
EnvironmentInfo.Is32Bit
? SpecialFolders.ProgramFilesX86
: SpecialFolders.ProgramFiles)}\Unity\Editor\Unity.exe",
PlatformFamily.Windows => $@"{GetProgramFiles()}\Unity\Editor\Unity.exe",
PlatformFamily.OSX => "/Applications/Unity/Unity.app/Contents/MacOS/Unity",
PlatformFamily.Linux => null,
PlatformFamily.Unknown => null,
_ => null
};
}

private static string GetToolPathViaHubVersion(string version)
{
static string GetProgramFiles()
=> EnvironmentInfo.SpecialFolder(
EnvironmentInfo.Is32Bit
? SpecialFolders.ProgramFilesX86
: SpecialFolders.ProgramFiles);

return EnvironmentInfo.Platform switch
{
PlatformFamily.Windows => $@"{GetProgramFiles()}\Unity\Hub\Editor\{version}\Editor\Unity.exe",
Expand All @@ -62,9 +51,20 @@ static string GetProgramFiles()
};
}

private static string GetProgramFiles()
{
return EnvironmentInfo.SpecialFolder(
EnvironmentInfo.Is32Bit
? SpecialFolders.ProgramFilesX86
: SpecialFolders.ProgramFiles);
}

private static void PreProcess(ref UnitySettings unitySettings)
{
ControlFlow.AssertWarn(unitySettings.ProjectPath != null, "unitySettings.ProjectPath != null");
ControlFlow.AssertWarn(
unitySettings.ProjectPath != null,
"ProjectPath is not set in UnitySettings. This will cause Unity to build the last " +
"opened/built project. Use .SetProjectPath() to override this behavior.");
PreProcess<UnitySettings>(ref unitySettings);
}

Expand Down
19 changes: 19 additions & 0 deletions source/Nuke.Common/Utilities/String.IndexOf.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2019 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE

using JetBrains.Annotations;
using System.Text.RegularExpressions;

namespace Nuke.Common.Utilities
{
public static partial class StringExtensions
{
[Pure]
public static int IndexOfRegex(this string text, string expression)
{
var regex = new Regex(expression, RegexOptions.Compiled);
return regex.Match(text).Index;
}
}
}
20 changes: 18 additions & 2 deletions source/Nuke.GlobalTool/Program.Setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,24 @@ private static int Setup(string[] args, [CanBeNull] string rootDirectory, [CanBe
GetTemplate("Build.cs"),
definitions));

void MakeExecutable(string scriptPath)
{
if (Directory.Exists(Path.Combine(rootDirectory, ".git")))
ProcessTasks.StartProcess("git", $"update-index --add --chmod=+x {scriptPath}", logInvocation: false, logOutput: false);

if (Directory.Exists(Path.Combine(rootDirectory, ".svn")))
ProcessTasks.StartProcess("svn", $"propset svn:executable on {scriptPath}", logInvocation: false, logOutput: false);

if (EnvironmentInfo.IsUnix)
ProcessTasks.StartProcess("chmod", $"+x {scriptPath}", logInvocation: false, logOutput: false);
}

var cmdScript = Path.Combine(EnvironmentInfo.WorkingDirectory, "build.cmd");
TextTasks.WriteAllLines(
Path.Combine(EnvironmentInfo.WorkingDirectory, "build.cmd"),
cmdScript,
FillTemplate(
GetTemplate("build.cmd")));
MakeExecutable(cmdScript);

TextTasks.WriteAllLines(
Path.Combine(EnvironmentInfo.WorkingDirectory, "build.ps1"),
Expand All @@ -250,8 +264,9 @@ private static int Setup(string[] args, [CanBeNull] string rootDirectory, [CanBe
nugetVersion = "latest"
})));

var bashScript = Path.Combine(EnvironmentInfo.WorkingDirectory, "build.sh");
TextTasks.WriteAllLines(
Path.Combine(EnvironmentInfo.WorkingDirectory, "build.sh"),
bashScript,
FillTemplate(
GetTemplate($"build.{targetPlatform}.sh"),
replacements: GetDictionary(
Expand All @@ -264,6 +279,7 @@ private static int Setup(string[] args, [CanBeNull] string rootDirectory, [CanBe
buildProjectName,
nugetVersion = "latest"
})));
MakeExecutable(bashScript);

if (definitions.Contains("SRC_DIR"))
FileSystemTasks.EnsureExistingDirectory(Path.Combine(rootDirectory, "src"));
Expand Down
4 changes: 2 additions & 2 deletions source/Nuke.GlobalTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public partial class Program

private static int Main(string[] args)
{
Logger.Info($"NUKE Global Tool {typeof(Program).Assembly.GetInformationalText()}");

try
{
var rootDirectory = Constants.TryGetRootDirectoryFrom(Directory.GetCurrentDirectory());
Expand Down Expand Up @@ -70,8 +72,6 @@ private static int Handle(string[] args, [CanBeNull] string rootDirectory, [CanB

// TODO: docker

Logger.Normal($"NUKE Global Tool {typeof(Program).Assembly.GetInformationalText()}");

var arguments = args.Select(x => x.DoubleQuoteIfNeeded()).JoinSpace();
var process = Build(buildScript, arguments);
process.WaitForExit();
Expand Down
2 changes: 1 addition & 1 deletion source/Nuke.GlobalTool/templates/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
:; exit $?

@ECHO OFF
powershell -ExecutionPolicy ByPass -NoProfile %0\..\build.ps1 %*
powershell -ExecutionPolicy ByPass -NoProfile %0\..\build.ps1 %*
2 changes: 1 addition & 1 deletion source/Nuke.GlobalTool/templates/build.netcore.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ else {

Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"

ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false }
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
2 changes: 1 addition & 1 deletion source/Nuke.GlobalTool/templates/build.netcore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ fi

echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"

"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false -nologo -clp:NoSummary --verbosity quiet
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"

0 comments on commit 67358e7

Please sign in to comment.