Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
Update cake build
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmontemagno committed Sep 22, 2017
1 parent abe8f97 commit 07e379b
Show file tree
Hide file tree
Showing 6 changed files with 304 additions and 160 deletions.
5 changes: 3 additions & 2 deletions appveyor.yml
@@ -1,5 +1,6 @@
version: 3.0.3-beta{build}
version: 4.0.0-beta{build}
image: Visual Studio 2017
configuration: Release
assembly_info:
patch: true
file: '**\AssemblyInfo.*'
Expand All @@ -14,7 +15,7 @@ install:
- echo y | "C:\Program Files (x86)\Android\android-sdk\tools\android.bat" update sdk -u -a -t android-15
build_script:
- cmd: >-
powershell .\bootstrapper.ps1 -Target Default -Verbosity diagnostic
powershell .\build.ps1 -Target Default -Verbosity diagnostic
artifacts:
- path: ./Build/nuget/*.nupkg
name: NuGet
95 changes: 0 additions & 95 deletions bootstrapper.ps1

This file was deleted.

72 changes: 10 additions & 62 deletions build.cake
@@ -1,62 +1,17 @@
#addin "Cake.FileHelpers"

var TARGET = Argument ("target", Argument ("t", "Default"));
var version = EnvironmentVariable ("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999");

var libraries = new Dictionary<string, string> {
{ "./src/Connectivity.sln", "Any" },
};


var BuildAction = new Action<Dictionary<string, string>> (solutions =>
{
foreach (var sln in solutions)
{
// If the platform is Any build regardless
// If the platform is Win and we are running on windows build
// If the platform is Mac and we are running on Mac, build
if ((sln.Value == "Any")
|| (sln.Value == "Win" && IsRunningOnWindows ())
|| (sln.Value == "Mac" && IsRunningOnUnix ()))
{
// Bit of a hack to use nuget3 to restore packages for project.json
if (IsRunningOnWindows ())
{
Information ("RunningOn: {0}", "Windows");
NuGetRestore (sln.Key, new NuGetRestoreSettings
{
ToolPath = "./tools/nuget3.exe"
});
// Windows Phone / Universal projects require not using the amd64 msbuild
MSBuild (sln.Key, c =>
{
c.Configuration = "Release";
c.MSBuildPlatform = Cake.Common.Tools.MSBuild.MSBuildPlatform.x86;
});
}
else
{
// Mac is easy ;)
NuGetRestore (sln.Key);
DotNetBuild (sln.Key, c => c.Configuration = "Release");
}
}
}
});
var VERSION = EnvironmentVariable ("APPVEYOR_BUILD_VERSION") ?? Argument("version", "0.0.9999");
var CONFIG = Argument("configuration", EnvironmentVariable ("CONFIGURATION") ?? "Release");
var SLN = "./src/Connectivity.sln";

Task("Libraries").Does(()=>
{
BuildAction(libraries);
NuGetRestore (SLN);
MSBuild (SLN, c => {
c.Configuration = CONFIG;
c.MSBuildPlatform = Cake.Common.Tools.MSBuild.MSBuildPlatform.x86;
});
});


Task ("NuGet")
.IsDependentOn ("Libraries")
.Does (() =>
Expand All @@ -65,28 +20,21 @@ Task ("NuGet")
CreateDirectory("./Build/nuget");
NuGetPack ("./nuget/Plugin.nuspec", new NuGetPackSettings {
Version = version,
Verbosity = NuGetVerbosity.Detailed,
Version = VERSION,
OutputDirectory = "./Build/nuget/",
BasePath = "./",
ToolPath = "./tools/nuget3.exe"
BasePath = "./"
});
});


//Build the component, which build samples, nugets, and libraries
Task ("Default").IsDependentOn("NuGet");


Task ("Clean").Does (() =>
{
CleanDirectory ("./component/tools/");
CleanDirectories ("./Build/");
CleanDirectories ("./**/bin");
CleanDirectories ("./**/obj");
});


RunTarget (TARGET);

0 comments on commit 07e379b

Please sign in to comment.