@muverse/core 0.1.11 → 0.1.13
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,EAAU,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,EAAU,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAiB9F;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAoDlG;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,kBAAkB,EAAE,qBAAqB,GAAG,kBAAkB,CAuCnG"}
|
|
@@ -3,6 +3,7 @@ import { createInitialVersion, parseSemVer } from '../../semver/index.js';
|
|
|
3
3
|
import { exists } from '../../utils/file.js';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
import { execa } from 'execa';
|
|
6
|
+
import fs from 'fs/promises';
|
|
6
7
|
/**
|
|
7
8
|
* Name of the Gradle wrapper script file.
|
|
8
9
|
* Ensures consistent builds without requiring pre-installed Gradle.
|
|
@@ -47,8 +48,17 @@ export async function getRawProjectInformation(projectRoot) {
|
|
|
47
48
|
if (result.exitCode !== 0) {
|
|
48
49
|
throw new Error(`Gradle command failed with exit code ${result.exitCode}: ${result.stderr}`);
|
|
49
50
|
}
|
|
51
|
+
const file = join(projectRoot, 'build', 'project-information.json');
|
|
52
|
+
// Verify that the output file was created
|
|
53
|
+
const fileExists = await exists(file);
|
|
54
|
+
if (!fileExists) {
|
|
55
|
+
throw new Error(`Expected output file not found at ${file}. ` +
|
|
56
|
+
`Ensure that the Gradle init script is correctly generating the project information.`);
|
|
57
|
+
}
|
|
58
|
+
// Read the output file content
|
|
59
|
+
const projectInformation = await fs.readFile(file, 'utf-8');
|
|
50
60
|
// Parse JSON output from Gradle
|
|
51
|
-
return JSON.parse(
|
|
61
|
+
return JSON.parse(projectInformation.trim() || '{}');
|
|
52
62
|
}
|
|
53
63
|
/**
|
|
54
64
|
* Transforms raw project information into structured, queryable format.
|
|
@@ -25,6 +25,7 @@ gradle.rootProject {
|
|
|
25
25
|
tasks.register("printProjectInformation") {
|
|
26
26
|
group = "help"
|
|
27
27
|
description = "Shows which subprojects are affected by changes (hierarchy + direct dependencies)."
|
|
28
|
+
notCompatibleWithConfigurationCache("uses project information at configuration time")
|
|
28
29
|
|
|
29
30
|
// Capture hierarchy data at configuration time
|
|
30
31
|
val hierarchyDepsProvider = provider {
|
|
@@ -58,7 +59,7 @@ gradle.rootProject {
|
|
|
58
59
|
// Check regular dependencies
|
|
59
60
|
config.dependencies.forEach { dep ->
|
|
60
61
|
if (dep is ProjectDependency) {
|
|
61
|
-
directDeps.add(dep.
|
|
62
|
+
directDeps.add(dep.path)
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
|
|
@@ -83,7 +84,7 @@ gradle.rootProject {
|
|
|
83
84
|
|
|
84
85
|
gradle.rootProject.allprojects.forEach { project ->
|
|
85
86
|
val relativePath = gradle.rootProject.projectDir.toPath().relativize(project.projectDir.toPath()).toString()
|
|
86
|
-
val path =
|
|
87
|
+
val path = relativePath.ifEmpty { "." }
|
|
87
88
|
val version = if (project.version == "unspecified") null else project.version
|
|
88
89
|
val type = if (project == gradle.rootProject) "root" else "module"
|
|
89
90
|
val versionProperty = project.qualifiedVersionProperty()
|
|
@@ -96,7 +97,7 @@ gradle.rootProject {
|
|
|
96
97
|
"version" to version,
|
|
97
98
|
"type" to type,
|
|
98
99
|
"name" to project.name,
|
|
99
|
-
"declaredVersion" to (versionFromProperty != null)
|
|
100
|
+
"declaredVersion" to (versionFromProperty != null),
|
|
100
101
|
"versionProperty" to versionProperty
|
|
101
102
|
)
|
|
102
103
|
}
|
|
@@ -129,7 +130,7 @@ gradle.rootProject {
|
|
|
129
130
|
"version" to projectInfo["version"],
|
|
130
131
|
"type" to projectInfo["type"],
|
|
131
132
|
"name" to projectInfo["name"],
|
|
132
|
-
"declaredVersion" to projectInfo["declaredVersion"]
|
|
133
|
+
"declaredVersion" to projectInfo["declaredVersion"],
|
|
133
134
|
"versionProperty" to projectInfo["versionProperty"]
|
|
134
135
|
)
|
|
135
136
|
}
|
|
@@ -138,7 +139,17 @@ gradle.rootProject {
|
|
|
138
139
|
.excludeNulls()
|
|
139
140
|
.build()
|
|
140
141
|
|
|
141
|
-
|
|
142
|
+
val json = JsonOutput.prettyPrint(generator.toJson(result))
|
|
143
|
+
|
|
144
|
+
// Get output path from project property or use default
|
|
145
|
+
val outputPath = project.findProperty("projectInfoOutput") as? String
|
|
146
|
+
?: "${layout.buildDirectory.asFile.get().path}/project-information.json"
|
|
147
|
+
|
|
148
|
+
val outputFile = file(outputPath)
|
|
149
|
+
outputFile.parentFile.mkdirs()
|
|
150
|
+
outputFile.writeText(json)
|
|
151
|
+
|
|
152
|
+
println("Project information written to: ${outputFile.absolutePath}")
|
|
142
153
|
}
|
|
143
154
|
}
|
|
144
155
|
|