Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. var settings = new DotNetCoreTestSettings
  52. {
  53. Configuration = build.Configuration,
  54. NoBuild = false
  55. };
  56. foreach (var testProject in build.TestProjectFiles)
  57. {
  58. DotNetCoreTest(testProject.FullPath, settings);
  59. }
  60. });
  61. Task("Pack")
  62. .Does(() =>
  63. {
  64. var settings = new DotNetCorePackSettings
  65. {
  66. Configuration = build.Configuration,
  67. VersionSuffix = build.Version.Suffix,
  68. IncludeSymbols = true,
  69. OutputDirectory = "./artifacts/packages"
  70. };
  71. foreach (var project in build.ProjectFiles)
  72. {
  73. DotNetCorePack(project.FullPath, settings);
  74. }
  75. });
  76. Task("Default")
  77. .IsDependentOn("Build")
  78. .IsDependentOn("Test")
  79. .IsDependentOn("Pack")
  80. .Does(() =>
  81. {
  82. util.PrintInfo();
  83. });
  84. Task("Version")
  85. .Does(() =>
  86. {
  87. Information($"{build.FullVersion()}");
  88. });
  89. Task("Print")
  90. .Does(() =>
  91. {
  92. util.PrintInfo();
  93. });
  94. RunTarget(target);