@nx/gradle 22.6.2 → 22.6.4
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/batch-runner/build/nx/gradle-batch-runner.json +1 -1
- package/package.json +3 -3
- package/project-graph/build/nx/gradle-project-graph.json +1 -1
- package/src/plugin/utils/get-project-graph-lines.d.ts.map +1 -1
- package/src/plugin/utils/get-project-graph-lines.js +2 -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 -103
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-project-graph-lines.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/plugin/utils/get-project-graph-lines.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-project-graph-lines.d.ts","sourceRoot":"","sources":["../../../../../../packages/gradle/src/plugin/utils/get-project-graph-lines.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAI9D,wBAAgB,iBAAiB,IAAI,MAAM,CAS1C;AAED,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,mBAAmB,EAAE,mBAAmB,GACvC,OAAO,CAAC,MAAM,EAAE,CAAC,CAoGnB"}
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getGraphTimeoutMs = getGraphTimeoutMs;
|
|
4
4
|
exports.getNxProjectGraphLines = getNxProjectGraphLines;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
6
7
|
const exec_gradle_1 = require("../../utils/exec-gradle");
|
|
7
|
-
const DEFAULT_GRAPH_TIMEOUT_SECONDS =
|
|
8
|
+
const DEFAULT_GRAPH_TIMEOUT_SECONDS = (0, devkit_internals_1.isCI)() ? 600 : 120;
|
|
8
9
|
function getGraphTimeoutMs() {
|
|
9
10
|
const envTimeout = process.env.NX_GRADLE_PROJECT_GRAPH_TIMEOUT;
|
|
10
11
|
if (envTimeout) {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"publish-maven.d.ts","sourceRoot":"","sources":["../../../../packages/gradle/project-graph/publish-maven.ts"],"names":[],"mappings":""}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const axios_1 = require("axios");
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
const FormData = require("form-data");
|
|
6
|
-
function parseArgs() {
|
|
7
|
-
const args = process.argv.slice(2);
|
|
8
|
-
const result = {};
|
|
9
|
-
args.forEach((arg) => {
|
|
10
|
-
const [key, value] = arg.replace(/^--/, '').split('=');
|
|
11
|
-
result[key] = value;
|
|
12
|
-
});
|
|
13
|
-
return result;
|
|
14
|
-
}
|
|
15
|
-
async function publishToMavenApi(username, password, deploymentZipPath = 'deployment.zip') {
|
|
16
|
-
const token = Buffer.from(`${username}:${password}`).toString('base64');
|
|
17
|
-
console.log(`📦 Publishing to Maven Central...`);
|
|
18
|
-
const url = 'https://central.sonatype.com/api/v1/publisher/upload';
|
|
19
|
-
const form = new FormData();
|
|
20
|
-
form.append('bundle', fs.createReadStream(deploymentZipPath));
|
|
21
|
-
let uploadId;
|
|
22
|
-
try {
|
|
23
|
-
const response = await axios_1.default.post(url, form, {
|
|
24
|
-
headers: {
|
|
25
|
-
Authorization: `Basic ${token}`,
|
|
26
|
-
...form.getHeaders(),
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
uploadId = response.data.toString().trim();
|
|
30
|
-
console.log(`✅ Upload ID: ${uploadId}`);
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
console.error('🚫 Upload failed:', err.response?.data || err.message);
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
let currentStatus = await getUploadStatus(uploadId, token);
|
|
37
|
-
if (['PENDING', 'VALIDATING', 'PUBLISHING'].includes(currentStatus)) {
|
|
38
|
-
currentStatus = await retryUntilValidatedOrPublished(currentStatus, uploadId, token);
|
|
39
|
-
}
|
|
40
|
-
if (!['VALIDATED', 'PUBLISHED'].includes(currentStatus)) {
|
|
41
|
-
console.error(`🚫 Upload failed with final status: ${currentStatus}`);
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
44
|
-
console.log(`📦 Upload is ${currentStatus}, proceeding to deploy...`);
|
|
45
|
-
if (currentStatus === 'PUBLISHED') {
|
|
46
|
-
console.log('✅ Already published, skipping deployment.');
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const deployUrl = `https://central.sonatype.com/api/v1/publisher/deployment/${uploadId}`;
|
|
50
|
-
try {
|
|
51
|
-
const deployRes = await axios_1.default.post(deployUrl, null, {
|
|
52
|
-
headers: { Authorization: `Basic ${token}` },
|
|
53
|
-
});
|
|
54
|
-
console.log(`🚀 Deployment response: ${deployRes.data}`);
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
console.error('🚫 Deployment failed:', err.response?.data || err.message);
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
async function getUploadStatus(uploadId, token) {
|
|
62
|
-
const url = `https://central.sonatype.com/api/v1/publisher/status?id=${uploadId}`;
|
|
63
|
-
try {
|
|
64
|
-
const response = await axios_1.default.post(url, null, {
|
|
65
|
-
headers: { Authorization: `Basic ${token}` },
|
|
66
|
-
});
|
|
67
|
-
const state = response.data.deploymentState;
|
|
68
|
-
console.log(`📡 Current deployment state: ${state}`);
|
|
69
|
-
return state;
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
console.error('🚫 Failed to get status:', err.response?.data || err.message);
|
|
73
|
-
return 'FAILED';
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
async function retryUntilValidatedOrPublished(currentStatus, uploadId, token, retries = 10, delay = 10_000) {
|
|
77
|
-
for (let i = 0; i < retries; i++) {
|
|
78
|
-
console.log(`🔁 Checking status (attempt ${i + 1}/${retries})...`);
|
|
79
|
-
await sleep(delay);
|
|
80
|
-
currentStatus = await getUploadStatus(uploadId, token);
|
|
81
|
-
if (['VALIDATED', 'PUBLISHED', 'FAILED'].includes(currentStatus))
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
return currentStatus;
|
|
85
|
-
}
|
|
86
|
-
function sleep(ms) {
|
|
87
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
88
|
-
}
|
|
89
|
-
// Entry
|
|
90
|
-
(async function main() {
|
|
91
|
-
let { username, password, deploymentZipPath } = parseArgs();
|
|
92
|
-
username = username || process.env.MAVEN_USERNAME;
|
|
93
|
-
password = password || process.env.MAVEN_PASSWORD;
|
|
94
|
-
if (!username || !password) {
|
|
95
|
-
console.error('❌ Missing MAVEN_USERNAME or MAVEN_PASSWORD');
|
|
96
|
-
process.exit(1);
|
|
97
|
-
}
|
|
98
|
-
if (!deploymentZipPath) {
|
|
99
|
-
console.error('❌ Missing required --deploymentZipPath argument');
|
|
100
|
-
process.exit(1);
|
|
101
|
-
}
|
|
102
|
-
await publishToMavenApi(username, password, deploymentZipPath);
|
|
103
|
-
})();
|