Skip to content

Commit

Permalink
Adding documentation, build scripts and metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
agc93 committed Jul 3, 2017
1 parent f2e3b46 commit 2c042a2
Show file tree
Hide file tree
Showing 19 changed files with 864 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Expand Up @@ -276,8 +276,10 @@ __pycache__/
*.pyc

# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
!tools/Modules/packages.config
!tools/packages.config
tools/**
dist/**

# Telerik's JustMock configuration file
*.jmconfig
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Alistair Chapman

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.
3 changes: 3 additions & 0 deletions ReleaseNotes.md
@@ -0,0 +1,3 @@
# 0.1.0

- Initial release
166 changes: 166 additions & 0 deletions build.cake
@@ -0,0 +1,166 @@
#tool "nuget:?package=GitVersion.CommandLine"
#load "helpers.cake"
#tool nuget:?package=docfx.console
#addin nuget:?package=Cake.DocFx

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

var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
var buildFrameworks = Argument("frameworks", "netstandard1.6;net45");
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var solutionPath = File("./src/Cake.AzCopy.sln");
var projects = GetProjects(solutionPath, configuration);
var artifacts = "./dist/";
var testResultsPath = MakeAbsolute(Directory(artifacts + "./test-results"));
GitVersion versionInfo = null;
var frameworks = buildFrameworks.Split(new[] { ";", ","}, StringSplitOptions.RemoveEmptyEntries);

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

Setup(ctx =>
{
// Executed BEFORE the first task.
Information("Running tasks...");
versionInfo = GitVersion();
Information("Building for version {0}", versionInfo.FullSemVer);
Verbose("Building for " + string.Join(", ", frameworks));
});

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

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

Task("Clean")
.Does(() =>
{
// Clean solution directories.
foreach(var path in projects.AllProjectPaths)
{
Information("Cleaning {0}", path);
CleanDirectories(path + "/**/bin/" + configuration);
CleanDirectories(path + "/**/obj/" + configuration);
}
Information("Cleaning common files...");
CleanDirectory(artifacts);
});

Task("Restore")
.Does(() =>
{
// Restore all NuGet packages.
Information("Restoring solution...");
//NuGetRestore(solutionPath);
foreach (var project in projects.AllProjectPaths) {
DotNetCoreRestore(project.FullPath);
}
});

Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
Information("Building solution...");
foreach(var framework in frameworks) {
foreach (var project in projects.SourceProjectPaths) {
var settings = new DotNetCoreBuildSettings {
Framework = framework,
Configuration = configuration,
NoIncremental = true,
};
DotNetCoreBuild(project.FullPath, settings);
}
}
});

Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
CreateDirectory(testResultsPath);
if (projects.TestProjects.Any()) {
var settings = new DotNetCoreTestSettings {
Configuration = configuration
};
foreach(var project in projects.TestProjects) {
DotNetCoreTest(project.Path.FullPath, settings);
}
}
});

Task("Generate-Docs").Does(() => {
DocFxBuild("./docfx/docfx.json");
Zip("./docfx/_site/", artifacts + "/docfx.zip");
});

Task("Post-Build")
.IsDependentOn("Build")
.IsDependentOn("Run-Unit-Tests")
.IsDependentOn("Generate-Docs")
.Does(() =>
{
CreateDirectory(artifacts + "build");
CreateDirectory(artifacts + "modules");
foreach (var project in projects.SourceProjects) {
CreateDirectory(artifacts + "build/" + project.Name);
foreach (var framework in frameworks) {
var frameworkDir = artifacts + "build/" + project.Name + "/" + framework;
CreateDirectory(frameworkDir);
var files = GetFiles(project.Path.GetDirectory() + "/bin/" + configuration + "/" + framework + "/" + project.Name +".*");
CopyFiles(files, frameworkDir);
}
}
});

Task("NuGet")
.IsDependentOn("Post-Build")
.Does(() =>
{
CreateDirectory(artifacts + "package");
Information("Building NuGet package");
var versionNotes = ParseAllReleaseNotes("./ReleaseNotes.md").FirstOrDefault(v => v.Version.ToString() == versionInfo.MajorMinorPatch);
var content = GetContent(frameworks, projects, configuration);
var settings = new NuGetPackSettings {
Id = "Cake.AzCopy",
Version = versionInfo.NuGetVersionV2,
Title = "Cake.AzCopy",
Authors = new[] { "Alistair Chapman" },
Owners = new[] { "achapman", "cake-contrib" },
Description = "A simple Cake addin powered by AzCopy for uploading and downloading to/from Azure Storage (including Blob, Table and Files)",
ReleaseNotes = versionNotes != null ? versionNotes.Notes.ToList() : new List<string>(),
Summary = "A simple Cake addin for AzCopy.",
ProjectUrl = new Uri("https://github.com/agc93/Cake.AzCopy"),
IconUrl = new Uri("https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png"),
LicenseUrl = new Uri("https://raw.githubusercontent.com/agc93/Cake.AzCopy/master/LICENSE"),
Copyright = "Alistair Chapman 2017",
Tags = new[] { "cake", "build", "script", "azure", "azcopy" },
OutputDirectory = artifacts + "/package",
Files = content,
//KeepTemporaryNuSpecFile = true
};
NuGetPack(settings);
});

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

RunTarget(target);

0 comments on commit 2c042a2

Please sign in to comment.