Skip to content
This repository has been archived by the owner on Nov 28, 2020. It is now read-only.

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrik Svensson committed Aug 28, 2016
0 parents commit 64e226a
Show file tree
Hide file tree
Showing 103 changed files with 4,594 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://EditorConfig.org

root = true

[*]
end_of_line = CRLF

[*.ps1]
indent_style = space
indent_size = 2

[*.cs]
indent_style = space
indent_size = 4

[*.cake]
indent_style = space
indent_size = 4

[*.js]
indent_style = tab
indent_size = 2
88 changes: 88 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Misc folders
[Bb]in/
[Oo]bj/
[Tt]emp/
[Ll]ib/
[Pp]ackages/
/[Aa]rtifacts/
/[Tt]ools/
*.sln.ide/

# .NET CLI
/.dotnet/
dotnet-install.sh*
/.packages/

# Visual Studio
.vs/
.vscode/
launchSettings.json
project.lock.json

# Build related
build-results/
tools/Cake/
tools/xunit.runners/
tools/xunit.runner.console/
tools/nuget.exe
tools/gitreleasemanager/
tools/GitVersion.CommandLine/
tools/Addins/
tools/packages.config.md5sum

# mstest test results
TestResults

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates
*.userprefs
*.GhostDoc.xml
*StyleCop.Cache

# Build results
[Dd]ebug/
[Rr]elease/
x64/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.log
*.vspscc
*.vssscc
.builds

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# ReSharper is a .NET coding add-in
_ReSharper*

# NCrunch
*.ncrunch*
.*crunch*.local.xml
_NCrunch_*

# NuGet Packages Directory
packages

# Windows
Thumbs.db
13 changes: 13 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
branches:
master:
mode: ContinuousDelivery
tag:
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
develop:
mode: ContinuousDeployment
tag: alpha
increment: Minor
prevent-increment-of-merged-branch-version: false
track-merge-target: true
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) .NET Foundation and Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
147 changes: 147 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Frosting

A .NET Core host for Cake, that allows you to write your build scripts as a
portable console application (`netstandard1.0`). Frosting is currently
in alpha, but more information, documentation and samples will be added soon.

**Expect things to move around initially. Especially naming of things.**

## Table of Contents

1. [Example](https://github.com/cake-build/frosting#example)
2. [Acknowledgement](https://github.com/cake-build/frosting#documentation)
3. [License](https://github.com/cake-build/frosting#license)

## Example

Start by adding a `project.json` file.
The `Cake.Frosting` package will decide what version of `Cake.Core` and `Cake.Common`
you will run.

```json
{
"version": "0.1.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Cake.Frosting": "0.1.0-alpha001",
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}
```

For the sake of keeping the example simple, all classes are listed after each other,
but you should of course treat the source code of your build scripts like any other
code and divide them up in individual files.

```csharp
using Cake.Core;
using Cake.Core.Diagnostics;
using Cake.Frosting;

public class Program
{
public static int Main(string[] args)
{
// Create the host.
var host = new CakeHostBuilder()
.WithArguments(args)
.ConfigureServices(services =>
{
// Use a custom settings class.
services.UseContext<MySettings>();
})
.Build();

// Run the host.
return host.Run();
}
}

public class MySettings : FrostingContext
{
public bool Magic { get; set; }

public MySettings(ICakeContext context)
: base(context)
{
// You could also use a CakeLifeTime<Settings>
// to provide a Setup method to setup the context.
Magic = context.Arguments.HasArgument("magic");
}
}

[TaskName("Provide-Another-Name-Like-This")]
public class Build : FrostingTask<MySettings>
{
public override bool ShouldRun(Settings context)
{
// Don't run this task on OSX.
return context.Environment.Platform.Family != PlatformFamily.OSX;
}

public override void Run(FrostingTask context)
{
context.Log.Information("Magic: {0}", context.Magic);
}
}

[Dependency(typeof(Build))]
public class Default : FrostingTask
{
// If you don't inherit from the generic task
// the standard ICakeContext will be provided.
}

```

To run the script, simply run it like any .NET Core application.

```powershell
> dotnet restore
> dotnet run --verbosity=verbose --working="./.."
```

## Acknowledgement

The API for configuring and running the host have been heavily influenced by
the [ASP.NET Core hosting API](https://github.com/aspnet/Hosting).

## License

Copyright © Patrik Svensson, Mattias Karlsson, Gary Ewan Park and contributors.
Frosting is provided as-is under the MIT license. For more information see
[LICENSE](https://github.com/cake-build/cake/blob/develop/LICENSE).

* For Autofac, see https://github.com/autofac/Autofac/blob/master/LICENSE

## Thanks

A big thank you has to go to [JetBrains](https://www.jetbrains.com) who provide
each of the Cake developers with an
[Open Source License](https://www.jetbrains.com/support/community/#section=open-source)
for [ReSharper](https://www.jetbrains.com/resharper/) that helps with the development of Cake.

The Cake Team would also like to say thank you to the guys at
[MyGet](https://www.myget.org/) for their support in providing a Professional
subscription which allows us to continue to push all of our pre-release
editions of Cake NuGet packages for early consumption by the Cake community.

## Code of Conduct

This project has adopted the code of conduct defined by the
[Contributor Covenant](http://contributor-covenant.org/) to clarify expected behavior
in our community. For more information see the [.NET Foundation Code of Conduct](http://www.dotnetfoundation.org/code-of-conduct).

## .NET Foundation

This project is supported by the [.NET Foundation](http://www.dotnetfoundation.org).
93 changes: 93 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#load "scripts/parameters.cake"
#load "scripts/version.cake"
#load "scripts/publish.cake"

var parameters = Parameters.Create(Context);

Setup(context =>
{
parameters.Setup(context);

Information("Version: {0}", parameters.Version);
Information("Version suffix: {0}", parameters.Suffix);
Information("Configuration: {0}", parameters.Configuration);
Information("Target: {0}", parameters.Target);
Information("AppVeyor: {0}", parameters.IsRunningOnAppVeyor);
});

Task("Update-Version-Information")
.Does(context =>
{
BuildVersion.UpdateVersion(parameters);
});

Task("Restore")
.IsDependentOn("Update-Version-Information")
.Does(context =>
{
DotNetCoreRestore("./src", new DotNetCoreRestoreSettings
{
Verbose = false,
Verbosity = DotNetCoreRestoreVerbosity.Warning,
Sources = new [] {
"https://www.myget.org/F/xunit/api/v3/index.json",
"https://dotnet.myget.org/F/dotnet-core/api/v3/index.json",
"https://dotnet.myget.org/F/cli-deps/api/v3/index.json",
"https://api.nuget.org/v3/index.json",
"https://www.myget.org/F/cake/api/v3/index.json"
}
});
});

Task("Build")
.IsDependentOn("Restore")
.Does(context =>
{
foreach(var path in parameters.Projects)
{
DotNetCoreBuild(path.FullPath, new DotNetCoreBuildSettings(){
Configuration = "Release",
VersionSuffix = parameters.Suffix
});
}
});

Task("Unit-Tests")
.IsDependentOn("Build")
.Does(context =>
{
DotNetCoreTest("./src/Cake.Frosting.Tests", new DotNetCoreTestSettings {
Configuration = "Release",
NoBuild = true,
Verbose = false
});
});

Task("Package")
.IsDependentOn("Unit-Tests")
.Does(context =>
{
DotNetCorePack("./src/Cake.Frosting/project.json", new DotNetCorePackSettings(){
Configuration = "Release",
VersionSuffix = parameters.Suffix,
NoBuild = true,
Verbose = false
});
});

Task("Publish-MyGet")
.IsDependentOn("Package")
.WithCriteria(() => parameters.ShouldPublishToMyGet)
.Does(context =>
{
Publish(context, parameters, parameters.MyGetSource, parameters.MyGetApiKey);
});

Task("Default")
.IsDependentOn("Package");

Task("AppVeyor")
.WithCriteria(parameters.IsRunningOnAppVeyor)
.IsDependentOn("Publish-MyGet");

RunTarget(parameters.Target);
Loading

0 comments on commit 64e226a

Please sign in to comment.