@nx/gradle 22.7.0-beta.7 → 22.7.0-beta.8
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/batch-runner/build/libs/gradle-batch-runner-all.jar +0 -0
- package/batch-runner/build/libs/gradle-batch-runner.jar +0 -0
- package/package.json +3 -3
- package/src/executors/gradle/get-exclude-task.d.ts +6 -6
- package/src/executors/gradle/get-exclude-task.d.ts.map +1 -1
- package/src/executors/gradle/get-exclude-task.js +41 -36
- package/src/executors/gradle/gradle-batch.impl.d.ts.map +1 -1
- package/src/executors/gradle/gradle-batch.impl.js +24 -20
- package/src/executors/gradle/gradle.impl.js +1 -1
- package/project-graph/publish-maven.d.ts +0 -2
- package/project-graph/publish-maven.d.ts.map +0 -1
- package/project-graph/publish-maven.js +0 -104
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/gradle",
|
|
3
|
-
"version": "22.7.0-beta.
|
|
3
|
+
"version": "22.7.0-beta.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Gradle allows Gradle tasks to be run through Nx",
|
|
6
6
|
"repository": {
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"migrations": "./migrations.json"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@nx/devkit": "22.7.0-beta.
|
|
43
|
+
"@nx/devkit": "22.7.0-beta.8",
|
|
44
44
|
"toml-eslint-parser": "^0.10.0",
|
|
45
45
|
"tslib": "^2.3.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"nx": "22.7.0-beta.
|
|
48
|
+
"nx": "22.7.0-beta.8"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProjectGraphProjectNode } from 'nx/
|
|
1
|
+
import { ProjectGraphProjectNode, Target } from '@nx/devkit';
|
|
2
2
|
/**
|
|
3
3
|
* Returns Gradle CLI arguments to exclude dependent tasks
|
|
4
4
|
* that are not part of the current execution set.
|
|
@@ -6,13 +6,13 @@ import { ProjectGraphProjectNode } from 'nx/src/config/project-graph';
|
|
|
6
6
|
* For example, if a project defines `dependsOn: ['lint']` for the `test` target,
|
|
7
7
|
* and only `test` is running, this will return: ['lint']
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
9
|
+
* @param tasks - Set of Target to process
|
|
10
10
|
* @param nodes - Project graph nodes
|
|
11
|
-
* @param
|
|
11
|
+
* @param runningTasks - Set of Target that are currently running (won't be excluded)
|
|
12
12
|
* @param includeDependsOnTasks - Set of Gradle task names that should be included (not excluded)
|
|
13
13
|
* (typically provider-based dependencies that Gradle must resolve)
|
|
14
14
|
*/
|
|
15
|
-
export declare function getExcludeTasks(
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function getAllDependsOn(nodes: Record<string, ProjectGraphProjectNode>, projectName: string, targetName: string): Set<
|
|
15
|
+
export declare function getExcludeTasks(tasks: Set<Target>, nodes: Record<string, ProjectGraphProjectNode>, runningTasks?: Set<Target>, includeDependsOnTasks?: Set<string>): Set<string>;
|
|
16
|
+
export declare function getGradleTaskName(pt: Target, nodes: Record<string, ProjectGraphProjectNode>): string | null;
|
|
17
|
+
export declare function getAllDependsOn(nodes: Record<string, ProjectGraphProjectNode>, projectName: string, targetName: string): Set<Target>;
|
|
18
18
|
//# sourceMappingURL=get-exclude-task.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-exclude-task.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/executors/gradle/get-exclude-task.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"get-exclude-task.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/executors/gradle/get-exclude-task.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,MAAM,EAEP,MAAM,YAAY,CAAC;AA+BpB;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,EAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,EAC9C,YAAY,GAAE,GAAG,CAAC,MAAM,CAAa,EACrC,qBAAqB,GAAE,GAAG,CAAC,MAAM,CAAa,GAC7C,GAAG,CAAC,MAAM,CAAC,CAsBb;AAED,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,GAC7C,MAAM,GAAG,IAAI,CAEf;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,EAC9C,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,GAAG,CAAC,MAAM,CAAC,CAgCb"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getExcludeTasks = getExcludeTasks;
|
|
4
|
-
exports.
|
|
4
|
+
exports.getGradleTaskName = getGradleTaskName;
|
|
5
5
|
exports.getAllDependsOn = getAllDependsOn;
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
7
|
/**
|
|
7
|
-
* Resolves a dependsOn entry to
|
|
8
|
-
* Handles both string format ("
|
|
8
|
+
* Resolves a dependsOn entry to a Target.
|
|
9
|
+
* Handles both string format ("target") and object format
|
|
9
10
|
* ({ target: "name", projects?: ["proj1"] }).
|
|
10
11
|
* For same-project object deps (no projects field), uses the owning project name.
|
|
11
12
|
*/
|
|
12
|
-
function
|
|
13
|
+
function resolveDepToTarget(dep, owningProject) {
|
|
13
14
|
if (typeof dep === 'string') {
|
|
14
|
-
return dep;
|
|
15
|
+
return { project: owningProject, target: dep };
|
|
15
16
|
}
|
|
16
17
|
const target = dep?.target;
|
|
17
18
|
if (!target) {
|
|
@@ -21,13 +22,12 @@ function resolveDepToTaskId(dep, owningProject) {
|
|
|
21
22
|
const projectList = Array.isArray(dep.projects)
|
|
22
23
|
? dep.projects
|
|
23
24
|
: [dep.projects];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
return {
|
|
26
|
+
project: projectList[0] !== 'self' ? projectList[0] : owningProject,
|
|
27
|
+
target,
|
|
28
|
+
};
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
return `${owningProject}:${target}`;
|
|
30
|
+
return { project: owningProject, target };
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Returns Gradle CLI arguments to exclude dependent tasks
|
|
@@ -36,21 +36,21 @@ function resolveDepToTaskId(dep, owningProject) {
|
|
|
36
36
|
* For example, if a project defines `dependsOn: ['lint']` for the `test` target,
|
|
37
37
|
* and only `test` is running, this will return: ['lint']
|
|
38
38
|
*
|
|
39
|
-
* @param
|
|
39
|
+
* @param tasks - Set of Target to process
|
|
40
40
|
* @param nodes - Project graph nodes
|
|
41
|
-
* @param
|
|
41
|
+
* @param runningTasks - Set of Target that are currently running (won't be excluded)
|
|
42
42
|
* @param includeDependsOnTasks - Set of Gradle task names that should be included (not excluded)
|
|
43
43
|
* (typically provider-based dependencies that Gradle must resolve)
|
|
44
44
|
*/
|
|
45
|
-
function getExcludeTasks(
|
|
45
|
+
function getExcludeTasks(tasks, nodes, runningTasks = new Set(), includeDependsOnTasks = new Set()) {
|
|
46
46
|
const excludes = new Set();
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const taskDeps = nodes[project]?.data?.targets?.[target]?.dependsOn ?? [];
|
|
47
|
+
const runningKeys = new Set(Array.from(runningTasks).map(devkit_1.targetToTargetString));
|
|
48
|
+
for (const task of tasks) {
|
|
49
|
+
const taskDeps = nodes[task.project]?.data?.targets?.[task.target]?.dependsOn ?? [];
|
|
50
50
|
for (const dep of taskDeps) {
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
-
const gradleTaskName =
|
|
51
|
+
const depPt = resolveDepToTarget(dep, task.project);
|
|
52
|
+
if (depPt && !runningKeys.has((0, devkit_1.targetToTargetString)(depPt))) {
|
|
53
|
+
const gradleTaskName = getGradleTaskName(depPt, nodes);
|
|
54
54
|
if (gradleTaskName && !includeDependsOnTasks.has(gradleTaskName)) {
|
|
55
55
|
excludes.add(gradleTaskName);
|
|
56
56
|
}
|
|
@@ -59,29 +59,34 @@ function getExcludeTasks(taskIds, nodes, runningTaskIds = new Set(), includeDepe
|
|
|
59
59
|
}
|
|
60
60
|
return excludes;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
const gradleTaskName = nodes[projectName]?.data?.targets?.[targetName]?.options?.taskName;
|
|
65
|
-
return gradleTaskName;
|
|
62
|
+
function getGradleTaskName(pt, nodes) {
|
|
63
|
+
return nodes[pt.project]?.data?.targets?.[pt.target]?.options?.taskName;
|
|
66
64
|
}
|
|
67
65
|
function getAllDependsOn(nodes, projectName, targetName) {
|
|
68
66
|
const allDependsOn = new Set();
|
|
69
|
-
const
|
|
67
|
+
const result = new Set();
|
|
68
|
+
const startKey = (0, devkit_1.targetToTargetString)({
|
|
69
|
+
project: projectName,
|
|
70
|
+
target: targetName,
|
|
71
|
+
});
|
|
72
|
+
const stack = [{ project: projectName, target: targetName }];
|
|
70
73
|
while (stack.length > 0) {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
const current = stack.pop();
|
|
75
|
+
const key = (0, devkit_1.targetToTargetString)(current);
|
|
76
|
+
if (!allDependsOn.has(key)) {
|
|
77
|
+
allDependsOn.add(key);
|
|
78
|
+
if (key !== startKey) {
|
|
79
|
+
result.add(current);
|
|
80
|
+
}
|
|
81
|
+
const directDependencies = nodes[current.project]?.data?.targets?.[current.target]?.dependsOn ??
|
|
82
|
+
[];
|
|
77
83
|
for (const dep of directDependencies) {
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
stack.push(
|
|
84
|
+
const depPt = resolveDepToTarget(dep, current.project);
|
|
85
|
+
if (depPt && !allDependsOn.has((0, devkit_1.targetToTargetString)(depPt))) {
|
|
86
|
+
stack.push(depPt);
|
|
81
87
|
}
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
}
|
|
85
|
-
|
|
86
|
-
return allDependsOn;
|
|
91
|
+
return result;
|
|
87
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradle-batch.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/executors/gradle/gradle-batch.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,uBAAuB,
|
|
1
|
+
{"version":3,"file":"gradle-batch.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/executors/gradle/gradle-batch.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,uBAAuB,EAEvB,SAAS,EAEV,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,kBAAkB,EACnB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAchD,eAAO,MAAM,eAAe,QAG3B,CAAC;AAEF,wBAA8B,WAAW,CACvC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAC5C,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,YAAY,CAAC,CAkEvB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EAAE,EACjB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC;;;;EAuE/C"}
|
|
@@ -56,49 +56,53 @@ async function gradleBatch(taskGraph, inputs, overrides, context) {
|
|
|
56
56
|
* Get the gradlew task ids to run
|
|
57
57
|
*/
|
|
58
58
|
function getGradlewTasksToRun(taskIds, taskGraph, inputs, nodes) {
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const
|
|
59
|
+
const tasksWithExclude = new Set();
|
|
60
|
+
const testTasksWithExclude = new Set();
|
|
61
|
+
const tasksWithoutExclude = new Set();
|
|
62
62
|
const gradlewTasksToRun = {};
|
|
63
63
|
const includeDependsOnTasks = new Set();
|
|
64
64
|
for (const taskId of taskIds) {
|
|
65
65
|
const task = taskGraph.tasks[taskId];
|
|
66
66
|
const input = inputs[task.id];
|
|
67
|
+
const taskTarget = {
|
|
68
|
+
project: task.target.project,
|
|
69
|
+
target: task.target.target,
|
|
70
|
+
};
|
|
67
71
|
gradlewTasksToRun[taskId] = input;
|
|
68
|
-
// Collect tasks that should be included (not excluded) - typically provider-based dependencies
|
|
69
72
|
if (input.includeDependsOnTasks) {
|
|
70
|
-
for (const
|
|
71
|
-
includeDependsOnTasks.add(
|
|
73
|
+
for (const t of input.includeDependsOnTasks) {
|
|
74
|
+
includeDependsOnTasks.add(t);
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
if (input.excludeDependsOn) {
|
|
75
78
|
if (input.testClassName) {
|
|
76
|
-
|
|
79
|
+
testTasksWithExclude.add(taskTarget);
|
|
77
80
|
}
|
|
78
81
|
else {
|
|
79
|
-
|
|
82
|
+
tasksWithExclude.add(taskTarget);
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
85
|
else {
|
|
83
|
-
|
|
86
|
+
tasksWithoutExclude.add(taskTarget);
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
const allRunning = new Set(taskIds.map((id) => ({
|
|
90
|
+
project: taskGraph.tasks[id].target.project,
|
|
91
|
+
target: taskGraph.tasks[id].target.target,
|
|
92
|
+
})));
|
|
93
|
+
for (const task of tasksWithoutExclude) {
|
|
94
|
+
const dependencies = (0, get_exclude_task_1.getAllDependsOn)(nodes, task.project, task.target);
|
|
95
|
+
dependencies.forEach((dep) => allRunning.add(dep));
|
|
91
96
|
}
|
|
92
|
-
const excludeTasks = (0, get_exclude_task_1.getExcludeTasks)(
|
|
97
|
+
const excludeTasks = (0, get_exclude_task_1.getExcludeTasks)(tasksWithExclude, nodes, allRunning, includeDependsOnTasks);
|
|
93
98
|
const allTestsDependsOn = new Set();
|
|
94
|
-
for (const
|
|
95
|
-
const
|
|
96
|
-
const taskDependsOn = (0, get_exclude_task_1.getAllDependsOn)(nodes, projectName, targetName);
|
|
99
|
+
for (const task of testTasksWithExclude) {
|
|
100
|
+
const taskDependsOn = (0, get_exclude_task_1.getAllDependsOn)(nodes, task.project, task.target);
|
|
97
101
|
taskDependsOn.forEach((dep) => allTestsDependsOn.add(dep));
|
|
98
102
|
}
|
|
99
103
|
const excludeTestTasks = new Set();
|
|
100
|
-
for (
|
|
101
|
-
const gradleTaskName = (0, get_exclude_task_1.
|
|
104
|
+
for (const task of allTestsDependsOn) {
|
|
105
|
+
const gradleTaskName = (0, get_exclude_task_1.getGradleTaskName)(task, nodes);
|
|
102
106
|
if (gradleTaskName) {
|
|
103
107
|
excludeTestTasks.add(gradleTaskName);
|
|
104
108
|
}
|
|
@@ -46,7 +46,7 @@ async function gradleExecutor(options, context) {
|
|
|
46
46
|
});
|
|
47
47
|
if (options.excludeDependsOn) {
|
|
48
48
|
const includeDependsOnTasks = new Set(options.includeDependsOnTasks ?? []);
|
|
49
|
-
(0, get_exclude_task_1.getExcludeTasks)(new Set([
|
|
49
|
+
(0, get_exclude_task_1.getExcludeTasks)(new Set([{ project: context.projectName, target: context.targetName }]), context.projectGraph.nodes, new Set(), includeDependsOnTasks).forEach((task) => {
|
|
50
50
|
if (task) {
|
|
51
51
|
args.push('--exclude-task', task);
|
|
52
52
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"publish-maven.d.ts","sourceRoot":"","sources":["../../../../packages/gradle/project-graph/publish-maven.ts"],"names":[],"mappings":""}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
5
|
-
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
-
const form_data_1 = tslib_1.__importDefault(require("form-data"));
|
|
7
|
-
function parseArgs() {
|
|
8
|
-
const args = process.argv.slice(2);
|
|
9
|
-
const result = {};
|
|
10
|
-
args.forEach((arg) => {
|
|
11
|
-
const [key, value] = arg.replace(/^--/, '').split('=');
|
|
12
|
-
result[key] = value;
|
|
13
|
-
});
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
async function publishToMavenApi(username, password, deploymentZipPath = 'deployment.zip') {
|
|
17
|
-
const token = Buffer.from(`${username}:${password}`).toString('base64');
|
|
18
|
-
console.log(`📦 Publishing to Maven Central...`);
|
|
19
|
-
const url = 'https://central.sonatype.com/api/v1/publisher/upload';
|
|
20
|
-
const form = new form_data_1.default();
|
|
21
|
-
form.append('bundle', fs.createReadStream(deploymentZipPath));
|
|
22
|
-
let uploadId;
|
|
23
|
-
try {
|
|
24
|
-
const response = await axios_1.default.post(url, form, {
|
|
25
|
-
headers: {
|
|
26
|
-
Authorization: `Basic ${token}`,
|
|
27
|
-
...form.getHeaders(),
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
uploadId = response.data.toString().trim();
|
|
31
|
-
console.log(`✅ Upload ID: ${uploadId}`);
|
|
32
|
-
}
|
|
33
|
-
catch (err) {
|
|
34
|
-
console.error('🚫 Upload failed:', err.response?.data || err.message);
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
let currentStatus = await getUploadStatus(uploadId, token);
|
|
38
|
-
if (['PENDING', 'VALIDATING', 'PUBLISHING'].includes(currentStatus)) {
|
|
39
|
-
currentStatus = await retryUntilValidatedOrPublished(currentStatus, uploadId, token);
|
|
40
|
-
}
|
|
41
|
-
if (!['VALIDATED', 'PUBLISHED'].includes(currentStatus)) {
|
|
42
|
-
console.error(`🚫 Upload failed with final status: ${currentStatus}`);
|
|
43
|
-
process.exit(1);
|
|
44
|
-
}
|
|
45
|
-
console.log(`📦 Upload is ${currentStatus}, proceeding to deploy...`);
|
|
46
|
-
if (currentStatus === 'PUBLISHED') {
|
|
47
|
-
console.log('✅ Already published, skipping deployment.');
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const deployUrl = `https://central.sonatype.com/api/v1/publisher/deployment/${uploadId}`;
|
|
51
|
-
try {
|
|
52
|
-
const deployRes = await axios_1.default.post(deployUrl, null, {
|
|
53
|
-
headers: { Authorization: `Basic ${token}` },
|
|
54
|
-
});
|
|
55
|
-
console.log(`🚀 Deployment response: ${deployRes.data}`);
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
console.error('🚫 Deployment failed:', err.response?.data || err.message);
|
|
59
|
-
process.exit(1);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async function getUploadStatus(uploadId, token) {
|
|
63
|
-
const url = `https://central.sonatype.com/api/v1/publisher/status?id=${uploadId}`;
|
|
64
|
-
try {
|
|
65
|
-
const response = await axios_1.default.post(url, null, {
|
|
66
|
-
headers: { Authorization: `Basic ${token}` },
|
|
67
|
-
});
|
|
68
|
-
const state = response.data.deploymentState;
|
|
69
|
-
console.log(`📡 Current deployment state: ${state}`);
|
|
70
|
-
return state;
|
|
71
|
-
}
|
|
72
|
-
catch (err) {
|
|
73
|
-
console.error('🚫 Failed to get status:', err.response?.data || err.message);
|
|
74
|
-
return 'FAILED';
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
async function retryUntilValidatedOrPublished(currentStatus, uploadId, token, retries = 10, delay = 10_000) {
|
|
78
|
-
for (let i = 0; i < retries; i++) {
|
|
79
|
-
console.log(`🔁 Checking status (attempt ${i + 1}/${retries})...`);
|
|
80
|
-
await sleep(delay);
|
|
81
|
-
currentStatus = await getUploadStatus(uploadId, token);
|
|
82
|
-
if (['VALIDATED', 'PUBLISHED', 'FAILED'].includes(currentStatus))
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
return currentStatus;
|
|
86
|
-
}
|
|
87
|
-
function sleep(ms) {
|
|
88
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
89
|
-
}
|
|
90
|
-
// Entry
|
|
91
|
-
(async function main() {
|
|
92
|
-
let { username, password, deploymentZipPath } = parseArgs();
|
|
93
|
-
username = username || process.env.MAVEN_USERNAME;
|
|
94
|
-
password = password || process.env.MAVEN_PASSWORD;
|
|
95
|
-
if (!username || !password) {
|
|
96
|
-
console.error('❌ Missing MAVEN_USERNAME or MAVEN_PASSWORD');
|
|
97
|
-
process.exit(1);
|
|
98
|
-
}
|
|
99
|
-
if (!deploymentZipPath) {
|
|
100
|
-
console.error('❌ Missing required --deploymentZipPath argument');
|
|
101
|
-
process.exit(1);
|
|
102
|
-
}
|
|
103
|
-
await publishToMavenApi(username, password, deploymentZipPath);
|
|
104
|
-
})();
|