Skip to content

Commit

Permalink
Update build for 3.0.100-preview3-010431
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Mar 7, 2019
1 parent 322cb4c commit 72e5f26
Show file tree
Hide file tree
Showing 12 changed files with 318 additions and 175 deletions.
43 changes: 23 additions & 20 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
# http://www.appveyor.com/docs/appveyor-yml

# configuration for develop/CI and master/Release branch
-
branches:
only:
- dev
- master

skip_tags: true
image: Visual Studio 2017
test: off
branches:
only:
- dev
- master

# Install dotnet core 3.0 latest (alpha!!), as this is not provided on AppVeyor yet
install:
- ps: Start-FileDownload 'https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-win-x64.exe'
- ps: Start-Process .\dotnet-sdk-latest-win-x64.exe "/install /norestart /quiet /log sdkinstall.log" -NoNewWindow -Wait
skip_tags: true
image: Visual Studio 2019 Preview
configuration: Release
test: off

pull_requests:
do_not_increment_build_number: false
# Install dotnet core 3.0 latest (alpha!!), as this is not provided on AppVeyor yet
install:
#- ps: Start-FileDownload 'https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-win-x64.exe'
#- ps: Start-Process .\dotnet-sdk-latest-win-x64.exe "/install /norestart /quiet /log sdkinstall.log" -NoNewWindow -Wait
- ps: Start-FileDownload 'https://download.visualstudio.microsoft.com/download/pr/31b5b67f-b787-4f73-a728-5ec61f10a4de/be6430bcd9a62f610cd9f12f8cc2c736/dotnet-sdk-3.0.100-preview3-010431-win-x64.exe'
- ps: Start-Process .\dotnet-sdk-3.0.100-preview3-010431-win-x64.exe "/install /norestart /quiet /log sdkinstall.log" -NoNewWindow -Wait

build_script:
- ps: .\build.ps1 -target appveyor
pull_requests:
do_not_increment_build_number: false

artifacts:
- path: \Publish\*.*
build_script:
- ps: .\build.ps1 -target appveyor

nuget:
disable_publish_on_pr: true
artifacts:
- path: \Publish\*.*

nuget:
disable_publish_on_pr: true
149 changes: 95 additions & 54 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -13,50 +13,39 @@
//////////////////////////////////////////////////////////////////////

var target = Argument("target", "Default");
if (string.IsNullOrWhiteSpace(target))
{
target = "Default";
}

var configuration = Argument("configuration", "Release");
if (string.IsNullOrWhiteSpace(configuration))
{
configuration = "Release";
}

var verbosity = Argument("verbosity", Verbosity.Normal);
if (string.IsNullOrWhiteSpace(configuration))
{
verbosity = Verbosity.Normal;
}
var verbosity = Argument("verbosity", Verbosity.Minimal);
var dotnetcoreverbosity = Argument("dotnetcoreverbosity", DotNetCoreVerbosity.Minimal);

//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////

var repoName = "gong-wpf-dragdrop";
var local = BuildSystem.IsLocalBuild;
var isLocal = BuildSystem.IsLocalBuild;

// Set build version
if (local == false
|| verbosity == Verbosity.Verbose)
if (isLocal == false || verbosity == Verbosity.Verbose)
{
GitVersion(new GitVersionSettings { OutputType = GitVersionOutput.BuildServer });
}
GitVersion gitVersion = GitVersion(new GitVersionSettings { OutputType = GitVersionOutput.Json });

var latestInstallationPath = VSWhereLatest();
var msBuildPath = latestInstallationPath.CombineWithFilePath("./MSBuild/15.0/Bin/MSBuild.exe");
var latestInstallationPath = VSWhereLatest(new VSWhereLatestSettings { IncludePrerelease = true });
var msBuildPath = latestInstallationPath.Combine("./MSBuild/Current/Bin");
var msBuildPathExe = msBuildPath.CombineWithFilePath("./MSBuild.exe");

if (FileExists(msBuildPathExe) == false)
{
throw new NotImplementedException("You need at least Visual Studio 2019 to build this project.");
}

var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest;
var branchName = gitVersion.BranchName;
var isDevelopBranch = StringComparer.OrdinalIgnoreCase.Equals("dev", branchName);
var isReleaseBranch = StringComparer.OrdinalIgnoreCase.Equals("master", branchName);
var isTagged = AppVeyor.Environment.Repository.Tag.IsTag;

// Version
var nugetVersion = isReleaseBranch ? gitVersion.MajorMinorPatch : gitVersion.NuGetVersion;

// Directories and Paths
var solution = "./src/GongSolutions.WPF.DragDrop.sln";
var publishDir = "./Publish";
Expand All @@ -70,6 +59,8 @@ Action Abort = () => { throw new Exception("a non-recoverable fatal error occurr

Setup(context =>
{
// Executed BEFORE the first task.
if (!IsRunningOnWindows())
{
throw new NotImplementedException($"{repoName} will only build on Windows because it's not possible to target WPF and Windows Forms from UNIX.");
Expand All @@ -82,7 +73,7 @@ Setup(context =>
Information("AssemblySemVer Version : {0}", gitVersion.AssemblySemVer);
Information("MajorMinorPatch Version: {0}", gitVersion.MajorMinorPatch);
Information("NuGet Version : {0}", gitVersion.NuGetVersion);
Information("IsLocalBuild : {0}", local);
Information("IsLocalBuild : {0}", isLocal);
Information("Branch : {0}", branchName);
Information("Configuration : {0}", configuration);
Information("MSBuildPath : {0}", msBuildPath);
Expand All @@ -101,37 +92,34 @@ Task("Clean")
.ContinueOnError()
.Does(() =>
{
var directoriesToDelete = GetDirectories("./**/obj").Concat(GetDirectories("./**/bin")).Concat(GetDirectories("./**/Publish"));
var directoriesToDelete = GetDirectories("./**/obj")
.Concat(GetDirectories("./**/bin"))
.Concat(GetDirectories("./**/Publish"));
DeleteDirectories(directoriesToDelete, new DeleteDirectorySettings { Recursive = true, Force = true });
});

Task("Restore")
.Does(() =>
{
//PaketRestore();
var msBuildSettings = new MSBuildSettings {
Verbosity = Verbosity.Minimal,
ToolVersion = MSBuildToolVersion.VS2017,
Configuration = configuration,
// Restore = true, // only with cake 0.28.x
ArgumentCustomization = args => args.Append("/m")
Verbosity = verbosity
, ToolPath = msBuildPathExe
, Configuration = configuration
, ArgumentCustomization = args => args.Append("/m")
};
MSBuild(solution, msBuildSettings.WithTarget("restore"));
});

Task("Build")
.Does(() =>
{
var msBuildSettings = new MSBuildSettings {
Verbosity = Verbosity.Normal,
ToolVersion = MSBuildToolVersion.VS2017,
Configuration = configuration,
// Restore = true, // only with cake 0.28.x
ArgumentCustomization = args => args.Append("/m")
Verbosity = verbosity
, ToolPath = msBuildPathExe
, Configuration = configuration
, ArgumentCustomization = args => args.Append("/m")
, BinaryLogger = new MSBuildBinaryLogSettings() { Enabled = isLocal }
};
MSBuild(solution, msBuildSettings
.SetMaxCpuCount(0)
.WithProperty("Version", isReleaseBranch ? gitVersion.MajorMinorPatch : gitVersion.NuGetVersion)
Expand All @@ -141,17 +129,35 @@ Task("Build")
);
});

Task("dotnetBuild")
.Does(() =>
{
var buildSettings = new DotNetCoreBuildSettings {
Verbosity = dotnetcoreverbosity,
Configuration = configuration,
ArgumentCustomization = args => args.Append("/m"),
MSBuildSettings = new DotNetCoreMSBuildSettings()
.SetMaxCpuCount(0)
.SetConfiguration(configuration)
.WithProperty("Version", isReleaseBranch ? gitVersion.MajorMinorPatch : gitVersion.NuGetVersion)
.WithProperty("AssemblyVersion", gitVersion.AssemblySemVer)
.WithProperty("FileVersion", gitVersion.AssemblySemFileVer)
.WithProperty("InformationalVersion", gitVersion.InformationalVersion)
};
DotNetCoreBuild(solution, buildSettings);
});

Task("Pack")
.WithCriteria(() => !isPullRequest)
.Does(() =>
{
EnsureDirectoryExists(Directory(publishDir));
var msBuildSettings = new MSBuildSettings {
Verbosity = Verbosity.Normal,
ToolVersion = MSBuildToolVersion.VS2017,
Configuration = configuration
// PlatformTarget = PlatformTarget.MSIL
Verbosity = verbosity
, ToolPath = msBuildPathExe
, Configuration = configuration
};
var projects = GetFiles("./src/GongSolutions.WPF.DragDrop/*.csproj");
Expand All @@ -162,19 +168,52 @@ Task("Pack")
DeleteFiles(GetFiles("./src/**/*.nuspec"));
MSBuild(project, msBuildSettings
.WithTarget("pack")
.WithProperty("PackageOutputPath", MakeAbsolute(Directory(publishDir)).FullPath)
.WithProperty("RepositoryBranch", branchName)
.WithProperty("RepositoryCommit", gitVersion.Sha)
.WithProperty("Version", isReleaseBranch ? gitVersion.MajorMinorPatch : gitVersion.NuGetVersion)
.WithProperty("AssemblyVersion", gitVersion.AssemblySemVer)
.WithProperty("FileVersion", gitVersion.AssemblySemFileVer)
.WithProperty("InformationalVersion", gitVersion.InformationalVersion)
.WithTarget("pack")
.WithProperty("PackageOutputPath", MakeAbsolute(Directory(publishDir)).FullPath)
.WithProperty("RepositoryBranch", branchName)
.WithProperty("RepositoryCommit", gitVersion.Sha)
.WithProperty("Version", isReleaseBranch ? gitVersion.MajorMinorPatch : gitVersion.NuGetVersion)
.WithProperty("AssemblyVersion", gitVersion.AssemblySemVer)
.WithProperty("FileVersion", gitVersion.AssemblySemFileVer)
.WithProperty("InformationalVersion", gitVersion.InformationalVersion)
);
}
});

Task("dotnetPack")
.WithCriteria(() => !isPullRequest)
.Does(() =>
{
EnsureDirectoryExists(Directory(publishDir));
var buildSettings = new DotNetCorePackSettings {
Verbosity = dotnetcoreverbosity,
Configuration = configuration,
MSBuildSettings = new DotNetCoreMSBuildSettings()
.SetMaxCpuCount(0)
.SetConfiguration(configuration)
.WithProperty("PackageOutputPath", MakeAbsolute(Directory(publishDir)).FullPath)
.WithProperty("RepositoryBranch", branchName)
.WithProperty("RepositoryCommit", gitVersion.Sha)
.WithProperty("Version", isReleaseBranch ? gitVersion.MajorMinorPatch : gitVersion.NuGetVersion)
.WithProperty("AssemblyVersion", gitVersion.AssemblySemVer)
.WithProperty("FileVersion", gitVersion.AssemblySemFileVer)
.WithProperty("InformationalVersion", gitVersion.InformationalVersion)
};
var projects = GetFiles("./src/GongSolutions.WPF.DragDrop/*.csproj");
foreach(var project in projects)
{
Information("Packing {0}", project);
DeleteFiles(GetFiles("./src/**/*.nuspec"));
DotNetCorePack(project.ToString(), buildSettings);
}
});

Task("Zip")
.Does(() =>
{
Expand Down Expand Up @@ -210,14 +249,16 @@ Task("CreateRelease")
// Task Targets
Task("Default")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("Build")
// .IsDependentOn("Restore")
// .IsDependentOn("Build")
.IsDependentOn("dotnetBuild")
.IsDependentOn("Zip")
;

Task("appveyor")
.IsDependentOn("Default")
.IsDependentOn("Pack");
// .IsDependentOn("Pack");
.IsDependentOn("dotnetPack");

// Execution
RunTarget(target);
Loading

0 comments on commit 72e5f26

Please sign in to comment.