Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.

Commit

Permalink
First commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
patriksvensson committed Nov 29, 2014
0 parents commit 765f462
Show file tree
Hide file tree
Showing 29 changed files with 1,014 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Misc folders
[Bb]in/
[Oo]bj/
[Tt]emp/
[Ll]ib/
[Pp]ackages/
[Bb]uild/
*.sln.ide/

# Build related
build-results/
tools/Cake/
tools/xunit.runners/
tools/WiX.Toolset/

# 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

# 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
2 changes: 2 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### New in 0.0.1 (Released 2014/11/29)
* First version of the Cake bootstrapper.
134 changes: 134 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////

var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");

//////////////////////////////////////////////////////////////////////
// VERSION
//////////////////////////////////////////////////////////////////////

var releaseNotes = ParseReleaseNotes("./ReleaseNotes.md");
var version = releaseNotes.Version.ToString();

//////////////////////////////////////////////////////////////////////
// DIRECTORIES
//////////////////////////////////////////////////////////////////////

var buildDirectory = "./build/" + "v" + version;
var buildBinDirectory = buildDirectory + "/bin";
var buildInstallerDirectory = buildDirectory + "/installer";
var buildCandleDirectory = buildDirectory + "/installer/wixobj";
var chocolateyRoot = buildDirectory + "/chocolatey";
var chocolateyToolsDirectory = chocolateyRoot + "/tools";

var binDirectory = "./src/Bootstrapper/Cake.Bootstrapper/bin/";
var outputDirectory = binDirectory + configuration;

//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////

Task("Clean")
.Does(() =>
{
CleanDirectories(new[] { buildDirectory, buildBinDirectory,
buildInstallerDirectory, buildCandleDirectory,
chocolateyRoot, chocolateyToolsDirectory, outputDirectory });
});

Task("Update-Versions")
.IsDependentOn("Clean")
.Does(() =>
{
var file = "./src/SolutionInfo.cs";
CreateAssemblyInfo(file, new AssemblyInfoSettings {
Product = "Cake",
Version = version,
FileVersion = version,
InformationalVersion = version,
Copyright = "Copyright (c) Patrik Svensson 2014"
});
});

Task("Restore-NuGet-Packages")
.IsDependentOn("Update-Versions")
.Does(() =>
{
NuGetRestore("./src/Bootstrapper/Cake.Bootstrapper.sln");
});

Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
MSBuild("./src/Bootstrapper/Cake.Bootstrapper.sln", settings =>
settings.SetConfiguration(configuration)
.UseToolVersion(MSBuildToolVersion.NET45));
});

Task("Copy-Files")
.IsDependentOn("Build")
.Does(() =>
{
CopyFileToDirectory(outputDirectory + "/Cake.Bootstrapper.dll", buildBinDirectory);
CopyFileToDirectory(outputDirectory + "/Cake.Bootstrapper.psd1", buildBinDirectory);
CopyFileToDirectory(outputDirectory + "/Cake.Core.dll", buildBinDirectory);
CopyFileToDirectory(outputDirectory + "/Autofac.dll", buildBinDirectory);
CopyFileToDirectory(outputDirectory + "/NuGet.Core.dll", buildBinDirectory);
CopyFileToDirectory("./res/cake.ico", buildBinDirectory);
CopyFileToDirectory("./res/scripts/build.cake", buildBinDirectory);
CopyFileToDirectory("./res/scripts/build.ps1", buildBinDirectory);
});

Task("Build-Installer")
.IsDependentOn("Copy-Files")
.Does(() =>
{
// Invoke Candle
var files = GetFiles("./src/Installer/**/*.wxs");
WiXCandle(files, new CandleSettings {
OutputDirectory = buildCandleDirectory,
Extensions = new List<string> { "WixUtilExtension" },
Defines = new Dictionary<string, string> {
{ "BinDir", buildBinDirectory },
{ "BuildVersion", "1.0.0" }
}
});

// Invoke Light
var objFiles = GetFiles(buildCandleDirectory + "/*.wixobj");
WiXLight(objFiles, new LightSettings {
OutputFile = buildInstallerDirectory + "/Cake-Bootstrapper-v" + version + ".msi",
Extensions = new List<string> { "WixUIExtension", "WixUtilExtension", "WixNetFxExtension" }
});
});

Task("Build-Chocolatey")
.IsDependentOn("Build-Installer")
.Does(() =>
{
// Create chocolateyInstall.ps1 in chocolatey tools output.
var url = "https://github.com/cake-build/bootstrapper/releases/download/v" + version + "/Cake-Bootstrapper-v" + version + ".zip";
string text = File.ReadAllText("./src/Chocolatey/tools/chocolateyInstall.ps1");
text = text.Replace("%DOWNLOAD_URL%", url);
File.WriteAllText(chocolateyToolsDirectory + "/chocolateyInstall.ps1", text);

NuGetPack("./src/Chocolatey/Cake.Bootstrapper.nuspec", new NuGetPackSettings {
Version = version,
ReleaseNotes = releaseNotes.Notes.ToArray(),
BasePath = chocolateyRoot,
OutputDirectory = chocolateyRoot,
NoPackageAnalysis = true,
});
});

Task("Default")
.IsDependentOn("Build-Chocolatey");

//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////

RunTarget(target);
49 changes: 49 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<#
Copyright (C) 2014 Patrik Svensson
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.
#>

Param(
[string]$Script = "build.cake",
[string]$Target = "Default",
[string]$Configuration = "Release",
[string]$Verbosity = "Verbose"
)

$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"

# Make sure NuGet exists where we expect it.
if (!(Test-Path $NUGET_EXE)) {
Throw "Could not find NuGet.exe"
}

# Restore tools from NuGet.
Start-Process $NUGET_EXE -ArgumentList "install -ExcludeVersion" -WorkingDirectory $TOOLS_DIR -Wait -NoNewWindow

# Make sure that Cake has been installed.
if (!(Test-Path $CAKE_EXE)) {
Throw "Could not find Cake.exe"
}

# Start Cake
Write-Host
Start-Process $CAKE_EXE -Wait -NoNewWindow -ArgumentList "$Script -target=$Target -configuration=$Configuration -verbosity=$Verbosity"
Write-Host
Binary file added res/cake.ico
Binary file not shown.
50 changes: 50 additions & 0 deletions res/scripts/build.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
Cake build script template
*/

//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////

var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");

//////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
//////////////////////////////////////////////////////////////////////

Setup(() =>
{
// Executed BEFORE the first task.
Information("Running tasks...");
});

Teardown(() =>
{
// Executed AFTER the last task.
Information("Finished running tasks.");
});

//////////////////////////////////////////////////////////////////////
// TASK DEFINITIONS
//////////////////////////////////////////////////////////////////////

Task("Clean")
.Does(() =>
{
});

Task("Build")
.IsDependentOn("Clean")
.Does(() =>
{
});

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

//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////

RunTarget(target);
49 changes: 49 additions & 0 deletions res/scripts/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<#
Copyright (C) 2014 Patrik Svensson
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.
#>

Param(
[string]$Script = "build.cake",
[string]$Target = "Default",
[string]$Configuration = "Release",
[string]$Verbosity = "Verbose"
)

$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"

# Make sure NuGet exists where we expect it.
if (!(Test-Path $NUGET_EXE)) {
Throw "Could not find NuGet.exe"
}

# Restore tools from NuGet.
Start-Process $NUGET_EXE -ArgumentList "install -ExcludeVersion" -WorkingDirectory $TOOLS_DIR -Wait -NoNewWindow

# Make sure that Cake has been installed.
if (!(Test-Path $CAKE_EXE)) {
Throw "Could not find Cake.exe"
}

# Start Cake
Write-Host
Start-Process $CAKE_EXE -Wait -NoNewWindow -ArgumentList "$Script -target=$Target -configuration=$Configuration -verbosity=$Verbosity"
Write-Host
22 changes: 22 additions & 0 deletions src/Bootstrapper/Cake.Bootstrapper.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.Bootstrapper", "Cake.Bootstrapper\Cake.Bootstrapper.csproj", "{69F01920-D32A-479B-BA88-7AEED898D4BC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{69F01920-D32A-479B-BA88-7AEED898D4BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69F01920-D32A-479B-BA88-7AEED898D4BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69F01920-D32A-479B-BA88-7AEED898D4BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69F01920-D32A-479B-BA88-7AEED898D4BC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading

0 comments on commit 765f462

Please sign in to comment.