zarro 1.100.0 → 1.100.1
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.
- package/gulp-tasks/build.js +8 -31
- package/gulp-tasks/clean.js +55 -37
- package/gulp-tasks/modules/register-environment-variables.js +1 -1
- package/gulp-tasks/modules/try-do.js +51 -0
- package/gulp-tasks/modules/try-do.ts +56 -0
- package/package.json +1 -1
- package/types.d.ts +761 -757
package/gulp-tasks/build.js
CHANGED
|
@@ -14,9 +14,10 @@ const
|
|
|
14
14
|
log = requireModule("log"),
|
|
15
15
|
resolveMasks = requireModule("resolve-masks"),
|
|
16
16
|
logConfig = requireModule("log-config"),
|
|
17
|
+
tryDo = requireModule("try-do"),
|
|
17
18
|
msbuild = require("gulp-msbuild");
|
|
18
19
|
|
|
19
|
-
gulp.task("prebuild", ["nuget-restore"]);
|
|
20
|
+
gulp.task("prebuild", ["nuget-restore", "clean"]);
|
|
20
21
|
|
|
21
22
|
const myTasks = ["build"],
|
|
22
23
|
myVars = [
|
|
@@ -48,31 +49,12 @@ gulp.task(
|
|
|
48
49
|
gulp.task("quick-build", "Quick build without pre-cursors", tryBuild);
|
|
49
50
|
|
|
50
51
|
async function tryBuild() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
let retryCount = 0;
|
|
60
|
-
|
|
61
|
-
while (totalAttempts-- > 0) {
|
|
62
|
-
try {
|
|
63
|
-
await build();
|
|
64
|
-
} catch (e) {
|
|
65
|
-
if (totalAttempts > 0) {
|
|
66
|
-
console.error(chalk.red(`Build fails: ${ e }`));
|
|
67
|
-
console.log(chalk.green(`Retrying (${ ++retryCount } / ${ totalRetries })`));
|
|
68
|
-
} else {
|
|
69
|
-
if (totalRetries < 1) {
|
|
70
|
-
console.log(chalk.magentaBright(`Build fails! If the error looks transient, I suggest setting the environment variable 'BUILD_RETRIES' to some number > 0 🔨.`));
|
|
71
|
-
}
|
|
72
|
-
throw e;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
52
|
+
return tryDo(
|
|
53
|
+
build,
|
|
54
|
+
env.resolveNumber("BUILD_RETRIES"),
|
|
55
|
+
e => console.error(chalk.red(`Build fails: ${e}`)),
|
|
56
|
+
() => console.log(chalk.magentaBright(`Build fails! If the error looks transient, I suggest setting the environment variable 'BUILD_RETRIES' to some number > 0 🔨.`))
|
|
57
|
+
);
|
|
76
58
|
}
|
|
77
59
|
|
|
78
60
|
async function build() {
|
|
@@ -103,11 +85,6 @@ function buildForNetCore(solutions) {
|
|
|
103
85
|
}
|
|
104
86
|
return promisifyStream(
|
|
105
87
|
solutions
|
|
106
|
-
.pipe(
|
|
107
|
-
dotnetClean({
|
|
108
|
-
configuration
|
|
109
|
-
})
|
|
110
|
-
)
|
|
111
88
|
.pipe(
|
|
112
89
|
dotnetBuild({
|
|
113
90
|
verbosity: env.resolve("BUILD_VERBOSITY"),
|
package/gulp-tasks/clean.js
CHANGED
|
@@ -1,37 +1,55 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
const
|
|
2
|
+
gulp = requireModule("gulp"),
|
|
3
|
+
promisifyStream = requireModule("promisify-stream"),
|
|
4
|
+
tryDo = requireModule("try-do"),
|
|
5
|
+
msbuild = require("gulp-msbuild"),
|
|
6
|
+
env = requireModule("env");
|
|
7
|
+
const chalk = require("ansi-colors");
|
|
8
|
+
|
|
9
|
+
const myVars = [
|
|
10
|
+
"BUILD_TOOLSVERSION",
|
|
11
|
+
"BUILD_CONFIGURATION",
|
|
12
|
+
"BUILD_VERBOSITY",
|
|
13
|
+
"BUILD_MAX_CPU_COUNT",
|
|
14
|
+
"BUILD_FAIL_ON_ERROR",
|
|
15
|
+
"BUILD_PLATFORM",
|
|
16
|
+
"BUILD_ARCHITECTURE",
|
|
17
|
+
"BUILD_MSBUILD_NODE_REUSE",
|
|
18
|
+
"BUILD_RETRIES"
|
|
19
|
+
];
|
|
20
|
+
env.associate(myVars, "clean");
|
|
21
|
+
|
|
22
|
+
gulp.task(
|
|
23
|
+
"clean",
|
|
24
|
+
"Invokes the 'Clean' target on all solutions in the tree",
|
|
25
|
+
tryClean
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
function tryClean() {
|
|
29
|
+
tryDo(
|
|
30
|
+
clean,
|
|
31
|
+
env.resolveNumber("BUILD_RETRIES"),
|
|
32
|
+
e => console.error(chalk.red(`Clean fails: ${e}`))
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function clean() {
|
|
37
|
+
return promisifyStream(
|
|
38
|
+
gulp.src("**/*.sln")
|
|
39
|
+
.pipe(
|
|
40
|
+
msbuild({
|
|
41
|
+
toolsVersion: env.resolve("BUILD_TOOLSVERSION"),
|
|
42
|
+
targets: [ "Clean" ],
|
|
43
|
+
configuration: env.resolve("BUILD_CONFIGURATION"),
|
|
44
|
+
stdout: true,
|
|
45
|
+
logCommand: true,
|
|
46
|
+
errorOnFail: env.resolveFlag("BUILD_FAIL_ON_ERROR"),
|
|
47
|
+
solutionPlatform: env.resolve("BUILD_PLATFORM"),
|
|
48
|
+
architecture: env.resolve("BUILD_ARCHITECTURE"),
|
|
49
|
+
verbosity: env.resolve("BUILD_VERBOSITY"),
|
|
50
|
+
nodeReuse: env.resolveFlag("BUILD_MSBUILD_NODE_REUSE"),
|
|
51
|
+
maxcpucount: env.resolveNumber("BUILD_MAX_CPU_COUNT")
|
|
52
|
+
})
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(function () {
|
|
3
|
+
const env = requireModule("env"), chalk = require("ansi-colors");
|
|
4
|
+
async function tryDo(logic, retries, onTransientError, onFinalFailure) {
|
|
5
|
+
// always attempt at least once
|
|
6
|
+
const requestedRetries = typeof retries === "string"
|
|
7
|
+
? env.resolveNumber(retries)
|
|
8
|
+
: retries;
|
|
9
|
+
let totalAttempts = requestedRetries + 1;
|
|
10
|
+
if (totalAttempts < 0) {
|
|
11
|
+
totalAttempts = 1;
|
|
12
|
+
}
|
|
13
|
+
let retryCount = 0;
|
|
14
|
+
while (totalAttempts-- > 0) {
|
|
15
|
+
try {
|
|
16
|
+
await logic();
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
if (totalAttempts > 0) {
|
|
20
|
+
if (onTransientError) {
|
|
21
|
+
onTransientError(e);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
console.log(chalk.red(`Error: ${e.message || e.toString()}`));
|
|
25
|
+
}
|
|
26
|
+
console.log(chalk.green(`Retrying (${++retryCount} / ${retries})`));
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
if (retries < 1) {
|
|
30
|
+
if (onFinalFailure) {
|
|
31
|
+
await onFinalFailure();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.log(chalk.magentaBright(`Failed after ${totalAttempts} attempts`));
|
|
35
|
+
if (typeof retries === "string") {
|
|
36
|
+
if (process.env[retries] === undefined) {
|
|
37
|
+
console.info(chalk.yellow(`If the error looks transient, try setting the '${retries}' environment variable.`));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
console.info(chalk.yellow(`If the error looks transient, try setting the '${retries}' environment variable to a larger value (currently: ${process.env[retries]})`));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
throw e;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
module.exports = tryDo;
|
|
51
|
+
})();
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
const
|
|
3
|
+
env = requireModule<Env>("env"),
|
|
4
|
+
chalk = require("ansi-colors");
|
|
5
|
+
|
|
6
|
+
async function tryDo(
|
|
7
|
+
logic: AsyncVoidVoid,
|
|
8
|
+
retries: number | string,
|
|
9
|
+
onTransientError: ErrorReporter,
|
|
10
|
+
onFinalFailure: VoidVoid
|
|
11
|
+
): Promise<void> {
|
|
12
|
+
// always attempt at least once
|
|
13
|
+
const requestedRetries = typeof retries === "string"
|
|
14
|
+
? env.resolveNumber(retries)
|
|
15
|
+
: retries;
|
|
16
|
+
let totalAttempts = requestedRetries + 1;
|
|
17
|
+
if (totalAttempts < 0) {
|
|
18
|
+
totalAttempts = 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let retryCount = 0;
|
|
22
|
+
|
|
23
|
+
while (totalAttempts-- > 0) {
|
|
24
|
+
try {
|
|
25
|
+
await logic();
|
|
26
|
+
} catch (e) {
|
|
27
|
+
if (totalAttempts > 0) {
|
|
28
|
+
if (onTransientError) {
|
|
29
|
+
onTransientError(e)
|
|
30
|
+
} else {
|
|
31
|
+
console.log(chalk.red(`Error: ${ e.message || e.toString() }`));
|
|
32
|
+
}
|
|
33
|
+
console.log(chalk.green(`Retrying (${ ++retryCount } / ${ retries })`));
|
|
34
|
+
} else {
|
|
35
|
+
if (retries < 1) {
|
|
36
|
+
if (onFinalFailure) {
|
|
37
|
+
await onFinalFailure()
|
|
38
|
+
} else {
|
|
39
|
+
console.log(chalk.magentaBright(`Failed after ${ totalAttempts } attempts`));
|
|
40
|
+
if (typeof retries === "string") {
|
|
41
|
+
if (process.env[retries] === undefined) {
|
|
42
|
+
console.info(chalk.yellow(`If the error looks transient, try setting the '${retries}' environment variable.`));
|
|
43
|
+
} else {
|
|
44
|
+
console.info(chalk.yellow(`If the error looks transient, try setting the '${retries}' environment variable to a larger value (currently: ${process.env[retries]})`));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
throw e;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
module.exports = tryDo;
|
|
56
|
+
})();
|