Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
254 changes: 109 additions & 145 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,17 @@ Action<string> SourceLink = (solutionFileName) =>
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(() =>
Setup(context =>
{
if (!isRunningOnWindows)
{
throw new NotImplementedException("ReactiveUI will only build on Windows (w/Xamarin installed) because it's not possible to target UWP, WPF and Windows Forms from UNIX.");
}

Information("Building version {0} of ReactiveUI.", semVersion);
});

Teardown(() =>
Teardown(context =>
{
// Executed AFTER the last task.
});
Expand All @@ -136,127 +141,104 @@ Task("BuildEventBuilder")
.IsDependentOn("UpdateAssemblyInfo")
.Does (() =>
{
var solution = "./src/EventBuilder.sln";

if(isRunningOnUnix)
{
throw new NotImplementedException("Building events on OSX is not implemented yet.");
// run mdtool
}
else
{
var solution = "./src/EventBuilder.sln";
MSBuild(solution, new MSBuildSettings()
.SetConfiguration(configuration)
.WithProperty("TreatWarningsAsErrors", treatWarningsAsErrors.ToString())
.SetVerbosity(Verbosity.Minimal)
.SetNodeReuse(false));

MSBuild(solution, new MSBuildSettings()
.SetConfiguration(configuration)
.WithProperty("TreatWarningsAsErrors", treatWarningsAsErrors.ToString())
.SetVerbosity(Verbosity.Minimal)
.SetNodeReuse(false));

SourceLink(solution);
}
SourceLink(solution);
});

Task("GenerateEvents")
.IsDependentOn("BuildEventBuilder")
.Does (() =>
{
if(isRunningOnUnix)
{
throw new NotImplementedException("Building events on OSX is not implemented yet.");
}
else
{
var eventBuilder = "./src/EventBuilder/bin/Release/EventBuilder.exe";
var workingDirectory = "./src/EventBuilder/bin/Release";
var eventBuilder = "./src/EventBuilder/bin/Release/EventBuilder.exe";
var workingDirectory = "./src/EventBuilder/bin/Release";

Action<string> generate = (string platform) =>
Action<string> generate = (string platform) =>
{
using(var process = StartAndReturnProcess(eventBuilder,
new ProcessSettings{
Arguments = "--platform=" + platform,
WorkingDirectory = workingDirectory,
RedirectStandardOutput = true }))
{
using(var process = StartAndReturnProcess(eventBuilder,
new ProcessSettings{
Arguments = "--platform=" + platform,
WorkingDirectory = workingDirectory,
RedirectStandardOutput = true }))
{
// super important to ensure that the platform is always
// uppercase so that the events are written to the write
// filename as UNIX is case-sensitive - even though OSX
// isn't by default.
platform = platform.ToUpper();
// super important to ensure that the platform is always
// uppercase so that the events are written to the write
// filename as UNIX is case-sensitive - even though OSX
// isn't by default.
platform = platform.ToUpper();

Information("Generating events for '{0}'", platform);
Information("Generating events for '{0}'", platform);

int timeout = 10 * 60 * 1000; // x Minute, y Second, z Millisecond
process.WaitForExit(timeout);
int timeout = 10 * 60 * 1000; // x Minute, y Second, z Millisecond
process.WaitForExit(timeout);

var stdout = process.GetStandardOutput();
var stdout = process.GetStandardOutput();

int success = 0; // exit code aka %ERRORLEVEL% or $?
if (process.GetExitCode() != success)
{
Error("Failed to generate events for '{0}'", platform);
Abort();
}
int success = 0; // exit code aka %ERRORLEVEL% or $?
if (process.GetExitCode() != success)
{
Error("Failed to generate events for '{0}'", platform);
Abort();
}

var directory = "src/ReactiveUI.Events/";
var filename = String.Format("Events_{0}.cs", platform);
var output = System.IO.Path.Combine(directory, filename);
var directory = "src/ReactiveUI.Events/";
var filename = String.Format("Events_{0}.cs", platform);
var output = System.IO.Path.Combine(directory, filename);

FileWriteLines(output, stdout.ToArray());
Information("The events have been written to '{0}'", output);
}
};
FileWriteLines(output, stdout.ToArray());
Information("The events have been written to '{0}'", output);
}
};

generate("android");
generate("ios");
generate("mac");
generate("xamforms");
generate("android");
generate("ios");
generate("mac");
generate("xamforms");

generate("net45");

generate("wpa81");
generate("uwp");
}
generate("net45");

generate("wpa81");
generate("uwp");
});

Task("BuildEvents")
.IsDependentOn("GenerateEvents")
.Does (() =>
{
if(isRunningOnUnix)
{
throw new NotImplementedException("Building events on OSX is not implemented.");
}
else
Action<string> build = (filename) =>
{
Action<string> build = (filename) =>
{
var solution = System.IO.Path.Combine("./src/ReactiveUI.Events/", filename);
var solution = System.IO.Path.Combine("./src/ReactiveUI.Events/", filename);

// UWP (project.json) needs to be restored before it will build.
RestorePackages (solution);
// UWP (project.json) needs to be restored before it will build.
RestorePackages (solution);

Information("Building {0}", solution);
Information("Building {0}", solution);

MSBuild(solution, new MSBuildSettings()
.SetConfiguration(configuration)
.WithProperty("NoWarn", "1591") // ignore missing XML doc warnings
.WithProperty("TreatWarningsAsErrors", treatWarningsAsErrors.ToString())
.SetVerbosity(Verbosity.Minimal)
.SetNodeReuse(false));
MSBuild(solution, new MSBuildSettings()
.SetConfiguration(configuration)
.WithProperty("NoWarn", "1591") // ignore missing XML doc warnings
.WithProperty("TreatWarningsAsErrors", treatWarningsAsErrors.ToString())
.SetVerbosity(Verbosity.Minimal)
.SetNodeReuse(false));

SourceLink(solution);
};
SourceLink(solution);
};

build("ReactiveUI.Events_Android.sln");
build("ReactiveUI.Events_iOS.sln");
build("ReactiveUI.Events_MAC.sln");
build("ReactiveUI.Events_XamForms.sln");
build("ReactiveUI.Events_Android.sln");
build("ReactiveUI.Events_iOS.sln");
build("ReactiveUI.Events_MAC.sln");
build("ReactiveUI.Events_XamForms.sln");

build("ReactiveUI.Events_NET45.sln");
build("ReactiveUI.Events_NET45.sln");

build("ReactiveUI.Events_WPA81.sln");
build("ReactiveUI.Events_UWP.sln");
}
build("ReactiveUI.Events_WPA81.sln");
build("ReactiveUI.Events_UWP.sln");
});

Task("PackageEvents")
Expand All @@ -272,34 +254,27 @@ Task("BuildReactiveUI")
.IsDependentOn("UpdateAssemblyInfo")
.Does (() =>
{
if(isRunningOnUnix)
Action<string> build = (solution) =>
{
throw new NotImplementedException("Building ReactiveUI on OSX is not implemented yet.");
}
else
{
Action<string> build = (solution) =>
{
Information("Building {0}", solution);
Information("Building {0}", solution);

MSBuild(solution, new MSBuildSettings()
.SetConfiguration(configuration)
.WithProperty("NoWarn", "1591") // ignore missing XML doc warnings
.WithProperty("TreatWarningsAsErrors", treatWarningsAsErrors.ToString())
.SetVerbosity(Verbosity.Minimal)
.SetNodeReuse(false));
MSBuild(solution, new MSBuildSettings()
.SetConfiguration(configuration)
.WithProperty("NoWarn", "1591") // ignore missing XML doc warnings
.WithProperty("TreatWarningsAsErrors", treatWarningsAsErrors.ToString())
.SetVerbosity(Verbosity.Minimal)
.SetNodeReuse(false));

SourceLink(solution);
};
SourceLink(solution);
};

build("./src/ReactiveUI.sln");
}
build("./src/ReactiveUI.sln");
});


Task("PackageReactiveUI")
.IsDependentOn("BuildReactiveUI")
// .IsDependentOn("RunUnitTests")
.IsDependentOn("RunUnitTests")
.Does (() =>
{
// use pwd as as cake needs a basePath, even if making a meta-package that contains no files.
Expand Down Expand Up @@ -355,57 +330,46 @@ Task("RunUnitTests")
Task("Package")
.IsDependentOn("PackageEvents")
.IsDependentOn("PackageReactiveUI")
.WithCriteria(() => !isRunningOnUnix)
.Does (() =>
{
if(isRunningOnUnix)
{
throw new NotImplementedException("Packaging on OSX is not implemented yet."); }
else
{

}
});

Task("Publish")
.IsDependentOn("Package")
.WithCriteria(() => !isRunningOnUnix)
.WithCriteria(() => !local)
.WithCriteria(() => !isPullRequest)
.WithCriteria(() => isMainReactiveUIRepo)
.Does (() =>
{
if(isRunningOnUnix)
// Resolve the API key.
var apiKey = EnvironmentVariable("MYGET_API_KEY");
if (string.IsNullOrEmpty(apiKey))
{
throw new NotImplementedException("Packaging on OSX is not implemented yet.");
throw new InvalidOperationException("Could not resolve MyGet API key.");
}
else
{
// Resolve the API key.
var apiKey = EnvironmentVariable("MYGET_API_KEY");
if (string.IsNullOrEmpty(apiKey))
{
throw new InvalidOperationException("Could not resolve MyGet API key.");
}

// only push whitelisted packages.
foreach(var package in new[] { "ReactiveUI-Testing", "ReactiveUI-Events", "ReactiveUI-Events-XamForms", "ReactiveUI", "ReactiveUI-Core", "ReactiveUI-AndroidSupport", "ReactiveUI-Blend", "ReactiveUI-Winforms", "ReactiveUI-XamForms" })
{
// only push the package which was created during this build run.
var packagePath = artifactDirectory + File(string.Concat(package, ".", semVersion, ".nupkg"));
var symbolsPath = artifactDirectory + File(string.Concat(package, ".", semVersion, ".symbols.nupkg"));

// Push the package.
NuGetPush(packagePath, new NuGetPushSettings {
Source = "https://www.myget.org/F/reactiveui/api/v2/package",
ApiKey = apiKey
});

// Push the symbols
NuGetPush(symbolsPath, new NuGetPushSettings {
Source = "https://www.myget.org/F/reactiveui/api/v2/package",
ApiKey = apiKey
});
// only push whitelisted packages.
foreach(var package in new[] { "ReactiveUI-Testing", "ReactiveUI-Events", "ReactiveUI-Events-XamForms", "ReactiveUI", "ReactiveUI-Core", "ReactiveUI-AndroidSupport", "ReactiveUI-Blend", "ReactiveUI-Winforms", "ReactiveUI-XamForms" })
{
// only push the package which was created during this build run.
var packagePath = artifactDirectory + File(string.Concat(package, ".", semVersion, ".nupkg"));
var symbolsPath = artifactDirectory + File(string.Concat(package, ".", semVersion, ".symbols.nupkg"));

// Push the package.
NuGetPush(packagePath, new NuGetPushSettings {
Source = "https://www.myget.org/F/reactiveui/api/v2/package",
ApiKey = apiKey
});

// Push the symbols
NuGetPush(symbolsPath, new NuGetPushSettings {
Source = "https://www.myget.org/F/reactiveui/api/v2/package",
ApiKey = apiKey
});

}
}
});

Expand Down
6 changes: 3 additions & 3 deletions src/ReactiveUI.Tests/WeakEventManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace ReactiveUI.Tests
{
public class WeakEventManagerTest
{
[Fact]
[Fact(Skip = "you can blame @shiftkey")]
public void ButtonDoesNotLeakTest()
{
Button button = new Button();
Expand All @@ -26,7 +26,7 @@ public void ButtonDoesNotLeakTest()
Assert.False(buttonRef.IsAlive);
}

[Fact]
[Fact(Skip="you can blame @shiftkey")]
public void ListBoxDoesNotLeakTest()
{
ListBox listBox = new ListBox();
Expand All @@ -45,7 +45,7 @@ public void ListBoxDoesNotLeakTest()
Assert.False(listBoxRef.IsAlive);
}

[Fact]
[Fact(Skip = "you can blame @shiftkey")]
public void DataContextDoesNotLeakTest()
{
ListBox listBox = new ListBox();
Expand Down