This commit is contained in:
Wiesław Šoltés 2016-09-03 15:04:50 +02:00
Родитель 52afb30502
Коммит 0749716533
19 изменённых файлов: 966 добавлений и 22 удалений

90
.gitattributes поставляемый
Просмотреть файл

@ -1,22 +1,74 @@
# Auto detect text files and perform LF normalization
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
# Git files
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
# NuGet packages
packages export-ignore
# API Documentation
api export-ignore

11
.gitignore поставляемый
Просмотреть файл

@ -161,3 +161,14 @@ pip-log.txt
# Mac crap
.DS_Store
#docfx
_site
api
#################
## Cake
#################
tools/
.nuget
artifacts/

16
.travis.yml Normal file
Просмотреть файл

@ -0,0 +1,16 @@
language: csharp
os:
- linux
- osx
mono:
- latest
script:
- ./build.sh --target "Travis" --platform "Mono" --configuration "Release"
notifications:
email: false
webhooks:
urls:
- https://webhooks.gitter.im/e/d9a05a0b1fcbe768bbcd
on_success: change
on_failure: always
on_start: never

7
NuGet.Config Normal file
Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>

Просмотреть файл

@ -1,12 +1,45 @@
# SimpleWavSplitter
[![Gitter](https://badges.gitter.im/wieslawsoltes/SimpleWavSplitter.svg)](https://gitter.im/wieslawsoltes/SimpleWavSplitter?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Build status](https://ci.appveyor.com/api/projects/status/pfooqgyo9uwrj44o/branch/master?svg=true)](https://ci.appveyor.com/project/wieslawsoltes/simplewavsplitter/branch/master)
[![Build Status](https://travis-ci.org/wieslawsoltes/SimpleWavSplitter.svg?branch=master)](https://travis-ci.org/wieslawsoltes/SimpleWavSplitter)
[![NuGet](https://img.shields.io/nuget/v/WavFile.svg)](https://www.nuget.org/packages/WavFile)
[![MyGet](https://img.shields.io/myget/simplewavsplitter-nightly/vpre/WavFile.svg?label=myget)](https://www.myget.org/gallery/simplewavsplitter-nightly)
Split multi-channel WAV files into single channel WAV files.
* To run program please install .NET Framework Version 4.5
* To build program use Microsoft Visual C# 2015.
* Download are available at: https://github.com/wieslawsoltes/SimpleWavSplitter
## Examples
## NuGet
SimpleWavSplitter is delivered as a NuGet package.
You can find the package on [NuGet](https://www.nuget.org/packages/WavFile/) or by using nightly build feed:
* Add `https://www.myget.org/F/simplewavsplitter-nightly/api/v2` to your package sources
* Update your package using `WavFile` feed
You can install the package like this:
`Install-Package WavFile -Pre`
### Package Dependencies
Does not require any external dependencies.
### Package Sources
* https://api.nuget.org/v3/index.json
* https://www.myget.org/F/simplewavsplitter-nightly/api/v2
## Resources
* [GitHub source code repository.](https://github.com/wieslawsoltes/SimpleWavSplitter)
## Using SimpleWavSplitter
### Split Wav Files

Просмотреть файл

@ -1,5 +1,4 @@

WAV File Reference
WAV File Reference
Copyright (c) Wiesław Šoltés. All rights reserved.
Licensed under the MIT license. See LICENSE file in the project root for full license information.

Просмотреть файл

@ -25,21 +25,33 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mono = Debug|Mono
Release|Any CPU = Release|Any CPU
Release|Mono = Release|Mono
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{746BB582-59A3-409A-A9C9-53CCFC287D3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{746BB582-59A3-409A-A9C9-53CCFC287D3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{746BB582-59A3-409A-A9C9-53CCFC287D3F}.Debug|Mono.ActiveCfg = Debug|Any CPU
{746BB582-59A3-409A-A9C9-53CCFC287D3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{746BB582-59A3-409A-A9C9-53CCFC287D3F}.Release|Any CPU.Build.0 = Release|Any CPU
{746BB582-59A3-409A-A9C9-53CCFC287D3F}.Release|Mono.ActiveCfg = Release|Any CPU
{76465033-784D-46A6-929B-B4B35E7D422E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76465033-784D-46A6-929B-B4B35E7D422E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76465033-784D-46A6-929B-B4B35E7D422E}.Debug|Mono.ActiveCfg = Debug|Any CPU
{76465033-784D-46A6-929B-B4B35E7D422E}.Debug|Mono.Build.0 = Debug|Any CPU
{76465033-784D-46A6-929B-B4B35E7D422E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76465033-784D-46A6-929B-B4B35E7D422E}.Release|Any CPU.Build.0 = Release|Any CPU
{76465033-784D-46A6-929B-B4B35E7D422E}.Release|Mono.ActiveCfg = Release|Any CPU
{76465033-784D-46A6-929B-B4B35E7D422E}.Release|Mono.Build.0 = Release|Any CPU
{0DB24D15-3920-44C4-83FA-89D0F7565E42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0DB24D15-3920-44C4-83FA-89D0F7565E42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0DB24D15-3920-44C4-83FA-89D0F7565E42}.Debug|Mono.ActiveCfg = Debug|Any CPU
{0DB24D15-3920-44C4-83FA-89D0F7565E42}.Debug|Mono.Build.0 = Debug|Any CPU
{0DB24D15-3920-44C4-83FA-89D0F7565E42}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0DB24D15-3920-44C4-83FA-89D0F7565E42}.Release|Any CPU.Build.0 = Release|Any CPU
{0DB24D15-3920-44C4-83FA-89D0F7565E42}.Release|Mono.ActiveCfg = Release|Any CPU
{0DB24D15-3920-44C4-83FA-89D0F7565E42}.Release|Mono.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

28
appveyor.yml Normal file
Просмотреть файл

@ -0,0 +1,28 @@
image: Visual Studio 2015
platform:
- Any CPU
configuration:
- Release
environment:
NUGET_API_KEY:
secure: iSkm19DNdKOLxxCvHiaKikWXy25ZMwGBKpv+EgEprliGl0qX5HtKohLmwJsLnx5O
NUGET_API_URL: https://www.nuget.org/api/v2/package
MYGET_API_KEY:
secure: xhYvrWYPHdNI+mQD+f4Zu3baL7fqW+nO/hYXJdN070Lej8wpa6gfrLi1NGtnQlAs
MYGET_API_URL: https://www.myget.org/F/simplewavsplitter-nightly/api/v2/package
before_build:
- cmd: git submodule update --init
build_script:
- ps: .\build.ps1 -Target "AppVeyor" -Platform "$env:platform" -Configuration "$env:configuration"
test: off
notifications:
- provider: Webhook
url: https://webhooks.gitter.im/e/3211907a32bb8b42a441
method: POST
on_build_success: true
on_build_failure: true
on_build_status_changed: true
artifacts:
- path: artifacts\test-results\*.xml
- path: artifacts\nuget\*.nupkg
- path: artifacts\zip\*.zip

406
build.cake Normal file
Просмотреть файл

@ -0,0 +1,406 @@
///////////////////////////////////////////////////////////////////////////////
// ADDINS
///////////////////////////////////////////////////////////////////////////////
#addin "nuget:?package=Polly&version=4.2.0"
#addin "nuget:?package=NuGet.Core&version=2.12.0"
#addin "nuget:?package=Cake.DocFx&version=0.1.6"
///////////////////////////////////////////////////////////////////////////////
// TOOLS
///////////////////////////////////////////////////////////////////////////////
#tool "nuget:?package=xunit.runner.console&version=2.1.0"
#tool "nuget:?package=docfx.msbuild&version=2.4.0"
///////////////////////////////////////////////////////////////////////////////
// USINGS
///////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using Polly;
using NuGet;
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var platform = Argument("platform", "Any CPU");
var configuration = Argument("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
var MainRepo = "wieslawsoltes/SimpleWavSplitter";
var MasterBranch = "master";
var AssemblyInfoPath = File("./src/Shared/SharedAssemblyInfo.cs");
var ReleasePlatform = "Any CPU";
var ReleaseConfiguration = "Release";
var MSBuildSolution = "./SimpleWavSplitter.sln";
var XBuildSolution = "./SimpleWavSplitter.sln";
var DocFxProject = "./docs/docfx.json";
///////////////////////////////////////////////////////////////////////////////
// PARAMETERS
///////////////////////////////////////////////////////////////////////////////
var isPlatformAnyCPU = StringComparer.OrdinalIgnoreCase.Equals(platform, "Any CPU");
var isPlatformX86 = StringComparer.OrdinalIgnoreCase.Equals(platform, "x86");
var isPlatformX64 = StringComparer.OrdinalIgnoreCase.Equals(platform, "x64");
var isLocalBuild = BuildSystem.IsLocalBuild;
var isRunningOnUnix = IsRunningOnUnix();
var isRunningOnWindows = IsRunningOnWindows();
var isRunningOnAppVeyor = BuildSystem.AppVeyor.IsRunningOnAppVeyor;
var isPullRequest = BuildSystem.AppVeyor.Environment.PullRequest.IsPullRequest;
var isMainRepo = StringComparer.OrdinalIgnoreCase.Equals(MainRepo, BuildSystem.AppVeyor.Environment.Repository.Name);
var isMasterBranch = StringComparer.OrdinalIgnoreCase.Equals(MasterBranch, BuildSystem.AppVeyor.Environment.Repository.Branch);
var isTagged = BuildSystem.AppVeyor.Environment.Repository.Tag.IsTag
&& !string.IsNullOrWhiteSpace(BuildSystem.AppVeyor.Environment.Repository.Tag.Name);
var isReleasable = StringComparer.OrdinalIgnoreCase.Equals(ReleasePlatform, platform)
&& StringComparer.OrdinalIgnoreCase.Equals(ReleaseConfiguration, configuration);
var isMyGetRelease = !isTagged && isReleasable;
var isNuGetRelease = isTagged && isReleasable;
///////////////////////////////////////////////////////////////////////////////
// VERSION
///////////////////////////////////////////////////////////////////////////////
var version = ParseAssemblyInfo(AssemblyInfoPath).AssemblyVersion;
if (isRunningOnAppVeyor)
{
if (isTagged)
{
// Use Tag Name as version
version = BuildSystem.AppVeyor.Environment.Repository.Tag.Name;
}
else
{
// Use AssemblyVersion with Build as version
version += "-build" + EnvironmentVariable("APPVEYOR_BUILD_NUMBER") + "-alpha";
}
}
///////////////////////////////////////////////////////////////////////////////
// DIRECTORIES
///////////////////////////////////////////////////////////////////////////////
var artifactsDir = (DirectoryPath)Directory("./artifacts");
var testResultsDir = artifactsDir.Combine("test-results");
var nugetRoot = artifactsDir.Combine("nuget");
var zipRoot = artifactsDir.Combine("zip");
var docsRoot = artifactsDir.Combine("docs");
var docsSiteRoot = docsRoot.Combine("_site");
var dirSuffix = isPlatformAnyCPU ? configuration : platform + "/" + configuration;
var zipDocsSiteArtifacts = zipRoot.CombineWithFilePath("SimpleWavSplitter-Docs-" + version + ".zip");
var buildDirs =
GetDirectories("./src/**/bin/" + dirSuffix) +
GetDirectories("./src/**/obj/" + dirSuffix) +
GetDirectories("./samples/**/bin/" + dirSuffix) +
GetDirectories("./samples/**/obj/" + dirSuffix) +
GetDirectories("./tests/**/bin/" + dirSuffix) +
GetDirectories("./tests/**/obj/" + dirSuffix);
///////////////////////////////////////////////////////////////////////////////
// NUGET NUSPECS
///////////////////////////////////////////////////////////////////////////////
var nuspecNuGetWavFile = new NuGetPackSettings()
{
Id = "WavFile",
Version = version,
Authors = new [] { "wieslaw.soltes" },
Owners = new [] { "wieslaw.soltes" },
LicenseUrl = new Uri("http://opensource.org/licenses/MIT"),
ProjectUrl = new Uri("https://github.com/wieslawsoltes/SimpleWavSplitter/"),
RequireLicenseAcceptance = false,
Symbols = false,
NoPackageAnalysis = true,
Description = "Reactive undo/redo framework for .NET.",
Copyright = "Copyright 2016",
Tags = new [] { "Wav", "Audio", "Splitter", "Multi-channel", "Managed", "C#" },
Files = new []
{
new NuSpecContent { Source = "src/WavFile/bin/" + dirSuffix + "/WavFile.dll", Target = "lib/net45" },
new NuSpecContent { Source = "src/WavFile/bin/" + dirSuffix + "/WavFile.xml", Target = "lib/net45" }
},
BasePath = Directory("./"),
OutputDirectory = nugetRoot
};
var nuspecNuGetSettings = new List<NuGetPackSettings>();
nuspecNuGetSettings.Add(nuspecNuGetWavFile);
var nugetPackages = nuspecNuGetSettings.Select(nuspec => {
return nuspec.OutputDirectory.CombineWithFilePath(string.Concat(nuspec.Id, ".", nuspec.Version, ".nupkg"));
}).ToArray();
///////////////////////////////////////////////////////////////////////////////
// INFORMATION
///////////////////////////////////////////////////////////////////////////////
Information("Building version {0} of SimpleWavSplitter ({1}, {2}, {3}) using version {4} of Cake.",
version,
platform,
configuration,
target,
typeof(ICakeContext).Assembly.GetName().Version.ToString());
if (isRunningOnAppVeyor)
{
Information("Repository Name: " + BuildSystem.AppVeyor.Environment.Repository.Name);
Information("Repository Branch: " + BuildSystem.AppVeyor.Environment.Repository.Branch);
}
Information("Target: " + target);
Information("Platform: " + platform);
Information("Configuration: " + configuration);
Information("IsLocalBuild: " + isLocalBuild);
Information("IsRunningOnUnix: " + isRunningOnUnix);
Information("IsRunningOnWindows: " + isRunningOnWindows);
Information("IsRunningOnAppVeyor: " + isRunningOnAppVeyor);
Information("IsPullRequest: " + isPullRequest);
Information("IsMainRepo: " + isMainRepo);
Information("IsMasterBranch: " + isMasterBranch);
Information("IsTagged: " + isTagged);
Information("IsReleasable: " + isReleasable);
Information("IsMyGetRelease: " + isMyGetRelease);
Information("IsNuGetRelease: " + isNuGetRelease);
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectories(buildDirs);
CleanDirectory(artifactsDir);
CleanDirectory(testResultsDir);
CleanDirectory(nugetRoot);
CleanDirectory(zipRoot);
CleanDirectory(docsRoot);
CleanDirectory(docsSiteRoot);
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
var maxRetryCount = 5;
var toolTimeout = 1d;
Policy
.Handle<Exception>()
.Retry(maxRetryCount, (exception, retryCount, context) => {
if (retryCount == maxRetryCount)
{
throw exception;
}
else
{
Verbose("{0}", exception);
toolTimeout+=0.5;
}})
.Execute(()=> {
if(isRunningOnWindows)
{
NuGetRestore(MSBuildSolution, new NuGetRestoreSettings {
ToolTimeout = TimeSpan.FromMinutes(toolTimeout)
});
}
else
{
NuGetRestore(XBuildSolution, new NuGetRestoreSettings {
ToolTimeout = TimeSpan.FromMinutes(toolTimeout)
});
}
});
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
if(isRunningOnWindows)
{
MSBuild(MSBuildSolution, settings => {
settings.SetConfiguration(configuration);
settings.WithProperty("Platform", "\"" + platform + "\"");
settings.SetVerbosity(Verbosity.Minimal);
});
}
else
{
XBuild(XBuildSolution, settings => {
settings.SetConfiguration(configuration);
settings.WithProperty("Platform", "\"" + platform + "\"");
settings.SetVerbosity(Verbosity.Minimal);
});
}
});
Task("Run-Unit-Tests")
.IsDependentOn("Build")
.Does(() =>
{
string pattern = "./tests/**/bin/" + dirSuffix + "/*.UnitTests.dll";
if (isPlatformAnyCPU || isPlatformX86)
{
XUnit2(pattern, new XUnit2Settings {
ToolPath = "./tools/xunit.runner.console/tools/xunit.console.x86.exe",
OutputDirectory = testResultsDir,
XmlReportV1 = true,
NoAppDomain = true
});
}
else
{
XUnit2(pattern, new XUnit2Settings {
ToolPath = "./tools/xunit.runner.console/tools/xunit.console.exe",
OutputDirectory = testResultsDir,
XmlReportV1 = true,
NoAppDomain = true
});
}
});
Task("Create-Docs")
.IsDependentOn("Run-Unit-Tests")
.Does(() =>
{
DocFxMetadata(DocFxProject);
DocFxBuild(DocFxProject, new DocFxBuildSettings() {
OutputPath = docsRoot
});
});
Task("Zip-Files")
.IsDependentOn("Create-Docs")
.Does(() =>
{
Zip(docsSiteRoot, zipDocsSiteArtifacts);
});
Task("Create-NuGet-Packages")
.IsDependentOn("Run-Unit-Tests")
.Does(() =>
{
foreach(var nuspec in nuspecNuGetSettings)
{
NuGetPack(nuspec);
}
});
Task("Publish-Docs")
.IsDependentOn("Create-Docs")
.WithCriteria(() => !isLocalBuild)
.WithCriteria(() => !isPullRequest)
.WithCriteria(() => isMainRepo)
.WithCriteria(() => isMasterBranch)
.WithCriteria(() => isNuGetRelease)
.Does(() =>
{
});
Task("Publish-MyGet")
.IsDependentOn("Create-NuGet-Packages")
.WithCriteria(() => !isLocalBuild)
.WithCriteria(() => !isPullRequest)
.WithCriteria(() => isMainRepo)
.WithCriteria(() => isMasterBranch)
.WithCriteria(() => isMyGetRelease)
.Does(() =>
{
var apiKey = EnvironmentVariable("MYGET_API_KEY");
if(string.IsNullOrEmpty(apiKey))
{
throw new InvalidOperationException("Could not resolve MyGet API key.");
}
var apiUrl = EnvironmentVariable("MYGET_API_URL");
if(string.IsNullOrEmpty(apiUrl))
{
throw new InvalidOperationException("Could not resolve MyGet API url.");
}
foreach(var nupkg in nugetPackages)
{
NuGetPush(nupkg, new NuGetPushSettings {
Source = apiUrl,
ApiKey = apiKey
});
}
})
.OnError(exception =>
{
Information("Publish-MyGet Task failed, but continuing with next Task...");
});
Task("Publish-NuGet")
.IsDependentOn("Create-NuGet-Packages")
.WithCriteria(() => !isLocalBuild)
.WithCriteria(() => !isPullRequest)
.WithCriteria(() => isMainRepo)
.WithCriteria(() => isMasterBranch)
.WithCriteria(() => isNuGetRelease)
.Does(() =>
{
var apiKey = EnvironmentVariable("NUGET_API_KEY");
if(string.IsNullOrEmpty(apiKey))
{
throw new InvalidOperationException("Could not resolve NuGet API key.");
}
var apiUrl = EnvironmentVariable("NUGET_API_URL");
if(string.IsNullOrEmpty(apiUrl))
{
throw new InvalidOperationException("Could not resolve NuGet API url.");
}
foreach(var nupkg in nugetPackages)
{
NuGetPush(nupkg, new NuGetPushSettings {
ApiKey = apiKey,
Source = apiUrl
});
}
})
.OnError(exception =>
{
Information("Publish-NuGet Task failed, but continuing with next Task...");
});
///////////////////////////////////////////////////////////////////////////////
// TARGETS
///////////////////////////////////////////////////////////////////////////////
Task("Package")
.IsDependentOn("Zip-Files")
.IsDependentOn("Create-NuGet-Packages");
Task("Default")
.IsDependentOn("Package");
Task("AppVeyor")
.IsDependentOn("Zip-Files")
.IsDependentOn("Publish-Docs")
.IsDependentOn("Publish-MyGet")
.IsDependentOn("Publish-NuGet");
Task("Travis")
.IsDependentOn("Run-Unit-Tests");
///////////////////////////////////////////////////////////////////////////////
// EXECUTE
///////////////////////////////////////////////////////////////////////////////
RunTarget(target);

193
build.ps1 Normal file
Просмотреть файл

@ -0,0 +1,193 @@
##########################################################################
# This is the Cake bootstrapper script for PowerShell.
# This file was downloaded from https://github.com/cake-build/resources
# Feel free to change this file to fit your needs.
##########################################################################
<#
.SYNOPSIS
This is a Powershell script to bootstrap a Cake build.
.DESCRIPTION
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
and execute your Cake build script with the parameters you provide.
.PARAMETER Script
The build script to execute.
.PARAMETER Target
The build script target to run.
.PARAMETER Platform
The build platform to use.
.PARAMETER Configuration
The build configuration to use.
.PARAMETER Verbosity
Specifies the amount of information to be displayed.
.PARAMETER Experimental
Tells Cake to use the latest Roslyn release.
.PARAMETER WhatIf
Performs a dry run of the build script.
No tasks will be executed.
.PARAMETER Mono
Tells Cake to use the Mono scripting engine.
.PARAMETER SkipToolPackageRestore
Skips restoring of packages.
.PARAMETER ScriptArgs
Remaining arguments are added here.
.LINK
http://cakebuild.net
#>
[CmdletBinding()]
Param(
[string]$Script = "build.cake",
[string]$Target = "Default",
[ValidateSet("Any CPU", "x86", "x64")]
[string]$Platform = "Any CPU",
[ValidateSet("Release", "Debug")]
[string]$Configuration = "Release",
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
[string]$Verbosity = "Verbose",
[switch]$Experimental,
[Alias("DryRun","Noop")]
[switch]$WhatIf,
[switch]$Mono,
[switch]$SkipToolPackageRestore,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$ScriptArgs
)
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
function MD5HashFile([string] $filePath)
{
if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf))
{
return $null
}
[System.IO.Stream] $file = $null;
[System.Security.Cryptography.MD5] $md5 = $null;
try
{
$md5 = [System.Security.Cryptography.MD5]::Create()
$file = [System.IO.File]::OpenRead($filePath)
return [System.BitConverter]::ToString($md5.ComputeHash($file))
}
finally
{
if ($file -ne $null)
{
$file.Dispose()
}
}
}
Write-Host "Preparing to run build script..."
if(!$PSScriptRoot){
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
}
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
# Should we use mono?
$UseMono = "";
if($Mono.IsPresent) {
Write-Verbose -Message "Using the Mono based scripting engine."
$UseMono = "-mono"
}
# Should we use the new Roslyn?
$UseExperimental = "";
if($Experimental.IsPresent -and !($Mono.IsPresent)) {
Write-Verbose -Message "Using experimental version of Roslyn."
$UseExperimental = "-experimental"
}
# Is this a dry run?
$UseDryRun = "";
if($WhatIf.IsPresent) {
$UseDryRun = "-dryrun"
}
# Make sure tools folder exists
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
Write-Verbose -Message "Creating tools directory..."
New-Item -Path $TOOLS_DIR -Type directory | out-null
}
# Make sure that packages.config exist.
if (!(Test-Path $PACKAGES_CONFIG)) {
Write-Verbose -Message "Downloading packages.config..."
try { (New-Object System.Net.WebClient).DownloadFile("http://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch {
Throw "Could not download packages.config."
}
}
# Try find NuGet.exe in path if not exists
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Trying to find nuget.exe in PATH..."
$existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_) }
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
$NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
}
}
# Try download NuGet.exe if not exists
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Downloading NuGet.exe..."
try {
(New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE)
} catch {
Throw "Could not download NuGet.exe."
}
}
# Save nuget.exe path to environment to be available to child processed
$ENV:NUGET_EXE = $NUGET_EXE
# Restore tools from NuGet?
if(-Not $SkipToolPackageRestore.IsPresent) {
Push-Location
Set-Location $TOOLS_DIR
# Check for changes in packages.config and remove installed tools if true.
[string] $md5Hash = MD5HashFile($PACKAGES_CONFIG)
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
Write-Verbose -Message "Missing or changed package.config hash..."
Remove-Item * -Recurse -Exclude packages.config,nuget.exe
}
Write-Verbose -Message "Restoring tools from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
if ($LASTEXITCODE -ne 0) {
Throw "An error occured while restoring NuGet tools."
}
else
{
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
}
Write-Verbose -Message ($NuGetOutput | out-string)
Pop-Location
}
# Make sure that Cake has been installed.
if (!(Test-Path $CAKE_EXE)) {
Throw "Could not find Cake.exe at $CAKE_EXE"
}
# Start Cake
Write-Host "Running build script..."
Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -platform=`"$Platform`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
exit $LASTEXITCODE

103
build.sh Normal file
Просмотреть файл

@ -0,0 +1,103 @@
#!/usr/bin/env bash
##########################################################################
# This is the Cake bootstrapper script for Linux and OS X.
# This file was downloaded from https://github.com/cake-build/resources
# Feel free to change this file to fit your needs.
##########################################################################
# Define directories.
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TOOLS_DIR=$SCRIPT_DIR/tools
NUGET_EXE=$TOOLS_DIR/nuget.exe
CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe
PACKAGES_CONFIG=$TOOLS_DIR/packages.config
PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum
# Define md5sum or md5 depending on Linux/OSX
MD5_EXE=
if [[ "$(uname -s)" == "Darwin" ]]; then
MD5_EXE="md5 -r"
else
MD5_EXE="md5sum"
fi
# Define default arguments.
SCRIPT="build.cake"
TARGET="Default"
CONFIGURATION="Release"
PLATFORM="Any CPU"
VERBOSITY="verbose"
DRYRUN=
SHOW_VERSION=false
SCRIPT_ARGUMENTS=()
# Parse arguments.
for i in "$@"; do
case $1 in
-s|--script) SCRIPT="$2"; shift ;;
-t|--target) TARGET="$2"; shift ;;
-p|--platform) PLATFORM="$2"; shift ;;
-c|--configuration) CONFIGURATION="$2"; shift ;;
-v|--verbosity) VERBOSITY="$2"; shift ;;
-d|--dryrun) DRYRUN="-dryrun" ;;
--version) SHOW_VERSION=true ;;
--) shift; SCRIPT_ARGUMENTS+=("$@"); break ;;
*) SCRIPT_ARGUMENTS+=("$1") ;;
esac
shift
done
# Make sure the tools folder exist.
if [ ! -d "$TOOLS_DIR" ]; then
mkdir "$TOOLS_DIR"
fi
# Make sure that packages.config exist.
if [ ! -f "$TOOLS_DIR/packages.config" ]; then
echo "Downloading packages.config..."
curl -Lsfo "$TOOLS_DIR/packages.config" http://cakebuild.net/download/bootstrapper/packages
if [ $? -ne 0 ]; then
echo "An error occured while downloading packages.config."
exit 1
fi
fi
# Download NuGet if it does not exist.
if [ ! -f "$NUGET_EXE" ]; then
echo "Downloading NuGet..."
curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
if [ $? -ne 0 ]; then
echo "An error occured while downloading nuget.exe."
exit 1
fi
fi
# Restore tools from NuGet.
pushd "$TOOLS_DIR" >/dev/null
if [ ! -f $PACKAGES_CONFIG_MD5 ] || [ "$( cat $PACKAGES_CONFIG_MD5 | sed 's/\r$//' )" != "$( $MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' )" ]; then
find . -type d ! -name . | xargs rm -rf
fi
mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet packages."
exit 1
fi
$MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' >| $PACKAGES_CONFIG_MD5
popd >/dev/null
# Make sure that Cake has been installed.
if [ ! -f "$CAKE_EXE" ]; then
echo "Could not find Cake.exe at '$CAKE_EXE'."
exit 1
fi
# Start Cake
if $SHOW_VERSION; then
exec mono "$CAKE_EXE" -version
else
exec mono "$CAKE_EXE" $SCRIPT -verbosity=$VERBOSITY -platform="$PLATFORM" -configuration="$CONFIGURATION" -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
fi

3
docs/.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
#docfx
_site
api

21
docs/README.md Normal file
Просмотреть файл

@ -0,0 +1,21 @@
# SimpleWavSplitter Documentation
* [API Reference](http://wieslawsoltes.github.io/SimpleWavSplitter/)
## Building
Download and unzip `docfx.zip` into `Documentation` folder from [DocFX project site](https://github.com/dotnet/docfx/releases).
**Step 1.** To create `_site` documentation folder run build script
```
build.cmd
```
**Step 2.** To browse `_site` documentation folder run serve script
```
serve.cmd
```
And you can view the generated website in your browser `http://localhost:8080`.

3
docs/build.cmd Normal file
Просмотреть файл

@ -0,0 +1,3 @@
@echo off
docfx metadata
docfx build

35
docs/docfx.json Normal file
Просмотреть файл

@ -0,0 +1,35 @@
{
"metadata": [
{
"src": [
{
"files": [
"/src/WavFile/WavFile.csproj"
],
"exclude": [ "**/bin/**", "**/obj/**" ],
"cwd": ".."
}
],
"dest": "api"
},
],
"build": {
"content":
[
{
"files": ["**/*.yml", "index.md", "tutorial/*.md"],
}
],
"resource": [
{
"files": ["images/**"]
}
],
"overwrite": "apidoc/*.md",
"globalMetadata": {
"_appTitle": "SimpleWavSplitter Website"
},
"dest": "_site",
"template": [ "default", "template"]
}
}

3
docs/index.md Normal file
Просмотреть файл

@ -0,0 +1,3 @@
# SimpleWavSplitter Documentation Site
Welcome to the SimpleWavSplitter documentation site.

2
docs/serve.cmd Normal file
Просмотреть файл

@ -0,0 +1,2 @@
@echo off
docfx serve _site

13
docs/template/partials/footer.tmpl.partial поставляемый Normal file
Просмотреть файл

@ -0,0 +1,13 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
<span>Copyright © 2016 Wiesław Šoltés<br>Generated by <strong>DocFX</strong></span>
</div>
</div>
</footer>

4
docs/toc.yml Normal file
Просмотреть файл

@ -0,0 +1,4 @@
- name: Home
href: index.md
- name: API Reference
href: api/