zarro 1.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/LICENSE +10 -0
  2. package/README.md +260 -0
  3. package/gulp-tasks/.editorconfig +8 -0
  4. package/gulp-tasks/.git +1 -0
  5. package/gulp-tasks/.gitignore +9 -0
  6. package/gulp-tasks/.gitmodules +0 -0
  7. package/gulp-tasks/LICENSE +24 -0
  8. package/gulp-tasks/README.md +144 -0
  9. package/gulp-tasks/build.js +135 -0
  10. package/gulp-tasks/clean.js +37 -0
  11. package/gulp-tasks/cover-dotnet.js +56 -0
  12. package/gulp-tasks/default-report-generator.js +51 -0
  13. package/gulp-tasks/default-tools-installer.js +33 -0
  14. package/gulp-tasks/default.js +17 -0
  15. package/gulp-tasks/dotnet-publish.js +23 -0
  16. package/gulp-tasks/generate-reports.js +7 -0
  17. package/gulp-tasks/get-local-nuget.js +16 -0
  18. package/gulp-tasks/git-submodules.js +83 -0
  19. package/gulp-tasks/increment-package-json-version.js +12 -0
  20. package/gulp-tasks/increment-package-json-version.ts +17 -0
  21. package/gulp-tasks/install-tools.js +24 -0
  22. package/gulp-tasks/modules/add-stream-on-any-handler.js +31 -0
  23. package/gulp-tasks/modules/alter-package-json-version.js +64 -0
  24. package/gulp-tasks/modules/alter-package-json-version.ts +113 -0
  25. package/gulp-tasks/modules/are-all-dotnet-core.js +96 -0
  26. package/gulp-tasks/modules/ask.js +31 -0
  27. package/gulp-tasks/modules/ask.ts +41 -0
  28. package/gulp-tasks/modules/collect-files.js +15 -0
  29. package/gulp-tasks/modules/collect-files.ts +16 -0
  30. package/gulp-tasks/modules/config-generator.js +10 -0
  31. package/gulp-tasks/modules/defaults.js +9 -0
  32. package/gulp-tasks/modules/download-nuget.js +104 -0
  33. package/gulp-tasks/modules/ensure-folder-exists.js +21 -0
  34. package/gulp-tasks/modules/env-helpers.js +49 -0
  35. package/gulp-tasks/modules/env-helpers.ts +67 -0
  36. package/gulp-tasks/modules/env.js +364 -0
  37. package/gulp-tasks/modules/exec.js +257 -0
  38. package/gulp-tasks/modules/exec.ts +346 -0
  39. package/gulp-tasks/modules/fail-after.js +30 -0
  40. package/gulp-tasks/modules/fail-after.ts +34 -0
  41. package/gulp-tasks/modules/fallback.js +6 -0
  42. package/gulp-tasks/modules/find-dirs.js +39 -0
  43. package/gulp-tasks/modules/find-local-nuget.js +42 -0
  44. package/gulp-tasks/modules/find-npm-base.js +42 -0
  45. package/gulp-tasks/modules/fs.js +79 -0
  46. package/gulp-tasks/modules/gather-paths.js +23 -0
  47. package/gulp-tasks/modules/gather-paths.ts +29 -0
  48. package/gulp-tasks/modules/generate-env-help-for.js +30 -0
  49. package/gulp-tasks/modules/get-tools-folder.js +12 -0
  50. package/gulp-tasks/modules/git-push-tags.js +33 -0
  51. package/gulp-tasks/modules/git-push-tags.ts +42 -0
  52. package/gulp-tasks/modules/git-push.js +51 -0
  53. package/gulp-tasks/modules/git-tag.js +36 -0
  54. package/gulp-tasks/modules/gulp-dotnetcover.js +537 -0
  55. package/gulp-tasks/modules/gulp-git-tag-from-csproj.js +50 -0
  56. package/gulp-tasks/modules/gulp-git-tag-from-csproj.ts +71 -0
  57. package/gulp-tasks/modules/gulp-git-tag-from-package-nuspec.js +55 -0
  58. package/gulp-tasks/modules/gulp-increment-nuget-package-dependency-version.js +40 -0
  59. package/gulp-tasks/modules/gulp-increment-nuget-package-version.js +87 -0
  60. package/gulp-tasks/modules/gulp-increment-nuget-package-version.ts +122 -0
  61. package/gulp-tasks/modules/gulp-msbuild.js +1 -0
  62. package/gulp-tasks/modules/gulp-npm-run.js +40 -0
  63. package/gulp-tasks/modules/gulp-npm-run.ts +52 -0
  64. package/gulp-tasks/modules/gulp-nuget-pack.js +168 -0
  65. package/gulp-tasks/modules/gulp-nuget-restore.js +106 -0
  66. package/gulp-tasks/modules/gulp-nunit-runner/.jshintrc +5 -0
  67. package/gulp-tasks/modules/gulp-nunit-runner/.npmignore +16 -0
  68. package/gulp-tasks/modules/gulp-nunit-runner/LICENSE +21 -0
  69. package/gulp-tasks/modules/gulp-nunit-runner/README.md +300 -0
  70. package/gulp-tasks/modules/gulp-nunit-runner/index.js +1 -0
  71. package/gulp-tasks/modules/gulp-nunit-runner/lib/index.js +205 -0
  72. package/gulp-tasks/modules/gulp-nunit-runner/lib/teamcity.js +86 -0
  73. package/gulp-tasks/modules/gulp-purge.js +88 -0
  74. package/gulp-tasks/modules/gulp-util.js +5 -0
  75. package/gulp-tasks/modules/gulp-version.js +8 -0
  76. package/gulp-tasks/modules/gulp-with-help.js +1 -0
  77. package/gulp-tasks/modules/gulp-xbuild.js +62 -0
  78. package/gulp-tasks/modules/gulp.js +92 -0
  79. package/gulp-tasks/modules/http-downloader.js +113 -0
  80. package/gulp-tasks/modules/import-npm-tasks.js +33 -0
  81. package/gulp-tasks/modules/increment-version-string.js +18 -0
  82. package/gulp-tasks/modules/increment-version.js +30 -0
  83. package/gulp-tasks/modules/increment-version.ts +41 -0
  84. package/gulp-tasks/modules/install-local-tools.js +122 -0
  85. package/gulp-tasks/modules/load-xml-file.js +12 -0
  86. package/gulp-tasks/modules/load-xml-file.ts +15 -0
  87. package/gulp-tasks/modules/log-config.js +31 -0
  88. package/gulp-tasks/modules/log.js +142 -0
  89. package/gulp-tasks/modules/longest-string-length.js +13 -0
  90. package/gulp-tasks/modules/looks-like-a-promise.js +11 -0
  91. package/gulp-tasks/modules/ls-r.js +52 -0
  92. package/gulp-tasks/modules/multi-split.js +29 -0
  93. package/gulp-tasks/modules/net-framework-test-assembly-filter.js +45 -0
  94. package/gulp-tasks/modules/nuget-push.js +66 -0
  95. package/gulp-tasks/modules/nuget-update-self.js +9 -0
  96. package/gulp-tasks/modules/nuget.js +8 -0
  97. package/gulp-tasks/modules/nuget.ts +14 -0
  98. package/gulp-tasks/modules/pad-left.js +4 -0
  99. package/gulp-tasks/modules/pad-right.js +4 -0
  100. package/gulp-tasks/modules/pad.js +25 -0
  101. package/gulp-tasks/modules/parse-xml-string.js +5 -0
  102. package/gulp-tasks/modules/parse-xml-string.ts +6 -0
  103. package/gulp-tasks/modules/parse-xml.js +14 -0
  104. package/gulp-tasks/modules/parse-xml.ts +15 -0
  105. package/gulp-tasks/modules/path-unquote.js +6 -0
  106. package/gulp-tasks/modules/promisify-function.js +19 -0
  107. package/gulp-tasks/modules/promisify-function.ts +18 -0
  108. package/gulp-tasks/modules/promisify-stream.js +73 -0
  109. package/gulp-tasks/modules/promisify.js +1 -0
  110. package/gulp-tasks/modules/quote-if-required.js +14 -0
  111. package/gulp-tasks/modules/read-all-git-branches.js +10 -0
  112. package/gulp-tasks/modules/read-all-git-branches.ts +13 -0
  113. package/gulp-tasks/modules/read-all-git-remotes.js +36 -0
  114. package/gulp-tasks/modules/read-all-git-remotes.ts +44 -0
  115. package/gulp-tasks/modules/read-csproj-package-version.js +16 -0
  116. package/gulp-tasks/modules/read-csproj-package-version.ts +26 -0
  117. package/gulp-tasks/modules/read-csproj-version.js +16 -0
  118. package/gulp-tasks/modules/read-csproj-version.ts +26 -0
  119. package/gulp-tasks/modules/read-current-git-branch.js +12 -0
  120. package/gulp-tasks/modules/read-current-git-branch.ts +16 -0
  121. package/gulp-tasks/modules/read-git-commit-delta-count.js +21 -0
  122. package/gulp-tasks/modules/read-git-commit-delta-count.ts +33 -0
  123. package/gulp-tasks/modules/read-git-info.js +28 -0
  124. package/gulp-tasks/modules/read-git-info.ts +31 -0
  125. package/gulp-tasks/modules/read-git-remote.js +17 -0
  126. package/gulp-tasks/modules/read-git-remote.ts +23 -0
  127. package/gulp-tasks/modules/read-last-fetch-time.js +21 -0
  128. package/gulp-tasks/modules/read-last-fetch-time.ts +17 -0
  129. package/gulp-tasks/modules/read-main-branch-name.js +48 -0
  130. package/gulp-tasks/modules/read-main-branch-name.ts +76 -0
  131. package/gulp-tasks/modules/read-nuspec-version.js +14 -0
  132. package/gulp-tasks/modules/read-nuspec-version.ts +22 -0
  133. package/gulp-tasks/modules/read-package-json.js +16 -0
  134. package/gulp-tasks/modules/read-package-json.ts +22 -0
  135. package/gulp-tasks/modules/read-package-version.js +8 -0
  136. package/gulp-tasks/modules/read-package-version.ts +10 -0
  137. package/gulp-tasks/modules/read-text-file.js +14 -0
  138. package/gulp-tasks/modules/read-text-file.ts +14 -0
  139. package/gulp-tasks/modules/reduce-gulp-noise.js +34 -0
  140. package/gulp-tasks/modules/register-environment-variables.js +526 -0
  141. package/gulp-tasks/modules/require-module.js +28 -0
  142. package/gulp-tasks/modules/resolve-git-branch.js +11 -0
  143. package/gulp-tasks/modules/resolve-git-branch.ts +13 -0
  144. package/gulp-tasks/modules/resolve-git-remote.js +11 -0
  145. package/gulp-tasks/modules/resolve-git-remote.ts +13 -0
  146. package/gulp-tasks/modules/resolve-masks.js +47 -0
  147. package/gulp-tasks/modules/resolve-nuget.js +135 -0
  148. package/gulp-tasks/modules/resolve-test-masks.js +10 -0
  149. package/gulp-tasks/modules/rewrite-file.js +26 -0
  150. package/gulp-tasks/modules/rewrite-file.ts +34 -0
  151. package/gulp-tasks/modules/rimraf.js +21 -0
  152. package/gulp-tasks/modules/rimraf.ts +31 -0
  153. package/gulp-tasks/modules/run-sequence.js +16 -0
  154. package/gulp-tasks/modules/safe-git.js +23 -0
  155. package/gulp-tasks/modules/safe-git.ts +23 -0
  156. package/gulp-tasks/modules/seed.js +12 -0
  157. package/gulp-tasks/modules/set-task-name.js +9 -0
  158. package/gulp-tasks/modules/sleep.js +5 -0
  159. package/gulp-tasks/modules/spawn-nuget.js +13 -0
  160. package/gulp-tasks/modules/spawn.js +103 -0
  161. package/gulp-tasks/modules/split-path.js +3 -0
  162. package/gulp-tasks/modules/stat.js +8 -0
  163. package/gulp-tasks/modules/status.js +57 -0
  164. package/gulp-tasks/modules/status.ts +71 -0
  165. package/gulp-tasks/modules/test-path.js +3 -0
  166. package/gulp-tasks/modules/testutil-finder.js +176 -0
  167. package/gulp-tasks/modules/throw-if-no-files.js +15 -0
  168. package/gulp-tasks/modules/uniq.js +6 -0
  169. package/gulp-tasks/modules/uniq.ts +5 -0
  170. package/gulp-tasks/modules/verify-exe.js +17 -0
  171. package/gulp-tasks/modules/version-reading-shared.js +12 -0
  172. package/gulp-tasks/modules/version-reading-shared.ts +16 -0
  173. package/gulp-tasks/modules/write-text-file.js +10 -0
  174. package/gulp-tasks/modules/zarro-error.js +6 -0
  175. package/gulp-tasks/nuget-restore.js +57 -0
  176. package/gulp-tasks/pack.js +118 -0
  177. package/gulp-tasks/purge.js +94 -0
  178. package/gulp-tasks/release-npm.js +58 -0
  179. package/gulp-tasks/release-npm.ts +81 -0
  180. package/gulp-tasks/start/_package.json +39 -0
  181. package/gulp-tasks/start/gulpfile.js +204 -0
  182. package/gulp-tasks/start/update-starter-packages.js +63 -0
  183. package/gulp-tasks/test-dotnet.js +195 -0
  184. package/gulp-tasks/update-git-submodules.js +11 -0
  185. package/gulp-tasks/update-git-submodules.ts +29 -0
  186. package/gulp-tasks/update-self.js +65 -0
  187. package/gulp-tasks/update-self.ts +88 -0
  188. package/gulp-tasks/verify-up-to-date.js +77 -0
  189. package/gulp-tasks/verify-up-to-date.ts +119 -0
  190. package/index-modules/contains-any.js +31 -0
  191. package/index-modules/gather-args.js +21 -0
  192. package/index-modules/handlers/help.js +17 -0
  193. package/index-modules/handlers/init.js +57 -0
  194. package/index-modules/handlers/invoke-gulp.js +111 -0
  195. package/index-modules/handlers/show-env.js +46 -0
  196. package/index-modules/is-dir.js +6 -0
  197. package/index-modules/is-file.js +6 -0
  198. package/index.js +53 -0
  199. package/package.json +96 -0
  200. package/tsconfig.json +66 -0
  201. package/types.d.ts +753 -0
@@ -0,0 +1,135 @@
1
+ const
2
+ chalk = require("ansi-colors"),
3
+ os = require("os"),
4
+ env = requireModule("env"),
5
+ gulp = requireModule("gulp"),
6
+ debug = require("debug")("build"),
7
+ promisifyStream = requireModule("promisify"),
8
+ dotnetCli = require("gulp-dotnet-cli"),
9
+ dotnetClean = dotnetCli.clean,
10
+ dotnetBuild = dotnetCli.build,
11
+ throwIfNoFiles = requireModule("throw-if-no-files"),
12
+ xbuild = requireModule("gulp-xbuild"),
13
+ gutil = requireModule("gulp-util"),
14
+ log = requireModule("log"),
15
+ resolveMasks = requireModule("resolve-masks"),
16
+ logConfig = requireModule("log-config"),
17
+ msbuild = require("gulp-msbuild");
18
+
19
+ gulp.task("prebuild", ["nuget-restore"]);
20
+
21
+ const myTasks = ["build"],
22
+ myVars = [
23
+ "BUILD_CONFIGURATION",
24
+ "BUILD_PLATFORM",
25
+ "BUILD_ARCHITECTURE",
26
+ "BUILD_TARGETS",
27
+ "BUILD_TOOLSVERSION",
28
+ "BUILD_VERBOSITY",
29
+ "BUILD_MSBUILD_NODE_REUSE",
30
+ "BUILD_MAX_CPU_COUNT",
31
+ "MAX_CONCURRENCY",
32
+ "BUILD_INCLUDE",
33
+ "BUILD_EXCLUDE",
34
+ "BUILD_ADDITIONAL_EXCLUDE",
35
+ "BUILD_SHOW_INFO",
36
+ "BUILD_FAIL_ON_ERROR"
37
+ ];
38
+ env.associate(myVars, myTasks);
39
+
40
+ gulp.task(
41
+ "build",
42
+ "Builds Visual Studio solutions in tree",
43
+ ["prebuild"],
44
+ build
45
+ );
46
+
47
+ gulp.task("quick-build", "Quick build without pre-cursors", build);
48
+
49
+ async function build() {
50
+ const slnMasks = resolveMasks("BUILD_INCLUDE", [ "BUILD_EXCLUDE", "BUILD_ADDITIONAL_EXCLUDE"]);
51
+ debug({
52
+ slnMasks,
53
+ cwd: process.cwd()
54
+ });
55
+ const solutions = gulp
56
+ .src(slnMasks, { allowEmpty: true })
57
+ .pipe(throwIfNoFiles(`No solutions found matching masks: ${slnMasks}}`));
58
+
59
+ // TODO: find a reliable, quick way to determine if the projects to be compiled
60
+ // are all dotnet core -- trawling *.csproj is slow and has caused hangups
61
+ // here, so for now, DNC build must be requested via env DONET_CORE
62
+ return env.resolveFlag("DOTNET_CORE")
63
+ ? buildForNetCore(solutions)
64
+ : buildForNETFramework(solutions);
65
+ }
66
+
67
+ function buildForNetCore(solutions) {
68
+ log.info(gutil.colors.yellow("Building with dotnet core"));
69
+ const
70
+ configuration = env.resolve("BUILD_CONFIGURATION"),
71
+ msbuildArgs = [];
72
+ if (!env.resolveFlag("BUILD_MSBUILD_NODE_REUSE")) {
73
+ msbuildArgs.push("/nodeReuse:false")
74
+ }
75
+ return promisifyStream(
76
+ solutions
77
+ .pipe(
78
+ dotnetClean({
79
+ configuration
80
+ })
81
+ )
82
+ .pipe(
83
+ dotnetBuild({
84
+ verbosity: env.resolve("BUILD_VERBOSITY"),
85
+ configuration,
86
+ // msbuild attempts to re-use nodes, which causes issues
87
+ // if you're building unrelated projects on the same machine with,
88
+ // eg, different versions of Microsoft.Net.Compilers
89
+ msbuildArgs,
90
+ echo: true
91
+ })
92
+ )
93
+ );
94
+ }
95
+
96
+ function buildForNETFramework(solutions) {
97
+ log.info(chalk.yellowBright("Building with MsBuild"));
98
+ return promisifyStream(buildAsStream(solutions));
99
+ }
100
+
101
+ function buildAsStream(solutions) {
102
+ const builder = os.platform() === "win32" ? msbuild : xbuild;
103
+ const config = {
104
+ toolsVersion: env.resolve("BUILD_TOOLSVERSION"),
105
+ targets: env.resolveArray("BUILD_TARGETS"),
106
+ configuration: env.resolve("BUILD_CONFIGURATION"),
107
+ stdout: true,
108
+ verbosity: env.resolve("BUILD_VERBOSITY"),
109
+ errorOnFail: env.resolveFlag("BUILD_FAIL_ON_ERROR"),
110
+ solutionPlatform: env.resolve("BUILD_PLATFORM"),
111
+ // NB: this is the MSBUILD architecture, NOT your desired output architecture
112
+ architecture: env.resolve("BUILD_ARCHITECTURE"),
113
+ nologo: false,
114
+ logCommand: true,
115
+ nodeReuse: env.resolveFlag("BUILD_MSBUILD_NODE_REUSE"),
116
+ maxcpucount: env.resolveNumber("BUILD_MAX_CPU_COUNT")
117
+ };
118
+
119
+ if (env.resolveFlag("BUILD_SHOW_INFO")) {
120
+ logConfig(config, {
121
+ toolsVersion: "Tools version",
122
+ targets: "Build targets",
123
+ configuration: "Build configuration",
124
+ stdout: "Log to stdout",
125
+ verbosity: "Build verbosity",
126
+ errorOnFail: "Any error fails the build",
127
+ solutionPlatform: "Build platform",
128
+ architecture: "Build architecture",
129
+ nodeReuse: "Re-use MSBUILD nodes",
130
+ maxcpucount: "Max CPUs to use for build",
131
+ });
132
+ }
133
+ return solutions
134
+ .pipe(builder(config));
135
+ }
@@ -0,0 +1,37 @@
1
+ const gulp = requireModule("gulp"),
2
+ msbuild = require("gulp-msbuild"),
3
+ env = requireModule("env");
4
+
5
+ const myVars = [
6
+ "BUILD_TOOLSVERSION",
7
+ "BUILD_CONFIGURATION",
8
+ "BUILD_VERBOSITY",
9
+ "BUILD_MAX_CPU_COUNT",
10
+ "BUILD_ERROR_ON_FAIL",
11
+ "BUILD_PLATFORM",
12
+ "BUILD_ARCHITECTURE",
13
+ "BUILD_MSBUILD_NODE_REUSE"
14
+ ];
15
+ env.associate(myVars, "clean");
16
+
17
+ gulp.task(
18
+ "clean",
19
+ "Invokes the 'Clean' target on all solutions in the tree",
20
+ function() {
21
+ return gulp.src("**/*.sln").pipe(
22
+ msbuild({
23
+ toolsVersion: env.resolve("BUILD_TOOLSVERSION"),
24
+ targets: ["Clean"],
25
+ configuration: env.resolve("BUILD_CONFIGURATION"),
26
+ stdout: true,
27
+ logCommand: true,
28
+ errorOnFail: env.resolveFlag("BUILD_ERROR_ON_FAIL"),
29
+ solutionPlatfor: env.resolve("BUILD_PLATFORM"),
30
+ architecture: env.resolve("BUILD_ARCHITECTURE"),
31
+ verbosity: env.resolve("BUILD_VERBOSITY"),
32
+ nodeReuse: env.resolveFlag("BUILD_MSBUILD_NODE_REUSE"),
33
+ maxcpucount: env.resolveNumber("BUILD_MAX_CPU_COUNT")
34
+ })
35
+ );
36
+ }
37
+ );
@@ -0,0 +1,56 @@
1
+ const gulp = requireModule("gulp"),
2
+ dotNetCover = requireModule("gulp-dotnetcover"),
3
+ resolveMasks = requireModule("resolve-masks"),
4
+ filter = require("gulp-filter"),
5
+ assemblyFilter = requireModule("net-framework-test-assembly-filter"),
6
+ env = requireModule("env");
7
+
8
+ const myVars = [
9
+ "BUILD_CONFIGURATION",
10
+ "BUILD_PLATFORM",
11
+ "BUILD_ARCHITECTURE",
12
+ "BUILD_TARGETS",
13
+ "BUILD_TOOLSVERSION",
14
+ "BUILD_VERBOSITY",
15
+ "TEST_ARCHITECTURE",
16
+ "TEST_EXCLUDE",
17
+ "TEST_INCLUDE",
18
+ "COVERAGE_ADDITIONAL_EXCLUDE",
19
+ "COVERAGE_EXCLUDE"
20
+ ];
21
+ env.associate(myVars, [ "cover-dotnet", "quick-cover-dotnet" ]);
22
+
23
+ const help = "Runs .NET tests with OpenCover or DotCover";
24
+
25
+ function cover() {
26
+ const
27
+ configuration = env.resolve("BUILD_CONFIGURATION"),
28
+ inputMasks = resolveMasks(
29
+ "TEST_INCLUDE",
30
+ "TEST_EXCLUDE"
31
+ ).map(
32
+ s => `${s}.dll`
33
+ ),
34
+ exclusions = env
35
+ .resolveArray("COVERAGE_EXCLUDE")
36
+ .concat(env.resolveArray("COVERAGE_ADDITIONAL_EXCLUDE")),
37
+ include = env
38
+ .resolveArray("COVERAGE_INCLUDE"),
39
+ exclude = exclusions.filter(e => include.indexOf(e) === -1);
40
+
41
+ return gulp
42
+ .src(inputMasks, { allowEmpty: true })
43
+ .pipe(filter(
44
+ assemblyFilter(configuration)
45
+ ))
46
+ .pipe(
47
+ dotNetCover({
48
+ debug: false,
49
+ architecture: env.resolve("TEST_ARCHITECTURE"),
50
+ exclude
51
+ })
52
+ );
53
+ }
54
+
55
+ gulp.task("cover-dotnet", help, [ "build" ], cover);
56
+ gulp.task("quick-cover-dotnet", help, cover);
@@ -0,0 +1,51 @@
1
+ const gulp = requireModule("gulp"),
2
+ path = require("path"),
3
+ findTool = requireModule("testutil-finder").findTool,
4
+ spawn = requireModule("spawn"),
5
+ fs = requireModule("fs"),
6
+ quoteIfRequired = requireModule("quote-if-required"),
7
+ del = require("del"),
8
+ env = requireModule("env");
9
+
10
+ env.associate(["COVERAGE_XML", "COVERAGE_REPORTING_EXCLUDE"], "cover-dotnet");
11
+
12
+ gulp.task(
13
+ "default-report-generator",
14
+ `Generates HTML reports from existing coverage XML reports`,
15
+ () => {
16
+ const reportGenerator = findTool("ReportGenerator.exe");
17
+ if (!reportGenerator) {
18
+ return Promise.reject("No ReportGenerator.exe found in tools folder");
19
+ }
20
+ const coverageXml = env.resolve("COVERAGE_XML");
21
+ if (!fs.existsSync(coverageXml)) {
22
+ return Promise.reject(`Can't find ${coverageXml}`);
23
+ }
24
+
25
+ var inclusions = env.resolveArray("COVERAGE_INCLUDE");
26
+ const exclusions = env
27
+ .resolveArray("COVERAGE_EXCLUDE")
28
+ .concat(env.resolveArray("COVERAGE_ADDITIONAL_EXCLUDE"))
29
+ .filter(e => inclusions.indexOf(e) === -1);
30
+ const
31
+ coverageExclude = exclusions.map(e => `-${e}`).join(";"),
32
+ coverageInclude = inclusions.map(e => `+${e}`).join(";"),
33
+ assemblyfilters = `${coverageInclude};${coverageExclude}`;
34
+
35
+
36
+ return spawn(reportGenerator, [
37
+ `-reports:${quoteIfRequired(coverageXml)}`,
38
+ `-targetdir:${quoteIfRequired(path.join("buildreports", "coverage"))}`,
39
+ `"-assemblyfilters:${assemblyfilters}"`
40
+ ]);
41
+ }
42
+ );
43
+
44
+ gulp.task("clean-reports", `Cleans out the build reports folder`, async () => {
45
+ const buildReportsFolder = path.dirname(env.resolve("COVERAGE_XML")),
46
+ exists = await fs.exists(buildReportsFolder);
47
+ if (exists) {
48
+ await del(buildReportsFolder);
49
+ }
50
+ await fs.mkdir(buildReportsFolder);
51
+ });
@@ -0,0 +1,33 @@
1
+ const debug = require("debug")("default-tools-installer"),
2
+ gulp = requireModule("gulp"),
3
+ nugetSourceName = process.env.NUGET_SOURCE || "nuget.org",
4
+ installLocalTools = requireModule("install-local-tools"),
5
+ env = requireModule("env"),
6
+ tools = [
7
+ `${nugetSourceName}/nunit.console`,
8
+ `${nugetSourceName}/opencover`,
9
+ `${nugetSourceName}/Jetbrains.dotCover.CommandLineTools`,
10
+ `${nugetSourceName}/reportgenerator`
11
+ ];
12
+
13
+ env.associate("default-tools-installer", [ "BUILD_TOOLS_FOLDER", "DOTNET_CORE" ]);
14
+
15
+ gulp.task(
16
+ "default-tools-installer",
17
+ `Installs the default toolset: ${tools.join(", ")}`,
18
+ () => {
19
+ if (env.resolveFlag("DOTNET_CORE")) {
20
+ debug("not invoked for dotnet core builds");
21
+ return Promise.resolve();
22
+ }
23
+ return installLocalTools.install(tools);
24
+ }
25
+ );
26
+
27
+ gulp.task(
28
+ "clean-tools-folder",
29
+ "Cleans out folders under the tools folder (will always be done as part of tool installation)",
30
+ () => {
31
+ return installLocalTools.clean();
32
+ }
33
+ );
@@ -0,0 +1,17 @@
1
+ var gulp = requireModule("gulp"),
2
+ gutil = requireModule("gulp-util"),
3
+ runSequence = requireModule("run-sequence");
4
+
5
+ gulp.task("default", "Purges, updates git submodules, builds, covers dotnet", function () {
6
+ runSequence("purge", "build", "cover-dotnet", "generate-reports", function (err) {
7
+ return new Promise(function (resolve, reject) {
8
+ if (err) {
9
+ gutil.log(gutil.colors.red(gutil.colors.bold(err)));
10
+ reject(err);
11
+ } else {
12
+ resolve();
13
+ }
14
+ });
15
+ });
16
+ });
17
+
@@ -0,0 +1,23 @@
1
+ const { publish } = require("gulp-dotnet-cli"),
2
+ env = requireModule("env"),
3
+ gulp = requireModule("gulp");
4
+
5
+ gulp.task(
6
+ "dotnet-publish",
7
+ "Performs `dotnet publish` on all non-test projects in the tree",
8
+ () => {
9
+ const publishOpts = {
10
+ configuration: env.resolve("DOTNET_PUBLISH_BUILD_CONFIGURATION", "BUILD_CONFIGURATION"),
11
+ runtime: env.resolve("DOTNET_PUBLISH_RUNTIMES"),
12
+ output: env.resolve("OUTPUT")
13
+ };
14
+
15
+ const testInclusionsInverted = env.resolveArray("TEST_INCLUDE")
16
+ .map(p => `!${p}.csproj`)
17
+ return gulp
18
+ .src(["**/*.csproj"].concat(testInclusionsInverted))
19
+ .pipe(
20
+ publish(publishOpts)
21
+ );
22
+ }
23
+ );
@@ -0,0 +1,7 @@
1
+ var gulp = requireModule("gulp");
2
+
3
+ gulp.task(
4
+ "generate-reports",
5
+ "runs 'default-report-generator'",
6
+ [ "default-report-generator" ],
7
+ done => done());
@@ -0,0 +1,16 @@
1
+ const
2
+ gulp = requireModule("gulp"),
3
+ downloadNuget = requireModule("download-nuget"),
4
+ env = requireModule("env"),
5
+ path = require("path"),
6
+ configGenerator = requireModule("config-generator");
7
+
8
+ env.associate("BUILD_TOOLS_FOLDER", "get-local-nuget");
9
+
10
+ gulp.task(
11
+ "get-local-nuget",
12
+ "Attempts to download the latest nuget.exe to the build tooling folder", () => {
13
+ const config = configGenerator();
14
+ return downloadNuget(path.dirname(config.localNuget))
15
+ .then(() => console.log("get-local-nuget completes"));
16
+ });
@@ -0,0 +1,83 @@
1
+ const spawn = requireModule("spawn"),
2
+ gulp = requireModule("gulp"),
3
+ log = requireModule("log"),
4
+ fs = requireModule("fs"),
5
+ subModulesFile = ".gitmodules";
6
+
7
+ gulp.task('git-submodules', 'Updates (with --init) all submodules in tree', function () {
8
+ return spawn('git', ['submodule', 'update', '--init', '--recursive']);
9
+ });
10
+
11
+ gulp.task('git-submodules-as-externals', function () {
12
+ return new Promise((resolve, reject) => {
13
+ if (!fs.existsSync(subModulesFile)) {
14
+ log.notice('no submodules file found');
15
+ return resolve();
16
+ } else {
17
+ log.notice('performing submodule init/update...');
18
+ spawn('git', ['submodule', 'update', '--init', '--recursive']).then(function () {
19
+ log.info('getting list of local submodules...');
20
+ return fs.readFile(subModulesFile);
21
+ }).then(function (buffer) {
22
+ log.info('grokking paths of local submodules...');
23
+ const fileContents = buffer.toString();
24
+ const lines = fileContents.split("\n");
25
+ const submodulePaths = lines.reduce(function (acc, cur) {
26
+ const parts = cur.split(" = ").map(function (item) {
27
+ return item.trim();
28
+ });
29
+ if (parts.length > 1 && parts[0] === "path") {
30
+ acc.push(parts[1]);
31
+ }
32
+ return acc;
33
+ }, []);
34
+ return submodulePaths;
35
+ }).then(function (modulePaths) {
36
+ const mkdir = function (path) {
37
+ const parts = path.split("/");
38
+ let current = "";
39
+ parts.forEach(function (part) {
40
+ current += current ? "/" : "";
41
+ current += part;
42
+ if (!fs.existsSync(current)) {
43
+ fs.mkdirSync(current);
44
+ }
45
+ });
46
+ };
47
+ modulePaths.forEach(function (path) {
48
+ mkdir(path);
49
+ });
50
+ return modulePaths;
51
+ }).then(function (modulePaths) {
52
+ log.info('making sure local submodules are up to date...');
53
+ const innerDeferred = q.defer();
54
+ const spawnOptions = {
55
+ stdio: [ process.stdin, process.stdout, process.stderr, "pipe" ]
56
+ };
57
+ const finalPromise = modulePaths.reduce(function (acc, cur) {
58
+ const workingFolder = [ process.cwd(), cur ].join("/");
59
+ log.info("working with submodule at: " + cur);
60
+ spawnOptions.cwd = workingFolder;
61
+ return acc.then(function () {
62
+ log.debug(" - fetch changes");
63
+ return spawn("git", [ "fetch" ], spawnOptions).then(function () {
64
+ log.debug(" - switch to master");
65
+ return spawn("git", [ "checkout", "master" ], spawnOptions);
66
+ }).then(function () {
67
+ log.debug(" - fast-forward to HEAD");
68
+ return spawn("git", [ "rebase" ], spawnOptions);
69
+ });
70
+ });
71
+ }, innerDeferred.promise);
72
+ innerDeferred.resolve();
73
+ return finalPromise;
74
+ }).then(function () {
75
+ log.info('git submodule magick complete');
76
+ resolve();
77
+ }).catch(function (err) {
78
+ reject(err);
79
+ });
80
+ }
81
+ });
82
+ });
83
+