build.cake 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //////////////////////////////////////////////////////////////////////
  2. // ARGUMENTS
  3. //////////////////////////////////////////////////////////////////////
  4. var target = Argument("target", "Default");
  5. var paths = new {
  6. src = MakeAbsolute(Directory("./../src")).FullPath,
  7. solution = MakeAbsolute(File("./../src/Abc.Zebus.sln")).FullPath,
  8. nugetOutput = MakeAbsolute(Directory("./../output")).FullPath,
  9. };
  10. //////////////////////////////////////////////////////////////////////
  11. // TASKS
  12. //////////////////////////////////////////////////////////////////////
  13. Task("Clean").Does(() =>
  14. {
  15. CleanDirectories(GetDirectories(paths.src + "/**/bin/Release"));
  16. CleanDirectory(paths.nugetOutput);
  17. });
  18. Task("Compile").Does(() => DotNetCoreMSBuild(paths.solution, new DotNetCoreMSBuildSettings()
  19. .WithTarget("Restore")
  20. .WithTarget("Rebuild")
  21. .WithTarget("Pack")
  22. .SetConfiguration("Release")
  23. .WithProperty("PackageOutputPath", paths.nugetOutput)
  24. .SetMaxCpuCount(0)
  25. ));
  26. Task("Run-Unit-Tests").DoesForEach(() => GetFiles("./../src/Abc.Zebus*.Tests/*.csproj"), testProject =>
  27. {
  28. Information($"Testing: {testProject}");
  29. DotNetCoreTest(testProject.FullPath, new DotNetCoreTestSettings {
  30. Configuration = "Release",
  31. NoBuild = true
  32. });
  33. }).DeferOnError();
  34. //////////////////////////////////////////////////////////////////////
  35. // TASK TARGETS
  36. //////////////////////////////////////////////////////////////////////
  37. Task("Build")
  38. .IsDependentOn("Clean")
  39. .IsDependentOn("Compile");
  40. Task("Test")
  41. .IsDependentOn("Build")
  42. .IsDependentOn("Run-Unit-Tests");
  43. //////////////////////////////////////////////////////////////////////
  44. // EXECUTION
  45. //////////////////////////////////////////////////////////////////////
  46. RunTarget(target);