diff --git a/.gitignore b/.gitignore index 286884d..1801a08 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ obj/ .vscode/ *.user +artifacts/ + _ReSharper.Caches/ diff --git a/AspNetCore.AsyncInitialization.sln b/AspNetCore.AsyncInitialization.sln index a0ab680..85c4839 100644 --- a/AspNetCore.AsyncInitialization.sln +++ b/AspNetCore.AsyncInitialization.sln @@ -14,44 +14,31 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{ACEAE2B6-8261-4C7F-968F-35D5221929D6}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore + build.cmd = build.cmd LICENSE.txt = LICENSE.txt README.md = README.md EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{C6A2E948-78A9-4E82-B112-A00F93A94496}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "build", "tools\build\build.csproj", "{191B7D1C-7505-404B-8805-DD8E3EB44785}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {DEC4A732-9A80-4CC9-9775-D3A8CE65F633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DEC4A732-9A80-4CC9-9775-D3A8CE65F633}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DEC4A732-9A80-4CC9-9775-D3A8CE65F633}.Debug|x64.ActiveCfg = Debug|Any CPU - {DEC4A732-9A80-4CC9-9775-D3A8CE65F633}.Debug|x64.Build.0 = Debug|Any CPU - {DEC4A732-9A80-4CC9-9775-D3A8CE65F633}.Debug|x86.ActiveCfg = Debug|Any CPU - {DEC4A732-9A80-4CC9-9775-D3A8CE65F633}.Debug|x86.Build.0 = Debug|Any CPU {DEC4A732-9A80-4CC9-9775-D3A8CE65F633}.Release|Any CPU.ActiveCfg = Release|Any CPU {DEC4A732-9A80-4CC9-9775-D3A8CE65F633}.Release|Any CPU.Build.0 = Release|Any CPU - {DEC4A732-9A80-4CC9-9775-D3A8CE65F633}.Release|x64.ActiveCfg = Release|Any CPU - {DEC4A732-9A80-4CC9-9775-D3A8CE65F633}.Release|x64.Build.0 = Release|Any CPU - {DEC4A732-9A80-4CC9-9775-D3A8CE65F633}.Release|x86.ActiveCfg = Release|Any CPU - {DEC4A732-9A80-4CC9-9775-D3A8CE65F633}.Release|x86.Build.0 = Release|Any CPU {8264807E-AEEC-4A9F-8023-7B30B01F3FD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8264807E-AEEC-4A9F-8023-7B30B01F3FD2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8264807E-AEEC-4A9F-8023-7B30B01F3FD2}.Debug|x64.ActiveCfg = Debug|Any CPU - {8264807E-AEEC-4A9F-8023-7B30B01F3FD2}.Debug|x64.Build.0 = Debug|Any CPU - {8264807E-AEEC-4A9F-8023-7B30B01F3FD2}.Debug|x86.ActiveCfg = Debug|Any CPU - {8264807E-AEEC-4A9F-8023-7B30B01F3FD2}.Debug|x86.Build.0 = Debug|Any CPU {8264807E-AEEC-4A9F-8023-7B30B01F3FD2}.Release|Any CPU.ActiveCfg = Release|Any CPU {8264807E-AEEC-4A9F-8023-7B30B01F3FD2}.Release|Any CPU.Build.0 = Release|Any CPU - {8264807E-AEEC-4A9F-8023-7B30B01F3FD2}.Release|x64.ActiveCfg = Release|Any CPU - {8264807E-AEEC-4A9F-8023-7B30B01F3FD2}.Release|x64.Build.0 = Release|Any CPU - {8264807E-AEEC-4A9F-8023-7B30B01F3FD2}.Release|x86.ActiveCfg = Release|Any CPU - {8264807E-AEEC-4A9F-8023-7B30B01F3FD2}.Release|x86.Build.0 = Release|Any CPU + {191B7D1C-7505-404B-8805-DD8E3EB44785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {191B7D1C-7505-404B-8805-DD8E3EB44785}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -59,6 +46,7 @@ Global GlobalSection(NestedProjects) = preSolution {DEC4A732-9A80-4CC9-9775-D3A8CE65F633} = {F3949869-0B22-4F63-8B97-B3548E7ED0AC} {8264807E-AEEC-4A9F-8023-7B30B01F3FD2} = {81FBB26C-5751-4F6E-8B10-4BD7AC3888FC} + {191B7D1C-7505-404B-8805-DD8E3EB44785} = {C6A2E948-78A9-4E82-B112-A00F93A94496} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2CD1AD1C-0AF7-48E4-A9DE-4D22491B7292} diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..0b3de29 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,17 @@ +version: '{build}' +image: Visual Studio 2017 + +pull_requests: + do_not_increment_build_number: true + +build_script: +- cmd: build.cmd + +on_failure: + - ps: $root = (Resolve-Path artifacts); [IO.Directory]::GetFiles($root.Path, '*.*', 'AllDirectories') | % { Push-AppveyorArtifact $_ -FileName $_.Substring($root.Path.Length + 1) -DeploymentName failed-build } + +nuget: + disable_publish_on_pr: true + +artifacts: +- path: .\artifacts\*\* diff --git a/build.cmd b/build.cmd new file mode 100644 index 0000000..1607a9a --- /dev/null +++ b/build.cmd @@ -0,0 +1 @@ +@dotnet run --project %~dp0\tools\build\build.csproj -- %* diff --git a/tools/build/Build.cs b/tools/build/Build.cs new file mode 100644 index 0000000..b3afcf3 --- /dev/null +++ b/tools/build/Build.cs @@ -0,0 +1,89 @@ +using System.IO; +using System.Runtime.CompilerServices; +using McMaster.Extensions.CommandLineUtils; +using static Bullseye.Targets; +using static SimpleExec.Command; + +namespace build +{ + [Command(ThrowOnUnexpectedArgument = false)] + [SuppressDefaultHelpOption] + class Build + { + static void Main(string[] args) => + CommandLineApplication.Execute(args); + + [Option("-h|-?|--help", "Show help message", CommandOptionType.NoValue)] + public bool ShowHelp { get; } = false; + + [Option("-v|--version", "The version to build", CommandOptionType.SingleValue)] + public string Version { get; } = "0.0.0"; + + [Option("-c|--configuration", "The configuration to build", CommandOptionType.SingleValue)] + public string Configuration { get; } = "Release"; + + public string[] RemainingArguments { get; } = null; + + public void OnExecute(CommandLineApplication app) + { + if (ShowHelp) + { + app.ShowHelp(); + app.Out.WriteLine("Bullseye help:"); + app.Out.WriteLine(); + RunTargets(new[] { "-h" }); + return; + } + + Directory.SetCurrentDirectory(GetSolutionDirectory()); + + string artifactsDir = Path.GetFullPath("artifacts"); + string logsDir = Path.Combine(artifactsDir, "logs"); + string buildLogFile = Path.Combine(logsDir, "build.binlog"); + string packagesDir = Path.Combine(artifactsDir, "packages"); + + string solutionFile = "AspNetCore.AsyncInitialization.sln"; + string libraryProject = "src/AspNetCore.AsyncInitialization/AspNetCore.AsyncInitialization.csproj"; + string testProject = "tests/AspNetCore.AsyncInitialization.Tests/AspNetCore.AsyncInitialization.Tests.csproj"; + + Target( + "artifactDirectories", + () => + { + Directory.CreateDirectory(artifactsDir); + Directory.CreateDirectory(logsDir); + Directory.CreateDirectory(packagesDir); + }); + + Target( + "build", + DependsOn("artifactDirectories"), + () => Run( + "dotnet", + $"build -c \"{Configuration}\" /p:Version=\"{Version}\" /bl:\"{buildLogFile}\" \"{solutionFile}\"")); + + Target( + "test", + DependsOn("build"), + () => Run( + "dotnet", + $"test -c \"{Configuration}\" --no-build \"{testProject}\"")); + + Target( + "pack", + DependsOn("artifactDirectories", "build"), + () => Run( + "dotnet", + $"pack -c \"{Configuration}\" --no-build /p:Version=\"{Version}\" -o \"{packagesDir}\" \"{libraryProject}\"")); + + Target("default", DependsOn("test", "pack")); + + RunTargets(RemainingArguments); + } + + private static string GetSolutionDirectory() => + Path.GetFullPath(Path.Combine(GetScriptDirectory(), @"..\..")); + + private static string GetScriptDirectory([CallerFilePath] string filename = null) => Path.GetDirectoryName(filename); + } +} \ No newline at end of file diff --git a/tools/build/build.csproj b/tools/build/build.csproj new file mode 100644 index 0000000..97a06d2 --- /dev/null +++ b/tools/build/build.csproj @@ -0,0 +1,14 @@ + + + + Exe + netcoreapp2.1 + + + + + + + + +