diff --git a/appveyor.yml b/appveyor.yml index 4ed17da..d8e803d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,12 +1,77 @@ -init: - - git config --global core.autocrlf true -version: 1.0.{build} -image: Visual Studio 2017 -test: on -pull_requests: - do_not_increment_build_number: true -branches: - only: - - dev -build_script: -- ps: .\build.ps1 + + +# master branch +- + branches: + only: + - master + + init: + - git config --global core.autocrlf true + + image: Visual Studio 2017 + + version: "{build}" + + build_script: + - ps: .\build.ps1 + + test: off + + artifacts: + - path: artifacts\output\*.nupkg + name: packages + - path: artifacts\logs + - path: artifacts\tests + +# dev branch +- + branches: + only: + - dev + + init: + - git config --global core.autocrlf true + + image: Visual Studio 2017 + + version: "{build}" + + build_script: + - SET VERSION_SUFFIX=-%APPVEYOR_REPO_BRANCH%%APPVEYOR_BUILD_NUMBER% + - ps: .\build.ps1 + + test: off + + artifacts: + - path: artifacts\output\*.nupkg + name: packages + - path: artifacts\logs + - path: artifacts\tests + + deploy: + - provider: NuGet + server: https://www.myget.org/F/0b0e5c5f92fe4ccbba32eec8c0bb4c22/ + api_key: + secure: UAYBSvPmTiXAgAzxVTG1XcQKqD6gkGVT5Y7zpVycpw86vd7U+G1e47ufZVLEDobt + artifact: packages + +# all other branches +- + init: + - git config --global core.autocrlf true + + image: Visual Studio 2017 + + version: "{build}" + + build_script: + - SET VERSION_SUFFIX=-%APPVEYOR_REPO_BRANCH%%APPVEYOR_BUILD_NUMBER% + - ps: .\build.ps1 + + test: off + + artifacts: + - path: artifacts\output\*.nupkg + - path: artifacts\logs + - path: artifacts\tests diff --git a/build.cake b/build.cake index 1dc2d31..ced187f 100644 --- a/build.cake +++ b/build.cake @@ -1,3 +1,5 @@ +using System.Text.RegularExpressions; + #tool nuget:?package=NUnit.ConsoleRunner&version=3.4.0 ////////////////////////////////////////////////////////////////////// // ARGUMENTS @@ -7,64 +9,89 @@ var target = Argument("target", "Default"); var configuration = Argument("configuration", "Release"); var solution = "./Anywhere.ArcGIS.sln"; +var version = "1.0.0"; +var versionSuffix = Environment.GetEnvironmentVariable("VERSION_SUFFIX"); + ////////////////////////////////////////////////////////////////////// // PREPARATION ////////////////////////////////////////////////////////////////////// // Define directories. var buildDir = Directory("./src/Anywhere.ArcGIS/bin") + Directory(configuration); +var artifactDir = Directory("./artifacts"); +var outputDir = artifactDir + Directory("output"); ////////////////////////////////////////////////////////////////////// // TASKS ////////////////////////////////////////////////////////////////////// +Task("Build") + .IsDependentOn("Update-Version") + .Does(() => + { + DotNetCoreBuild( + solution, + new DotNetCoreBuildSettings + { + Configuration = configuration, + ArgumentCustomization = args => args.Append($"/p:CI=true /v:n"), + OutputDirectory = outputDir + }); + }); + + Task("Clean") .Does(() => { CleanDirectory(buildDir); + CleanDirectory(artifactDir); }); Task("Restore") .IsDependentOn("Clean") .Does(() => -{ - DotNetCoreRestore(solution); -}); + { + DotNetCoreRestore(solution); + }); -Task("Build") - .IsDependentOn("Restore") +Task("Test") + .IsDependentOn("Build") .Does(() => -{ - DotNetCoreBuild( - solution, - new DotNetCoreBuildSettings + { + var projects = GetFiles("./tests/**/*.csproj"); + foreach(var project in projects) { - Configuration = configuration, - ArgumentCustomization = args => args.Append($"/p:CI=true /v:n") - }); -}); + DotNetCoreTool( + projectPath: project.FullPath, + command: "xunit", + arguments: $"-configuration {configuration} -diagnostics -stoponfail" + ); + } + }); -Task("Test") - .IsDependentOn("Build") +Task("Update-Version") + .IsDependentOn("Restore") .Does(() => -{ - var projects = GetFiles("./tests/**/*.csproj"); - foreach(var project in projects) { - DotNetCoreTool( - projectPath: project.FullPath, - command: "xunit", - arguments: $"-configuration {configuration} -diagnostics -stoponfail" - ); - } -}); + Information("Setting version to " + version + versionSuffix); + + var file = GetFiles("./src/Anywhere.ArcGIS/Anywhere.ArcGIS.csproj").First(); + + var project = System.IO.File.ReadAllText(file.FullPath, Encoding.UTF8); + + var projectVersion = new Regex(@".+<\/Version>"); + + project = projectVersion.Replace(project, string.Concat("", version + versionSuffix, "")); + + System.IO.File.WriteAllText(file.FullPath, project, Encoding.UTF8); + }); ////////////////////////////////////////////////////////////////////// // TASK TARGETS ////////////////////////////////////////////////////////////////////// Task("Default") - .IsDependentOn("Test"); + .IsDependentOn("Build"); ////////////////////////////////////////////////////////////////////// // EXECUTION diff --git a/src/Anywhere.ArcGIS/Anywhere.ArcGIS.csproj b/src/Anywhere.ArcGIS/Anywhere.ArcGIS.csproj index 02c2ed5..772b96e 100644 --- a/src/Anywhere.ArcGIS/Anywhere.ArcGIS.csproj +++ b/src/Anywhere.ArcGIS/Anywhere.ArcGIS.csproj @@ -1,11 +1,13 @@ - + netstandard2.0 true Dave Timmins Dave Timmins + Anywhere.ArcGIS Operations and data types used with the ArcGIS Server REST API. + Operations and data types used with the ArcGIS Server REST API. Copyright Dave Timmins (c) 2017. All rights reserved. https://raw.githubusercontent.com/davetimmins/Anywhere.ArcGIS/master/LICENSE https://github.com/davetimmins/Anywhere.ArcGIS @@ -14,7 +16,7 @@ git ArcGIS ArcGISServer ArcGISOnline Esri REST netstandard anywhere GIS Mapping Map Location GeoLocation OAuth Initial port of ArcGIS.PCL to netstandard - 1.0.0-beta.4 + 1.0.0