You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 7 години
преди 7 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #addin "nuget:https://www.nuget.org/api/v2?package=Newtonsoft.Json&version=9.0.1"
  2. #load "./build/index.cake"
  3. var target = Argument("target", "Default");
  4. var build = BuildParameters.Create(Context);
  5. var util = new Util(Context, build);
  6. Task("Clean")
  7. .Does(() =>
  8. {
  9. if (DirectoryExists("./artifacts"))
  10. {
  11. DeleteDirectory("./artifacts", true);
  12. }
  13. });
  14. Task("Restore")
  15. .IsDependentOn("Clean")
  16. .Does(() =>
  17. {
  18. var settings = new DotNetCoreRestoreSettings
  19. {
  20. ArgumentCustomization = args =>
  21. {
  22. args.Append($"/p:VersionSuffix={build.Version.Suffix}");
  23. return args;
  24. }
  25. };
  26. DotNetCoreRestore(settings);
  27. });
  28. Task("Build")
  29. .IsDependentOn("Restore")
  30. .Does(() =>
  31. {
  32. var settings = new DotNetCoreBuildSettings
  33. {
  34. Configuration = build.Configuration,
  35. VersionSuffix = build.Version.Suffix,
  36. ArgumentCustomization = args =>
  37. {
  38. args.Append($"/p:InformationalVersion={build.Version.VersionWithSuffix()}");
  39. return args;
  40. }
  41. };
  42. foreach (var project in build.ProjectFiles)
  43. {
  44. DotNetCoreBuild(project.FullPath, settings);
  45. }
  46. });
  47. Task("Test")
  48. .IsDependentOn("Build")
  49. .Does(() =>
  50. {
  51. foreach (var testProject in build.TestProjectFiles)
  52. {
  53. DotNetCoreTest(testProject.FullPath);
  54. }
  55. });
  56. Task("Pack")
  57. .Does(() =>
  58. {
  59. var settings = new DotNetCorePackSettings
  60. {
  61. Configuration = build.Configuration,
  62. VersionSuffix = build.Version.Suffix,
  63. IncludeSymbols = true,
  64. OutputDirectory = "./artifacts/packages"
  65. };
  66. foreach (var project in build.ProjectFiles)
  67. {
  68. DotNetCorePack(project.FullPath, settings);
  69. }
  70. });
  71. Task("Default")
  72. .IsDependentOn("Build")
  73. .IsDependentOn("Test")
  74. .IsDependentOn("Pack")
  75. .Does(() =>
  76. {
  77. util.PrintInfo();
  78. });
  79. Task("Version")
  80. .Does(() =>
  81. {
  82. Information($"{build.FullVersion()}");
  83. });
  84. Task("Print")
  85. .Does(() =>
  86. {
  87. util.PrintInfo();
  88. });
  89. RunTarget(target);