Cake v0.23.0 released

Published
Sunday, 15 October 2017
Category
Release Notes
Author
patriksvensson

Version 0.23.0 has been released!

This release contains three new features specially worth highlighting and a lot of bugfixes and improvements.

Asynchronous Tasks

Cake now supports asynchronous tasks. This will let you use the async and await C# features within a task.

Tasks will still execute single threaded and in order as before, but this really simplifies asynchronous programming and utilizing asynchronous APIs within your Cake scripts.

Task("Copy-To-Memory-Async")
    .Does(async () => {
    IFile file = Context.FileSystem.GetFile("./test.txt");
    using(Stream
            inputStream = testFile.OpenRead(),
            outputStream = new MemoryStream())
    {
        await inputStream.CopyToAsync(outputStream);
        await outputStream.FlushAsync();
        Information("Copied {0} bytes into memory.",
            outputStream.Length
            );
    }
});

Reverse task dependencies

Ever wished you could define your task as a dependency of another task - i.e. a reversed dependency relationship? The good news is that you now can.

Task("A").IsDependeeOf("B");
Task("B");

RunTarget("B");

Since task A is configured to be a dependee of B the task definition will be identical to the following:

Task("A");
Task("B").IsDependentOn("A");

RunTarget("B");

Optional or required task dependencies

You can now explicitly specify whether or not a dependency (or dependee) is optional or required. This is useful if you want to create "extension points" in your build script.

Task("Bar").IsDependencyOf("Foo", required: true);
Task("Baz").IsDependencyOf("Qux", required: false)

In the above example, Bar is dependent on Foo while Baz is dependent on Qux. The difference between the two dependencies above is that Cake will throw an exception if no task called Foo was found.

Contributions were included from:

Full details of everything that was included in these releases can be seen below.

As part of this release we had 29 issues closed.

Breaking change

  • #1805 Change GitVersion settings to use nullable integer

Features

  • #1856 Support MSBuild warnaserror and warnasmessage arguments
  • #1821 Missing Cake method for nuget list
  • #1818 Support task dependees (reverse dependencies)
  • #1766 Support for #define
  • #1032 Support async callbacks

Bugs

  • #1853 using static Directive doesn't compile
  • #1843 NuGetContentResolver should not return ref assemblies.
  • #1842 Params in URI pre-processor directives are case sensitive
  • #1838 Dependencies are installed but have no references added when using LoadDependencies=true with in process nuget client
  • #1831 CleanDirectories Throws NullReferenceException When Token Is Null
  • #1815 Exception Message should be shown rather than "One or more errors occurred."
  • #1404 MsBuildSettings.WithProperty does not escape values

Improvements

  • #1840 Fix Chocolatey Package
  • #1804 Unable to execute when namespace-less assembly with CakeMethodAlias is referenced
  • #1731 GitLabCI variable changes.
  • #1632 Tasks with long names do not display nicely with showdescription
  • #1607 ToolResolutionStrategy fails unexpectedly with Cake.LongPath.Module
  • #1548 LogExtension colorizes output incorrectly
  • #1547 Escaping curly braces in log messages
  • #787 Reference NuGet dependencies installed via the #addin directive

Documentation

  • #1835 Fixed typo in installer scripts
  • #1814 Fix typo: envrionment