Skip to content
Browse files

copying whole bounce directory, for when bounce.framework.dll changes…

…. Added full path to msbuild and nunit-console
  • Loading branch information...
1 parent d25193d commit 9e9c9dc44f5f8086f5746640bab2ec546710b256 @refractalize committed Oct 6, 2010
View
1 Bounce.Console/Bounce.Console.csproj
@@ -47,6 +47,7 @@
<ItemGroup>
<Compile Include="BounceAssemblyRunner.cs" />
<Compile Include="BounceConsoleException.cs" />
+ <Compile Include="BounceDirectoryCopier.cs" />
<Compile Include="ITargetsAssemblyFinder.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
View
19 Bounce.Console/BounceAssemblyRunner.cs
@@ -1,10 +1,15 @@
using System;
-using System.IO;
using System.Linq;
using System.Reflection;
namespace Bounce.Console {
class BounceAssemblyRunner {
+ private readonly BounceDirectoryCopier BounceDirectoryCopier;
+
+ public BounceAssemblyRunner() {
+ BounceDirectoryCopier = new BounceDirectoryCopier();
+ }
+
public void Run(string [] args) {
try {
FindTargetsAssemblyAndRunBounce(args);
@@ -16,7 +21,7 @@ class BounceAssemblyRunner {
private void FindTargetsAssemblyAndRunBounce(string[] args) {
TargetsAssemblyAndArguments assemblyAndArguments = GetAssemblyFileName(args);
- string assemblyFileName = CopyTargetsAssembly(assemblyAndArguments.TargetsAssembly);
+ string assemblyFileName = BounceDirectoryCopier.CopyBounceDirectory(assemblyAndArguments.TargetsAssembly);
args = assemblyAndArguments.RemainingArguments;
Assembly a = Assembly.LoadFrom(assemblyFileName);
@@ -25,16 +30,6 @@ class BounceAssemblyRunner {
RunAssembly(bounceAssemblyAndTargetsProperty, args);
}
- private string CopyTargetsAssembly(string targetsAssembly) {
- var tempFileName = Path.Combine(Path.GetDirectoryName(targetsAssembly),
- Path.GetFileNameWithoutExtension(targetsAssembly) + ".tmp" +
- Path.GetExtension(targetsAssembly));
-
- File.Copy(targetsAssembly, tempFileName, true);
-
- return tempFileName;
- }
-
private TargetsAssemblyAndArguments GetAssemblyFileName(string[] args) {
return new TargetsAssemblyArgumentsParser().GetTargetsAssembly(args);
}
View
26 Bounce.Console/BounceDirectoryCopier.cs
@@ -0,0 +1,26 @@
+using System.IO;
+
+namespace Bounce.Console {
+ class BounceDirectoryCopier {
+ public string CopyBounceDirectory(string targetsAssembly) {
+ var bounceDirectory = Path.GetDirectoryName(targetsAssembly);
+ var tempBounceDir = Path.Combine(Path.GetDirectoryName(bounceDirectory), bounceDirectory + ".tmp");
+
+ if (Directory.Exists(tempBounceDir)) {
+ Directory.Delete(tempBounceDir, true);
+ }
+
+ Directory.CreateDirectory(tempBounceDir);
+
+ CopyDirectory(bounceDirectory, tempBounceDir);
+
+ return Path.Combine(tempBounceDir, Path.GetFileName(targetsAssembly));
+ }
+
+ private void CopyDirectory(string fromDirectory, string toDirectory) {
+ foreach (var file in Directory.GetFiles(fromDirectory)) {
+ File.Copy(file, Path.Combine(toDirectory, Path.GetFileName(file)));
+ }
+ }
+ }
+}
View
8 Bounce.Framework/NUnitTests.cs
@@ -6,13 +6,19 @@ namespace Bounce.Framework {
public class NUnitTests : Task {
[Dependency]
public IEnumerable<Val<string>> DllPaths;
+ [Dependency]
+ public Val<string> NUnitConsolePath;
+
+ public NUnitTests() {
+ NUnitConsolePath = @"c:\Program Files (x86)\NUnit\nunit-console.exe";
+ }
public override void Build(IBounce bounce) {
IEnumerable<string> testDlls = DllPaths.Select(dll => dll.Value).Where(dll => dll.EndsWith("Tests.dll"));
foreach (var dllPath in testDlls) {
bounce.Log.Info("running unit tests for: " + dllPath);
- new ShellCommandExecutor().ExecuteAndExpectSuccess("nunit-console", String.Format(@"""{0}""", dllPath));
+ new ShellCommandExecutor().ExecuteAndExpectSuccess(NUnitConsolePath.Value, String.Format(@"""{0}""", dllPath));
}
}
}
View
5 Bounce.Framework/VisualStudioSolution.cs
@@ -9,11 +9,14 @@ public class VisualStudioSolution : Task {
public Val<string> SolutionPath;
[Dependency]
public Val<string> Configuration;
+ [Dependency]
+ public Val<string> MsBuildExe;
private readonly IShellCommandExecutor ShellCommandExecutor;
public VisualStudioSolution() {
ShellCommandExecutor = new ShellCommandExecutor();
+ MsBuildExe = @"C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe";
}
public VisualStudioSolutionProjects Projects {
@@ -25,7 +28,7 @@ public class VisualStudioSolution : Task {
public override void Build(IBounce bounce) {
bounce.Log.Info("building solution at: " + SolutionPath.Value);
- ShellCommandExecutor.ExecuteAndExpectSuccess("msbuild.exe", String.Format(@"""{0}""", SolutionPath.Value));
+ ShellCommandExecutor.ExecuteAndExpectSuccess(MsBuildExe.Value, String.Format(@"""{0}""", SolutionPath.Value));
}
internal VisualStudioSolutionDetails SolutionDetails {

0 comments on commit 9e9c9dc

Please sign in to comment.
Something went wrong with that request. Please try again.