@muverse/core 0.2.3 → 0.2.5
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradle-project-information.d.ts","sourceRoot":"","sources":["../../../src/adapters/gradle/gradle-project-information.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"gradle-project-information.d.ts","sourceRoot":"","sources":["../../../src/adapters/gradle/gradle-project-information.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AA4H1G;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAqEtH;AA2CD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,kBAAkB,EAAE,qBAAqB,GAAG,kBAAkB,CA6CnG"}
|
|
@@ -7,6 +7,7 @@ import fs from 'fs/promises';
|
|
|
7
7
|
import crypto from 'crypto';
|
|
8
8
|
import fg from 'fast-glob';
|
|
9
9
|
import { parseProperties } from '../../utils/properties.js';
|
|
10
|
+
import { logger } from '../../utils/logger.js';
|
|
10
11
|
/**
|
|
11
12
|
* Name of the Gradle wrapper script file.
|
|
12
13
|
* Ensures consistent builds without requiring pre-installed Gradle.
|
|
@@ -21,7 +22,7 @@ const GRADLE_INIT_SCRIPT = './init-project-information.gradle.kts';
|
|
|
21
22
|
* Finds all Gradle build files recursively under the project root.
|
|
22
23
|
* Searches for settings.gradle, settings.gradle.kts, build.gradle, and build.gradle.kts files.
|
|
23
24
|
* @param projectRoot - Absolute path to the Gradle project root directory
|
|
24
|
-
* @returns Promise resolving to array of
|
|
25
|
+
* @returns Promise resolving to array of relative paths to Gradle build files
|
|
25
26
|
*/
|
|
26
27
|
async function findGradleFiles(projectRoot) {
|
|
27
28
|
const patterns = [
|
|
@@ -32,7 +33,7 @@ async function findGradleFiles(projectRoot) {
|
|
|
32
33
|
];
|
|
33
34
|
const files = await fg(patterns, {
|
|
34
35
|
cwd: projectRoot,
|
|
35
|
-
absolute:
|
|
36
|
+
absolute: false,
|
|
36
37
|
ignore: ['**/node_modules/**', '**/build/**', '**/.gradle/**']
|
|
37
38
|
});
|
|
38
39
|
// Sort for consistent ordering
|
|
@@ -48,7 +49,7 @@ async function computeGradleFilesHash(projectRoot) {
|
|
|
48
49
|
const files = await findGradleFiles(projectRoot);
|
|
49
50
|
const hash = crypto.createHash('sha256');
|
|
50
51
|
for (const file of files) {
|
|
51
|
-
const content = await fs.readFile(file, 'utf-8');
|
|
52
|
+
const content = await fs.readFile(join(projectRoot, file), 'utf-8');
|
|
52
53
|
hash.update(file); // Include file path for uniqueness
|
|
53
54
|
hash.update(content);
|
|
54
55
|
}
|
|
@@ -62,6 +63,7 @@ async function computeGradleFilesHash(projectRoot) {
|
|
|
62
63
|
* @throws {Error} If initialization script not found or Gradle execution fails
|
|
63
64
|
*/
|
|
64
65
|
async function executeGradleScript(projectRoot, outputFile) {
|
|
66
|
+
logger.info(`⚙️ Executing Gradle to collect project information...`);
|
|
65
67
|
const gradlew = join(projectRoot, GRADLE_WRAPPER);
|
|
66
68
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
67
69
|
const initScriptPath = join(dirname, GRADLE_INIT_SCRIPT);
|
|
@@ -89,6 +91,7 @@ async function executeGradleScript(projectRoot, outputFile) {
|
|
|
89
91
|
if (result.exitCode !== 0) {
|
|
90
92
|
throw new Error(`Gradle command failed with exit code ${result.exitCode}: ${result.stderr}`);
|
|
91
93
|
}
|
|
94
|
+
logger.info(`✅ Gradle project information generated at ${outputFile}.`);
|
|
92
95
|
}
|
|
93
96
|
/**
|
|
94
97
|
* Executes Gradle to collect raw project structure information.
|
|
@@ -105,22 +108,29 @@ export async function getRawProjectInformation(projectRoot, outputFile) {
|
|
|
105
108
|
let executeScript = true;
|
|
106
109
|
// Compute hash of all Gradle build files
|
|
107
110
|
const currentHash = await computeGradleFilesHash(projectRoot);
|
|
111
|
+
logger.info(`🔍 Computed Gradle files hash: ${currentHash}`);
|
|
108
112
|
if (fileExists) {
|
|
113
|
+
logger.info(`💾 Cached project information found at ${outputFile}. Validating cache...`);
|
|
109
114
|
// Step 2: File exists, check cache validity
|
|
110
115
|
try {
|
|
111
116
|
const fileContent = await fs.readFile(outputFile, 'utf-8');
|
|
112
117
|
const cachedData = JSON.parse(fileContent);
|
|
113
118
|
// Step 2.1: Compare hashes
|
|
114
119
|
if (cachedData.hash === currentHash) {
|
|
120
|
+
logger.info(`✅ Cache is valid. Using cached project information.`);
|
|
115
121
|
// Cache hit - use cached data
|
|
116
122
|
executeScript = false;
|
|
117
123
|
data = cachedData.data;
|
|
118
124
|
}
|
|
125
|
+
else {
|
|
126
|
+
logger.info(`❌ Cache is invalid. Cached hash: ${cachedData.hash}`);
|
|
127
|
+
logger.info(`🔄 Gradle files changed, regenerating project information...`);
|
|
128
|
+
}
|
|
119
129
|
// Cache miss - hash mismatch, need to regenerate
|
|
120
130
|
}
|
|
121
131
|
catch (error) {
|
|
122
132
|
// If there's any error reading/parsing cached file, regenerate
|
|
123
|
-
|
|
133
|
+
logger.warning(`⚠️ Failed to read cached project information: ${error}`);
|
|
124
134
|
}
|
|
125
135
|
}
|
|
126
136
|
if (executeScript) {
|
|
@@ -144,8 +154,10 @@ export async function getRawProjectInformation(projectRoot, outputFile) {
|
|
|
144
154
|
};
|
|
145
155
|
// Read gradle.properites and add version
|
|
146
156
|
const projectInformation = await getInformationWithVersions(projectRoot, data);
|
|
147
|
-
|
|
148
|
-
|
|
157
|
+
if (!executeScript) {
|
|
158
|
+
// Write back to file with hash for future cache validation
|
|
159
|
+
await fs.writeFile(outputFile, JSON.stringify(cachedData, null, 2), 'utf-8');
|
|
160
|
+
}
|
|
149
161
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AAiB,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,cAAc,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACnD,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;CACnC,CAAC;AAEF,qBAAa,WAAW;IACtB,OAAO,CAAC,mBAAmB,CAAuB;IAClD,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,OAAO,CAAgB;IAG/B,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,yBAAyB,CAA4B;IAC7D,OAAO,CAAC,uBAAuB,CAA0B;gBAE7C,OAAO,EAAE,aAAa;IA0BlC,OAAO,CAAC,cAAc;IAuBtB,OAAO,CAAC,eAAe;IAgCjB,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC;YAYpB,KAAK;CAkIpB"}
|
|
@@ -56,6 +56,7 @@ export class VerseRunner {
|
|
|
56
56
|
logger.info("");
|
|
57
57
|
logger.info("🚀 Starting μVERSE engine...");
|
|
58
58
|
logger.info(`Repository: ${this.options.repoRoot}`);
|
|
59
|
+
logger.info(`Output file: ${this.options.outputFile}`);
|
|
59
60
|
logger.info(`Adapter: ${this.options.adapter || "(auto-detect)"}`);
|
|
60
61
|
logger.info(`Dry run: ${this.options.dryRun}`);
|
|
61
62
|
logger.info(`Prerelease mode: ${this.options.prereleaseMode}`);
|