@versu/plugin-gradle 0.6.0
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/dist/constants.d.ts +13 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +12 -0
- package/dist/gradle-project-information.d.ts +19 -0
- package/dist/gradle-project-information.d.ts.map +1 -0
- package/dist/gradle-project-information.js +232 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/init-project-information.gradle.kts +163 -0
- package/dist/services/gradle-adapter-identifier.d.ts +21 -0
- package/dist/services/gradle-adapter-identifier.d.ts.map +1 -0
- package/dist/services/gradle-adapter-identifier.js +43 -0
- package/dist/services/gradle-module-detector.d.ts +18 -0
- package/dist/services/gradle-module-detector.d.ts.map +1 -0
- package/dist/services/gradle-module-detector.js +28 -0
- package/dist/services/gradle-module-system-factory.d.ts +23 -0
- package/dist/services/gradle-module-system-factory.d.ts.map +1 -0
- package/dist/services/gradle-module-system-factory.js +29 -0
- package/dist/services/gradle-version-update-strategy.d.ts +22 -0
- package/dist/services/gradle-version-update-strategy.d.ts.map +1 -0
- package/dist/services/gradle-version-update-strategy.js +38 -0
- package/dist/utils/version.d.ts +4 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +5 -0
- package/package.json +69 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Standard filename for Gradle project properties file ('gradle.properties'). */
|
|
2
|
+
export declare const GRADLE_PROPERTIES_FILE = "gradle.properties";
|
|
3
|
+
/** Standard filename for Gradle build script using Groovy DSL ('build.gradle'). */
|
|
4
|
+
export declare const GRADLE_BUILD_FILE = "build.gradle";
|
|
5
|
+
/** Standard filename for Gradle build script using Kotlin DSL ('build.gradle.kts'). */
|
|
6
|
+
export declare const GRADLE_BUILD_KTS_FILE = "build.gradle.kts";
|
|
7
|
+
/** Standard filename for Gradle settings file using Groovy DSL ('settings.gradle'). */
|
|
8
|
+
export declare const GRADLE_SETTINGS_FILE = "settings.gradle";
|
|
9
|
+
/** Standard filename for Gradle settings file using Kotlin DSL ('settings.gradle.kts'). */
|
|
10
|
+
export declare const GRADLE_SETTINGS_KTS_FILE = "settings.gradle.kts";
|
|
11
|
+
/** Unique identifier for the Gradle adapter ('gradle'). */
|
|
12
|
+
export declare const GRADLE_ID = "gradle";
|
|
13
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAE1D,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,uFAAuF;AACvF,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAExD,uFAAuF;AACvF,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAEtD,2FAA2F;AAC3F,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAE9D,2DAA2D;AAC3D,eAAO,MAAM,SAAS,WAAW,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Standard filename for Gradle project properties file ('gradle.properties'). */
|
|
2
|
+
export const GRADLE_PROPERTIES_FILE = 'gradle.properties';
|
|
3
|
+
/** Standard filename for Gradle build script using Groovy DSL ('build.gradle'). */
|
|
4
|
+
export const GRADLE_BUILD_FILE = 'build.gradle';
|
|
5
|
+
/** Standard filename for Gradle build script using Kotlin DSL ('build.gradle.kts'). */
|
|
6
|
+
export const GRADLE_BUILD_KTS_FILE = 'build.gradle.kts';
|
|
7
|
+
/** Standard filename for Gradle settings file using Groovy DSL ('settings.gradle'). */
|
|
8
|
+
export const GRADLE_SETTINGS_FILE = 'settings.gradle';
|
|
9
|
+
/** Standard filename for Gradle settings file using Kotlin DSL ('settings.gradle.kts'). */
|
|
10
|
+
export const GRADLE_SETTINGS_KTS_FILE = 'settings.gradle.kts';
|
|
11
|
+
/** Unique identifier for the Gradle adapter ('gradle'). */
|
|
12
|
+
export const GRADLE_ID = 'gradle';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ProjectInformation, RawProjectInformation } from '@versu/core';
|
|
2
|
+
/**
|
|
3
|
+
* Executes Gradle to collect raw project structure information.
|
|
4
|
+
* Runs gradlew with init script to output JSON containing module hierarchy, versions, and dependencies.
|
|
5
|
+
* @param projectRoot - Absolute path to the Gradle project root directory
|
|
6
|
+
* @param outputFile - Path to output JSON file to be generated
|
|
7
|
+
* @returns Promise resolving to raw project information as JSON
|
|
8
|
+
* @throws {Error} If initialization script not found or Gradle execution fails
|
|
9
|
+
*/
|
|
10
|
+
export declare function getRawProjectInformation(projectRoot: string, outputFile: string): Promise<RawProjectInformation>;
|
|
11
|
+
/**
|
|
12
|
+
* Transforms raw project information into structured, queryable format.
|
|
13
|
+
* Normalizes modules, identifies root, parses versions, and maps dependencies.
|
|
14
|
+
* @param projectInformation - Raw project information from Gradle
|
|
15
|
+
* @returns Structured ProjectInformation with normalized data
|
|
16
|
+
* @throws {Error} If no root module found in hierarchy
|
|
17
|
+
*/
|
|
18
|
+
export declare function getProjectInformation(projectInformation: RawProjectInformation): ProjectInformation;
|
|
19
|
+
//# sourceMappingURL=gradle-project-information.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradle-project-information.d.ts","sourceRoot":"","sources":["../src/gradle-project-information.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0F,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAqHhK;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAyEtH;AA2CD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,kBAAkB,EAAE,qBAAqB,GAAG,kBAAkB,CA6CnG"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import path, { join } from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
import { execa } from 'execa';
|
|
4
|
+
import fs from 'fs/promises';
|
|
5
|
+
import crypto from 'crypto';
|
|
6
|
+
import fg from 'fast-glob';
|
|
7
|
+
import { createInitialVersion, exists, logger, parseProperties, parseSemVer } from '@versu/core';
|
|
8
|
+
/**
|
|
9
|
+
* Name of the Gradle wrapper script file.
|
|
10
|
+
* Ensures consistent builds without requiring pre-installed Gradle.
|
|
11
|
+
*/
|
|
12
|
+
const GRADLE_WRAPPER = 'gradlew';
|
|
13
|
+
/**
|
|
14
|
+
* Relative path to the Gradle initialization script within the action.
|
|
15
|
+
* Injected into Gradle to collect project structure information as JSON.
|
|
16
|
+
*/
|
|
17
|
+
const GRADLE_INIT_SCRIPT = './init-project-information.gradle.kts';
|
|
18
|
+
/**
|
|
19
|
+
* Finds all Gradle build files recursively under the project root.
|
|
20
|
+
* Searches for settings.gradle, settings.gradle.kts, build.gradle, and build.gradle.kts files.
|
|
21
|
+
* @param projectRoot - Absolute path to the Gradle project root directory
|
|
22
|
+
* @returns Promise resolving to array of relative paths to Gradle build files
|
|
23
|
+
*/
|
|
24
|
+
async function findGradleFiles(projectRoot) {
|
|
25
|
+
const patterns = [
|
|
26
|
+
'**/settings.gradle',
|
|
27
|
+
'**/settings.gradle.kts',
|
|
28
|
+
'**/build.gradle',
|
|
29
|
+
'**/build.gradle.kts'
|
|
30
|
+
];
|
|
31
|
+
const files = await fg(patterns, {
|
|
32
|
+
cwd: projectRoot,
|
|
33
|
+
absolute: false,
|
|
34
|
+
ignore: ['**/node_modules/**', '**/build/**', '**/.gradle/**']
|
|
35
|
+
});
|
|
36
|
+
// Sort for consistent ordering
|
|
37
|
+
return files.sort();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Computes SHA-256 hash of all Gradle build files.
|
|
41
|
+
* Used to detect changes in project configuration that would invalidate cached information.
|
|
42
|
+
* @param projectRoot - Absolute path to the Gradle project root directory
|
|
43
|
+
* @returns Promise resolving to hexadecimal hash string
|
|
44
|
+
*/
|
|
45
|
+
async function computeGradleFilesHash(projectRoot) {
|
|
46
|
+
const files = await findGradleFiles(projectRoot);
|
|
47
|
+
const hash = crypto.createHash('sha256');
|
|
48
|
+
for (const file of files) {
|
|
49
|
+
const content = await fs.readFile(join(projectRoot, file), 'utf-8');
|
|
50
|
+
hash.update(file); // Include file path for uniqueness
|
|
51
|
+
hash.update(content);
|
|
52
|
+
}
|
|
53
|
+
return hash.digest('hex');
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Executes the Gradle wrapper script to generate project information.
|
|
57
|
+
* Runs gradlew with initialization script to create the project-information.json file.
|
|
58
|
+
* @param projectRoot - Absolute path to the Gradle project root directory
|
|
59
|
+
* @param outputFile - Path to output JSON file to be generated
|
|
60
|
+
* @throws {Error} If initialization script not found or Gradle execution fails
|
|
61
|
+
*/
|
|
62
|
+
async function executeGradleScript(projectRoot, outputFile) {
|
|
63
|
+
logger.info(`⚙️ Executing Gradle to collect project information...`);
|
|
64
|
+
const gradlew = join(projectRoot, GRADLE_WRAPPER);
|
|
65
|
+
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
66
|
+
const initScriptPath = join(dirname, GRADLE_INIT_SCRIPT);
|
|
67
|
+
// Check if init script exists
|
|
68
|
+
const scriptExists = await exists(initScriptPath);
|
|
69
|
+
if (!scriptExists) {
|
|
70
|
+
throw new Error(`Init script not found at ${initScriptPath}. ` +
|
|
71
|
+
`Please create the ${GRADLE_INIT_SCRIPT} file.`);
|
|
72
|
+
}
|
|
73
|
+
// Prepare Gradle command arguments
|
|
74
|
+
const args = [
|
|
75
|
+
'--quiet', // Suppress non-error output for clean JSON
|
|
76
|
+
'--console=plain', // Disable ANSI formatting
|
|
77
|
+
'--init-script', // Inject initialization script
|
|
78
|
+
initScriptPath,
|
|
79
|
+
'structure', // Custom task that outputs project structure
|
|
80
|
+
`-PprojectInfoOutput=${outputFile}`
|
|
81
|
+
];
|
|
82
|
+
// Execute Gradle wrapper with the prepared arguments
|
|
83
|
+
const result = await execa(gradlew, args, {
|
|
84
|
+
cwd: projectRoot, // Run from project root
|
|
85
|
+
reject: false // Handle non-zero exit codes ourselves
|
|
86
|
+
});
|
|
87
|
+
// Check for Gradle execution failure
|
|
88
|
+
if (result.exitCode !== 0) {
|
|
89
|
+
throw new Error(`Gradle command failed with exit code ${result.exitCode}: ${result.stderr}`);
|
|
90
|
+
}
|
|
91
|
+
logger.info(`✅ Gradle project information generated at ${outputFile}.`);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Executes Gradle to collect raw project structure information.
|
|
95
|
+
* Runs gradlew with init script to output JSON containing module hierarchy, versions, and dependencies.
|
|
96
|
+
* @param projectRoot - Absolute path to the Gradle project root directory
|
|
97
|
+
* @param outputFile - Path to output JSON file to be generated
|
|
98
|
+
* @returns Promise resolving to raw project information as JSON
|
|
99
|
+
* @throws {Error} If initialization script not found or Gradle execution fails
|
|
100
|
+
*/
|
|
101
|
+
export async function getRawProjectInformation(projectRoot, outputFile) {
|
|
102
|
+
// Step 1: Check if project-information.json exists
|
|
103
|
+
const fileExists = await exists(outputFile);
|
|
104
|
+
let data = {};
|
|
105
|
+
let executeScript = true;
|
|
106
|
+
// Compute hash of all Gradle build files
|
|
107
|
+
const currentHash = await computeGradleFilesHash(projectRoot);
|
|
108
|
+
logger.debug(`🔍 Computed Gradle files hash: ${currentHash}`);
|
|
109
|
+
if (fileExists) {
|
|
110
|
+
logger.info(`💾 Cached project information found at ${outputFile}. Validating cache...`);
|
|
111
|
+
// Step 2: File exists, check cache validity
|
|
112
|
+
try {
|
|
113
|
+
const fileContent = await fs.readFile(outputFile, 'utf-8');
|
|
114
|
+
const cachedData = JSON.parse(fileContent);
|
|
115
|
+
// Step 2.1: Compare hashes
|
|
116
|
+
if (cachedData.hash === currentHash) {
|
|
117
|
+
logger.info(`✅ Cache is valid. Using cached project information.`);
|
|
118
|
+
// Cache hit - use cached data
|
|
119
|
+
executeScript = false;
|
|
120
|
+
data = cachedData.data;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
logger.debug(`❌ Cache is invalid. Cached hash: ${cachedData.hash}`);
|
|
124
|
+
logger.info(`🔄 Gradle files changed, regenerating project information...`);
|
|
125
|
+
}
|
|
126
|
+
// Cache miss - hash mismatch, need to regenerate
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
// If there's any error reading/parsing cached file, regenerate
|
|
130
|
+
logger.warning(`⚠️ Failed to read cached project information: ${error}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (executeScript) {
|
|
134
|
+
// Step 3: File doesn't exist or cache is invalid - execute Gradle script
|
|
135
|
+
const outputFile = join(projectRoot, 'build', 'project-information.json');
|
|
136
|
+
await executeGradleScript(projectRoot, outputFile);
|
|
137
|
+
// Verify that the output file was created
|
|
138
|
+
const fileExistsAfterExec = await exists(outputFile);
|
|
139
|
+
if (!fileExistsAfterExec) {
|
|
140
|
+
throw new Error(`Expected output file not found at ${outputFile}. ` +
|
|
141
|
+
`Ensure that the Gradle init script is correctly generating the project information.`);
|
|
142
|
+
}
|
|
143
|
+
// Read the output file content
|
|
144
|
+
const fileContent = await fs.readFile(outputFile, 'utf-8');
|
|
145
|
+
// Parse JSON output from Gradle
|
|
146
|
+
data = JSON.parse(fileContent.trim() || '{}');
|
|
147
|
+
}
|
|
148
|
+
// Compute hash and save with cache information
|
|
149
|
+
const cachedData = {
|
|
150
|
+
hash: currentHash,
|
|
151
|
+
data
|
|
152
|
+
};
|
|
153
|
+
// Read gradle.properites and add version
|
|
154
|
+
const projectInformation = await getInformationWithVersions(projectRoot, data);
|
|
155
|
+
if (executeScript) {
|
|
156
|
+
// Write back to file with hash for future cache validation
|
|
157
|
+
const dirname = path.dirname(outputFile);
|
|
158
|
+
await fs.mkdir(dirname, { recursive: true });
|
|
159
|
+
await fs.writeFile(outputFile, JSON.stringify(cachedData, null, 2), 'utf-8');
|
|
160
|
+
}
|
|
161
|
+
return projectInformation;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Reads gradle.properties to extract module versions and augment raw project information.
|
|
165
|
+
* @param projectRoot - Absolute path to the Gradle project root directory
|
|
166
|
+
* @param projectInformation - Gradle project information without versions
|
|
167
|
+
* @returns Promise resolving to augmented RawProjectInformation with versions
|
|
168
|
+
*/
|
|
169
|
+
async function getInformationWithVersions(projectRoot, projectInformation) {
|
|
170
|
+
const gradlePropertiesFile = join(projectRoot, 'gradle.properties');
|
|
171
|
+
const gradlePropertiesExists = await exists(gradlePropertiesFile);
|
|
172
|
+
const result = {};
|
|
173
|
+
let moduleVersions = new Map();
|
|
174
|
+
if (gradlePropertiesExists) {
|
|
175
|
+
moduleVersions = await parseProperties(gradlePropertiesFile);
|
|
176
|
+
for (const [moduleId, module] of Object.entries(projectInformation)) {
|
|
177
|
+
const version = moduleVersions.get(module.versionProperty);
|
|
178
|
+
const resultVersion = version ? version : undefined;
|
|
179
|
+
result[moduleId] = {
|
|
180
|
+
...module,
|
|
181
|
+
version: resultVersion,
|
|
182
|
+
declaredVersion: resultVersion !== undefined
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Transforms raw project information into structured, queryable format.
|
|
190
|
+
* Normalizes modules, identifies root, parses versions, and maps dependencies.
|
|
191
|
+
* @param projectInformation - Raw project information from Gradle
|
|
192
|
+
* @returns Structured ProjectInformation with normalized data
|
|
193
|
+
* @throws {Error} If no root module found in hierarchy
|
|
194
|
+
*/
|
|
195
|
+
export function getProjectInformation(projectInformation) {
|
|
196
|
+
const moduleIds = Object.keys(projectInformation);
|
|
197
|
+
const modules = new Map();
|
|
198
|
+
// Find root module by looking for the one with type 'root'
|
|
199
|
+
let rootModule;
|
|
200
|
+
for (const [moduleId, rawModule] of Object.entries(projectInformation)) {
|
|
201
|
+
if (rawModule.type === 'root') {
|
|
202
|
+
rootModule = moduleId;
|
|
203
|
+
}
|
|
204
|
+
// Create normalized Module object
|
|
205
|
+
const module = {
|
|
206
|
+
id: moduleId,
|
|
207
|
+
name: rawModule.name,
|
|
208
|
+
path: rawModule.path,
|
|
209
|
+
type: rawModule.type,
|
|
210
|
+
affectedModules: new Set(rawModule.affectedModules),
|
|
211
|
+
// Parse version if present, otherwise create initial version
|
|
212
|
+
version: rawModule.version === undefined ?
|
|
213
|
+
createInitialVersion() :
|
|
214
|
+
parseSemVer(rawModule.version),
|
|
215
|
+
declaredVersion: rawModule.declaredVersion,
|
|
216
|
+
};
|
|
217
|
+
if ('versionProperty' in rawModule) {
|
|
218
|
+
module['versionProperty'] = rawModule.versionProperty;
|
|
219
|
+
}
|
|
220
|
+
modules.set(moduleId, module);
|
|
221
|
+
}
|
|
222
|
+
// Validate that a root module was found
|
|
223
|
+
if (!rootModule) {
|
|
224
|
+
throw new Error('No root module found in hierarchy. ' +
|
|
225
|
+
'Every project hierarchy must contain exactly one module with type "root".');
|
|
226
|
+
}
|
|
227
|
+
return {
|
|
228
|
+
moduleIds,
|
|
229
|
+
modules,
|
|
230
|
+
rootModule
|
|
231
|
+
};
|
|
232
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAKvE,QAAA,MAAM,YAAY,EAAE,cAenB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GradleAdapterIdentifier } from "./services/gradle-adapter-identifier";
|
|
2
|
+
import { GradleModuleSystemFactory } from "./services/gradle-module-system-factory";
|
|
3
|
+
import { AUTHORS, VERSION } from "./utils/version";
|
|
4
|
+
const gradlePlugin = {
|
|
5
|
+
id: "gradle",
|
|
6
|
+
name: "Gradle",
|
|
7
|
+
description: "Adapter plugin for Gradle build system. Provides support for detecting and updating versions in Gradle projects.",
|
|
8
|
+
version: VERSION,
|
|
9
|
+
author: AUTHORS,
|
|
10
|
+
adapters: [
|
|
11
|
+
{
|
|
12
|
+
id: "gradle",
|
|
13
|
+
adapterIdentifier: () => new GradleAdapterIdentifier(),
|
|
14
|
+
moduleSystemFactory: (repoRoot) => new GradleModuleSystemFactory(repoRoot),
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
export default gradlePlugin;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import groovy.json.JsonOutput
|
|
2
|
+
import groovy.json.JsonGenerator
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Retrieves the qualified version property name for the project.
|
|
6
|
+
* Checks for properties in the order: "<projectName>.version", "<rootProjectName>.version", "version".
|
|
7
|
+
*/
|
|
8
|
+
fun Project.qualifiedVersionProperty(): String {
|
|
9
|
+
val candidates = listOf("${name}.version", "${rootProject.name}.version", "version")
|
|
10
|
+
return candidates.first(::hasProperty)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves the qualified version value for the project.
|
|
15
|
+
* Uses the qualified version property name to find the property value.
|
|
16
|
+
*/
|
|
17
|
+
fun Project.qualifiedVersion(): String =
|
|
18
|
+
qualifiedVersionProperty().run(::findProperty) as String
|
|
19
|
+
|
|
20
|
+
gradle.rootProject {
|
|
21
|
+
/**
|
|
22
|
+
* Collects and outputs project structure information as JSON.
|
|
23
|
+
* Includes module hierarchy, paths, versions, and affected modules.
|
|
24
|
+
*/
|
|
25
|
+
tasks.register("printProjectInformation") {
|
|
26
|
+
group = "help"
|
|
27
|
+
description = "Shows which subprojects are affected by changes (hierarchy + direct dependencies)."
|
|
28
|
+
notCompatibleWithConfigurationCache("uses project information at configuration time")
|
|
29
|
+
|
|
30
|
+
// Capture hierarchy data at configuration time
|
|
31
|
+
val hierarchyDepsProvider = provider {
|
|
32
|
+
val hierarchyEdges = linkedMapOf<String, Set<String>>()
|
|
33
|
+
|
|
34
|
+
gradle.rootProject.allprojects.forEach { project ->
|
|
35
|
+
val affectedChildren = mutableSetOf<String>()
|
|
36
|
+
|
|
37
|
+
// Recursively collect all subprojects
|
|
38
|
+
fun collectSubprojects(parent: org.gradle.api.Project) {
|
|
39
|
+
parent.subprojects.forEach { child ->
|
|
40
|
+
affectedChildren.add(child.path)
|
|
41
|
+
collectSubprojects(child)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
collectSubprojects(project)
|
|
46
|
+
hierarchyEdges[project.path] = affectedChildren.toSet()
|
|
47
|
+
}
|
|
48
|
+
hierarchyEdges
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Capture direct project dependencies at configuration time
|
|
52
|
+
val dependencyDepsProvider = provider {
|
|
53
|
+
val dependencyEdges = linkedMapOf<String, Set<String>>()
|
|
54
|
+
|
|
55
|
+
gradle.rootProject.allprojects.forEach { project ->
|
|
56
|
+
val directDeps = mutableSetOf<String>()
|
|
57
|
+
|
|
58
|
+
project.configurations.forEach { config ->
|
|
59
|
+
// Check regular dependencies
|
|
60
|
+
config.dependencies.forEach { dep ->
|
|
61
|
+
if (dep is ProjectDependency) {
|
|
62
|
+
directDeps.add(dep.path)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Check dependency constraints (platform/BOM imports)
|
|
67
|
+
config.dependencyConstraints.forEach { constraint ->
|
|
68
|
+
// Constraints reference projects by group:name, need to resolve to project path
|
|
69
|
+
val constraintProject = gradle.rootProject.allprojects.find { proj ->
|
|
70
|
+
proj.group.toString() == constraint.group && proj.name == constraint.name
|
|
71
|
+
}
|
|
72
|
+
constraintProject?.let { directDeps.add(it.path) }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
dependencyEdges[project.path] = directDeps.toSet()
|
|
77
|
+
}
|
|
78
|
+
dependencyEdges
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Capture project metadata at configuration time
|
|
82
|
+
val projectDataProvider = provider {
|
|
83
|
+
val projectData = linkedMapOf<String, Map<String, Any?>>()
|
|
84
|
+
|
|
85
|
+
gradle.rootProject.allprojects.forEach { project ->
|
|
86
|
+
val relativePath = gradle.rootProject.projectDir.toPath().relativize(project.projectDir.toPath()).toString()
|
|
87
|
+
val path = relativePath.ifEmpty { "." }
|
|
88
|
+
val version = if (project.version == "unspecified") null else project.version
|
|
89
|
+
val type = if (project == gradle.rootProject) "root" else "module"
|
|
90
|
+
val versionProperty = project.qualifiedVersionProperty()
|
|
91
|
+
val versionFromProperty = project.qualifiedVersion().takeIf {
|
|
92
|
+
it.isNotBlank() && it != "unspecified"
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
projectData[project.path] = mapOf(
|
|
96
|
+
"path" to path,
|
|
97
|
+
"version" to version,
|
|
98
|
+
"type" to type,
|
|
99
|
+
"name" to project.name,
|
|
100
|
+
"declaredVersion" to (versionFromProperty != null),
|
|
101
|
+
"versionProperty" to versionProperty
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
projectData
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
doLast {
|
|
108
|
+
val hierarchyMap = hierarchyDepsProvider.get()
|
|
109
|
+
val dependencyMap = dependencyDepsProvider.get()
|
|
110
|
+
val projectDataMap = projectDataProvider.get()
|
|
111
|
+
|
|
112
|
+
// Calculate directly affected modules only
|
|
113
|
+
val result = projectDataMap.keys.sorted().associateWith { projectPath ->
|
|
114
|
+
val projectInfo = projectDataMap.getValue(projectPath)
|
|
115
|
+
val affectedModules = mutableSetOf<String>()
|
|
116
|
+
|
|
117
|
+
// Add hierarchy children
|
|
118
|
+
hierarchyMap[projectPath]?.let { affectedModules.addAll(it) }
|
|
119
|
+
|
|
120
|
+
// Add projects that directly depend on this one
|
|
121
|
+
dependencyMap.forEach { (dependent, dependencies) ->
|
|
122
|
+
if (projectPath in dependencies) {
|
|
123
|
+
affectedModules.add(dependent)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
mapOf(
|
|
128
|
+
"path" to projectInfo["path"],
|
|
129
|
+
"affectedModules" to affectedModules.toSortedSet(),
|
|
130
|
+
"type" to projectInfo["type"],
|
|
131
|
+
"name" to projectInfo["name"],
|
|
132
|
+
"versionProperty" to projectInfo["versionProperty"]
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
val generator = JsonGenerator.Options()
|
|
137
|
+
.excludeNulls()
|
|
138
|
+
.build()
|
|
139
|
+
|
|
140
|
+
val json = JsonOutput.prettyPrint(generator.toJson(result))
|
|
141
|
+
|
|
142
|
+
// Get output path from project property or use default
|
|
143
|
+
val outputPath = project.findProperty("projectInfoOutput") as? String
|
|
144
|
+
?: "${layout.buildDirectory.asFile.get().path}/project-information.json"
|
|
145
|
+
|
|
146
|
+
val outputFile = file(outputPath)
|
|
147
|
+
outputFile.parentFile.mkdirs()
|
|
148
|
+
outputFile.writeText(json)
|
|
149
|
+
|
|
150
|
+
println("Project information written to: ${outputFile.absolutePath}")
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Convenience alias for printProjectInformation task.
|
|
156
|
+
* Usage: ./gradlew --init-script <path> structure
|
|
157
|
+
*/
|
|
158
|
+
tasks.register("structure") {
|
|
159
|
+
group = "help"
|
|
160
|
+
description = "Show project structure information"
|
|
161
|
+
dependsOn("printProjectInformation")
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AdapterIdentifier } from "@versu/core";
|
|
2
|
+
/**
|
|
3
|
+
* Adapter identifier for Gradle-based projects.
|
|
4
|
+
* Detects Gradle projects by looking for gradle.properties, build.gradle(.kts), or settings.gradle(.kts) files.
|
|
5
|
+
*/
|
|
6
|
+
export declare class GradleAdapterIdentifier implements AdapterIdentifier {
|
|
7
|
+
/** Metadata describing this Gradle adapter (id: 'gradle', supports snapshots). */
|
|
8
|
+
readonly metadata: {
|
|
9
|
+
id: string;
|
|
10
|
+
capabilities: {
|
|
11
|
+
supportsSnapshots: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Determines whether the specified project is a Gradle project.
|
|
16
|
+
* @param projectRoot - Absolute path to the project root directory
|
|
17
|
+
* @returns True if any Gradle-specific file is found in the project root
|
|
18
|
+
*/
|
|
19
|
+
accept(projectRoot: string): Promise<boolean>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=gradle-adapter-identifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradle-adapter-identifier.d.ts","sourceRoot":"","sources":["../../src/services/gradle-adapter-identifier.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,aAAa,CAAC;AAWhE;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,iBAAiB;IAC/D,kFAAkF;IAClF,QAAQ,CAAC,QAAQ;;;;;MAKf;IAEF;;;;OAIG;IACG,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAkBpD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as fs from "fs/promises";
|
|
2
|
+
import { GRADLE_PROPERTIES_FILE, GRADLE_BUILD_FILE, GRADLE_BUILD_KTS_FILE, GRADLE_SETTINGS_FILE, GRADLE_SETTINGS_KTS_FILE, GRADLE_ID, } from "../constants.js";
|
|
3
|
+
import { exists, logger } from "@versu/core";
|
|
4
|
+
/** List of file names that indicate a Gradle project. */
|
|
5
|
+
const GRADLE_FILES = [
|
|
6
|
+
GRADLE_PROPERTIES_FILE,
|
|
7
|
+
GRADLE_BUILD_FILE,
|
|
8
|
+
GRADLE_BUILD_KTS_FILE,
|
|
9
|
+
GRADLE_SETTINGS_FILE,
|
|
10
|
+
GRADLE_SETTINGS_KTS_FILE,
|
|
11
|
+
];
|
|
12
|
+
/**
|
|
13
|
+
* Adapter identifier for Gradle-based projects.
|
|
14
|
+
* Detects Gradle projects by looking for gradle.properties, build.gradle(.kts), or settings.gradle(.kts) files.
|
|
15
|
+
*/
|
|
16
|
+
export class GradleAdapterIdentifier {
|
|
17
|
+
/** Metadata describing this Gradle adapter (id: 'gradle', supports snapshots). */
|
|
18
|
+
metadata = {
|
|
19
|
+
id: GRADLE_ID,
|
|
20
|
+
capabilities: {
|
|
21
|
+
supportsSnapshots: true,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Determines whether the specified project is a Gradle project.
|
|
26
|
+
* @param projectRoot - Absolute path to the project root directory
|
|
27
|
+
* @returns True if any Gradle-specific file is found in the project root
|
|
28
|
+
*/
|
|
29
|
+
async accept(projectRoot) {
|
|
30
|
+
// Check if project root directory exists
|
|
31
|
+
const projectRootExists = await exists(projectRoot);
|
|
32
|
+
if (!projectRootExists) {
|
|
33
|
+
// Log for debugging and return false immediately
|
|
34
|
+
logger.debug(`Project root does not exist: ${projectRoot}`);
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
// Read directory contents (only top-level files)
|
|
38
|
+
const files = await fs.readdir(projectRoot);
|
|
39
|
+
// Check if any known Gradle file is present in the directory
|
|
40
|
+
const hasGradleFile = GRADLE_FILES.some((file) => files.includes(file));
|
|
41
|
+
return hasGradleFile;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ModuleDetector, ModuleRegistry } from "@versu/core";
|
|
2
|
+
/**
|
|
3
|
+
* Module detector for Gradle-based projects.
|
|
4
|
+
* Executes Gradle to discover all modules and their dependencies, returning a ModuleRegistry.
|
|
5
|
+
*/
|
|
6
|
+
export declare class GradleModuleDetector implements ModuleDetector {
|
|
7
|
+
readonly repoRoot: string;
|
|
8
|
+
readonly outputFile: string;
|
|
9
|
+
/** Absolute path to the repository root directory. */
|
|
10
|
+
constructor(repoRoot: string, outputFile: string);
|
|
11
|
+
/**
|
|
12
|
+
* Detects and catalogs all modules in the Gradle project.
|
|
13
|
+
* @returns ModuleRegistry containing all discovered modules and their relationships
|
|
14
|
+
* @throws {Error} If Gradle execution fails or project information cannot be parsed
|
|
15
|
+
*/
|
|
16
|
+
detect(): Promise<ModuleRegistry>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=gradle-module-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradle-module-detector.d.ts","sourceRoot":"","sources":["../../src/services/gradle-module-detector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAM7D;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,cAAc;IAGvD,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM;IAH7B,sDAAsD;gBAE3C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM;IAG7B;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC;CAaxC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ModuleRegistry } from "@versu/core";
|
|
2
|
+
import { getRawProjectInformation, getProjectInformation, } from "../gradle-project-information.js";
|
|
3
|
+
/**
|
|
4
|
+
* Module detector for Gradle-based projects.
|
|
5
|
+
* Executes Gradle to discover all modules and their dependencies, returning a ModuleRegistry.
|
|
6
|
+
*/
|
|
7
|
+
export class GradleModuleDetector {
|
|
8
|
+
repoRoot;
|
|
9
|
+
outputFile;
|
|
10
|
+
/** Absolute path to the repository root directory. */
|
|
11
|
+
constructor(repoRoot, outputFile) {
|
|
12
|
+
this.repoRoot = repoRoot;
|
|
13
|
+
this.outputFile = outputFile;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Detects and catalogs all modules in the Gradle project.
|
|
17
|
+
* @returns ModuleRegistry containing all discovered modules and their relationships
|
|
18
|
+
* @throws {Error} If Gradle execution fails or project information cannot be parsed
|
|
19
|
+
*/
|
|
20
|
+
async detect() {
|
|
21
|
+
// Step 1: Execute Gradle and collect raw project structure data
|
|
22
|
+
const rawProjectInformation = await getRawProjectInformation(this.repoRoot, this.outputFile);
|
|
23
|
+
// Step 2: Parse and transform raw data into structured module information
|
|
24
|
+
const projectInformation = getProjectInformation(rawProjectInformation);
|
|
25
|
+
// Step 3: Create a registry for efficient module access and querying
|
|
26
|
+
return new ModuleRegistry(projectInformation);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ModuleDetector, ModuleRegistry, ModuleSystemFactory, VersionUpdateStrategy } from "@versu/core";
|
|
2
|
+
/**
|
|
3
|
+
* Factory for creating Gradle-specific module system components.
|
|
4
|
+
* Creates module detector and version update strategy instances.
|
|
5
|
+
*/
|
|
6
|
+
export declare class GradleModuleSystemFactory implements ModuleSystemFactory {
|
|
7
|
+
private readonly repoRoot;
|
|
8
|
+
/** Absolute path to the repository root directory. */
|
|
9
|
+
constructor(repoRoot: string);
|
|
10
|
+
/**
|
|
11
|
+
* Creates a Gradle-specific module detector.
|
|
12
|
+
* @param outputFile - Path to the output file for project information
|
|
13
|
+
* @returns GradleModuleDetector instance configured with the repository root
|
|
14
|
+
*/
|
|
15
|
+
createDetector(outputFile: string): ModuleDetector;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a Gradle-specific version update strategy.
|
|
18
|
+
* @param moduleRegistry - ModuleRegistry containing all detected modules
|
|
19
|
+
* @returns GradleVersionUpdateStrategy instance configured with the repository root
|
|
20
|
+
*/
|
|
21
|
+
createVersionUpdateStrategy(moduleRegistry: ModuleRegistry): VersionUpdateStrategy;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=gradle-module-system-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradle-module-system-factory.d.ts","sourceRoot":"","sources":["../../src/services/gradle-module-system-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAIrB;;;GAGG;AACH,qBAAa,yBAA0B,YAAW,mBAAmB;IAEvD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IADrC,sDAAsD;gBACzB,QAAQ,EAAE,MAAM;IAE7C;;;;OAIG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc;IAIlD;;;;OAIG;IACH,2BAA2B,CACzB,cAAc,EAAE,cAAc,GAC7B,qBAAqB;CAGzB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { GradleModuleDetector } from "./gradle-module-detector.js";
|
|
2
|
+
import { GradleVersionUpdateStrategy } from "./gradle-version-update-strategy.js";
|
|
3
|
+
/**
|
|
4
|
+
* Factory for creating Gradle-specific module system components.
|
|
5
|
+
* Creates module detector and version update strategy instances.
|
|
6
|
+
*/
|
|
7
|
+
export class GradleModuleSystemFactory {
|
|
8
|
+
repoRoot;
|
|
9
|
+
/** Absolute path to the repository root directory. */
|
|
10
|
+
constructor(repoRoot) {
|
|
11
|
+
this.repoRoot = repoRoot;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a Gradle-specific module detector.
|
|
15
|
+
* @param outputFile - Path to the output file for project information
|
|
16
|
+
* @returns GradleModuleDetector instance configured with the repository root
|
|
17
|
+
*/
|
|
18
|
+
createDetector(outputFile) {
|
|
19
|
+
return new GradleModuleDetector(this.repoRoot, outputFile);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a Gradle-specific version update strategy.
|
|
23
|
+
* @param moduleRegistry - ModuleRegistry containing all detected modules
|
|
24
|
+
* @returns GradleVersionUpdateStrategy instance configured with the repository root
|
|
25
|
+
*/
|
|
26
|
+
createVersionUpdateStrategy(moduleRegistry) {
|
|
27
|
+
return new GradleVersionUpdateStrategy(this.repoRoot, moduleRegistry);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ModuleRegistry, VersionUpdateStrategy } from "@versu/core";
|
|
2
|
+
/**
|
|
3
|
+
* Gradle-specific implementation for version update operations.
|
|
4
|
+
* Updates module versions by modifying gradle.properties file.
|
|
5
|
+
*/
|
|
6
|
+
export declare class GradleVersionUpdateStrategy implements VersionUpdateStrategy {
|
|
7
|
+
private readonly moduleRegistry;
|
|
8
|
+
/** Absolute path to the gradle.properties file. */
|
|
9
|
+
private readonly versionFilePath;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new Gradle version update strategy.
|
|
12
|
+
* @param repoRoot - Absolute path to the repository root directory
|
|
13
|
+
*/
|
|
14
|
+
constructor(repoRoot: string, moduleRegistry: ModuleRegistry);
|
|
15
|
+
/**
|
|
16
|
+
* Writes version updates for multiple modules to gradle.properties.
|
|
17
|
+
* @param moduleVersions - Map of module IDs to new version strings
|
|
18
|
+
* @throws {Error} If the file cannot be read or written
|
|
19
|
+
*/
|
|
20
|
+
writeVersionUpdates(moduleVersions: Map<string, string>): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=gradle-version-update-strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradle-version-update-strategy.d.ts","sourceRoot":"","sources":["../../src/services/gradle-version-update-strategy.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EAEd,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,qBAAa,2BAA4B,YAAW,qBAAqB;IAUrE,OAAO,CAAC,QAAQ,CAAC,cAAc;IATjC,mDAAmD;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IAEzC;;;OAGG;gBAED,QAAQ,EAAE,MAAM,EACC,cAAc,EAAE,cAAc;IAKjD;;;;OAIG;IACG,mBAAmB,CACvB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,OAAO,CAAC,IAAI,CAAC;CAejB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { join } from "path";
|
|
2
|
+
import { GRADLE_PROPERTIES_FILE } from "../constants.js";
|
|
3
|
+
import { upsertProperties, } from "@versu/core";
|
|
4
|
+
/**
|
|
5
|
+
* Gradle-specific implementation for version update operations.
|
|
6
|
+
* Updates module versions by modifying gradle.properties file.
|
|
7
|
+
*/
|
|
8
|
+
export class GradleVersionUpdateStrategy {
|
|
9
|
+
moduleRegistry;
|
|
10
|
+
/** Absolute path to the gradle.properties file. */
|
|
11
|
+
versionFilePath;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new Gradle version update strategy.
|
|
14
|
+
* @param repoRoot - Absolute path to the repository root directory
|
|
15
|
+
*/
|
|
16
|
+
constructor(repoRoot, moduleRegistry) {
|
|
17
|
+
this.moduleRegistry = moduleRegistry;
|
|
18
|
+
this.versionFilePath = join(repoRoot, GRADLE_PROPERTIES_FILE);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Writes version updates for multiple modules to gradle.properties.
|
|
22
|
+
* @param moduleVersions - Map of module IDs to new version strings
|
|
23
|
+
* @throws {Error} If the file cannot be read or written
|
|
24
|
+
*/
|
|
25
|
+
async writeVersionUpdates(moduleVersions) {
|
|
26
|
+
// Convert module IDs to property names
|
|
27
|
+
// Example: ':app' → 'app.version', ':' → 'version'
|
|
28
|
+
const propertyUpdates = new Map();
|
|
29
|
+
for (const [moduleId, versionString] of moduleVersions) {
|
|
30
|
+
const module = this.moduleRegistry.getModule(moduleId);
|
|
31
|
+
const propertyName = module["versionProperty"];
|
|
32
|
+
propertyUpdates.set(propertyName, versionString);
|
|
33
|
+
}
|
|
34
|
+
// Write all properties to gradle.properties file in one atomic operation
|
|
35
|
+
// This ensures consistency and prevents partial updates
|
|
36
|
+
await upsertProperties(this.versionFilePath, propertyUpdates);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,YAAY,yBAAyB,CAAC;AACnD,eAAO,MAAM,OAAO,cAAc,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@versu/plugin-gradle",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "VERSU Gradle Plugin",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/index.cjs"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"prebuild": "node scripts/generate-version.js",
|
|
15
|
+
"build": "npm run build:esm",
|
|
16
|
+
"build:esm": "tsc --project tsconfig.json --outDir dist && npm run copy-assets",
|
|
17
|
+
"build:cjs": "tsc --project tsconfig.cjs.json --outDir dist && npm run copy-assets",
|
|
18
|
+
"test": "vitest",
|
|
19
|
+
"test:coverage": "vitest --coverage",
|
|
20
|
+
"lint": "eslint src/**/*.ts",
|
|
21
|
+
"format": "prettier --write src/**/*.ts",
|
|
22
|
+
"copy-assets": "cpx \"src/init-project-information.gradle.kts\" \"dist/\""
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"versu",
|
|
26
|
+
"plugin",
|
|
27
|
+
"gradle",
|
|
28
|
+
"semantic-versioning",
|
|
29
|
+
"conventional-commits",
|
|
30
|
+
"version-engine",
|
|
31
|
+
"dependency-cascade",
|
|
32
|
+
"monorepo"
|
|
33
|
+
],
|
|
34
|
+
"author": "tvcsantos",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/tvcsantos/versu.git"
|
|
39
|
+
},
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/tvcsantos/versu/issues"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/tvcsantos/versu#readme",
|
|
44
|
+
"files": [
|
|
45
|
+
"dist"
|
|
46
|
+
],
|
|
47
|
+
"types": "dist/index.d.ts",
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"execa": "^9.6.1",
|
|
50
|
+
"fast-glob": "^3.3.3",
|
|
51
|
+
"semver": "^7.5.4",
|
|
52
|
+
"@versu/core": "^0.6.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/node": "^20.19.23",
|
|
56
|
+
"@types/semver": "^7.5.6",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^6.15.0",
|
|
58
|
+
"@typescript-eslint/parser": "^6.15.0",
|
|
59
|
+
"@vitest/coverage-v8": "^1.1.0",
|
|
60
|
+
"cpx": "^1.5.0",
|
|
61
|
+
"eslint": "^8.56.0",
|
|
62
|
+
"prettier": "^3.1.1",
|
|
63
|
+
"typescript": "^5.3.3",
|
|
64
|
+
"vitest": "^1.1.0"
|
|
65
|
+
},
|
|
66
|
+
"engines": {
|
|
67
|
+
"node": ">=20"
|
|
68
|
+
}
|
|
69
|
+
}
|