Skip to content

Commit

Permalink
Added cake.build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Redth committed Aug 19, 2015
1 parent e3e3573 commit eae852e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
bin/
obj/
packages/
nupkg/
*.userprefs
.nugetapikey
6 changes: 3 additions & 3 deletions Cake.Xamarin.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
<tags>Cake Script Build Xamarin</tags>

<dependencies>
<dependency id="Cake.Core" />
<dependency id="Cake.Core" version="0.5.2" />
</dependencies>
</metadata>

<files>
<file src="Cake.Xamarin\bin\Release\Cake.Xamarin.dll" target="lib/net45" />
<file src="Cake.Xamarin\bin\Release\Cake.Xamarin.xml" target="lib/net45" />
<file src="./Cake.Xamarin/bin/Release/Cake.Xamarin.dll" target="lib/net45" />
<file src="./Cake.Xamarin/bin/Release/Cake.Xamarin.xml" target="lib/net45" />
</files>
</package>
46 changes: 46 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
var sln = "./Cake.Xamarin.sln";
var nuspec = "./Cake.Xamarin.nuspec";

var target = Argument ("target", "lib");

Task ("lib").Does (() =>
{
NuGetRestore (sln);

DotNetBuild (sln, c => c.Configuration = "Release");
});

Task ("nuget").IsDependentOn ("lib").Does (() =>
{
CreateDirectory ("./nupkg/");

NuGetPack (nuspec, new NuGetPackSettings {
Verbosity = NuGetVerbosity.Detailed,
OutputDirectory = "./nupkg/",
// NuGet messes up path on mac, so let's add ./ in front again
BasePath = "././",
});
});

Task ("push").IsDependentOn ("nuget").Does (() =>
{
// Get the newest (by last write time) to publish
var newestNupkg = GetFiles ("nupkg/*.nupkg")
.OrderBy (f => new System.IO.FileInfo (f.FullPath).LastWriteTimeUtc)
.LastOrDefault ();

var apiKey = TransformTextFile ("./.nugetapikey").ToString ();

NuGetPush (newestNupkg, new NuGetPushSettings {
Verbosity = NuGetVerbosity.Detailed,
ApiKey = apiKey
});
});

Task ("clean").Does (() =>
{
CleanDirectories ("./**/bin");
CleanDirectories ("./**/obj");
});

RunTarget (target);

0 comments on commit eae852e

Please sign in to comment.