build.cake 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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/nuget")).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").Does(() =>
  27. {
  28. var testProjects = GetFiles("./../src/Abc.Zebus*.Tests/*.csproj");
  29. foreach (var testProject in testProjects)
  30. {
  31. Information($"Testing: {testProject}");
  32. DotNetCoreTest(testProject.FullPath, new DotNetCoreTestSettings {
  33. Configuration = "Release",
  34. NoBuild = true
  35. });
  36. }
  37. });
  38. //////////////////////////////////////////////////////////////////////
  39. // TASK TARGETS
  40. //////////////////////////////////////////////////////////////////////
  41. Task("Build")
  42. .IsDependentOn("Clean")
  43. .IsDependentOn("Compile");
  44. Task("Test")
  45. .IsDependentOn("Build")
  46. .IsDependentOn("Run-Unit-Tests");
  47. //////////////////////////////////////////////////////////////////////
  48. // EXECUTION
  49. //////////////////////////////////////////////////////////////////////
  50. RunTarget(target);