Skip to content

Commit

Permalink
Added the module-name to the metadata for all modules, not just those…
Browse files Browse the repository at this point in the history
… resolved from NPM

Signed-off-by: Roland Asmann <[email protected]>
  • Loading branch information
malice00 committed Sep 22, 2024
1 parent c7a1cef commit 5108ab7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,7 @@ export async function createJavaBom(path, options) {
);

for (const [key, propTaskOut] of splitPropTaskOut.entries()) {
const retMap = parseGradleProperties(propTaskOut);
const retMap = parseGradleProperties(propTaskOut, key);
const rootSubProject = retMap.rootProject;
if (rootSubProject) {
const rootSubProjectObj = await buildObjectForGradleModule(
Expand Down
11 changes: 7 additions & 4 deletions lib/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2544,7 +2544,7 @@ export async function parseGradleDep(
);

for (const [key, propTaskOut] of splitPropTaskOut.entries()) {
const propMap = parseGradleProperties(propTaskOut);
const propMap = parseGradleProperties(propTaskOut, key);
const rootSubProject = propMap.rootProject;
if (rootSubProject) {
const rootSubProjectObj = await buildObjectForGradleModule(
Expand Down Expand Up @@ -2866,11 +2866,15 @@ export function parseGradleProjects(rawOutput) {
* Parse gradle properties output
*
* @param {string} rawOutput Raw string output
* @param {string} gradleModuleName The name (or 'path') of the module as seen from the root of the project
*/
export function parseGradleProperties(rawOutput) {
export function parseGradleProperties(rawOutput, gradleModuleName = null) {
let rootProject = "root";
const projects = new Set();
const metadata = { group: "", version: "latest", properties: [] };
if (gradleModuleName) {
metadata.properties.push({ name: "GradleModule", value: gradleModuleName });
}
if (typeof rawOutput === "string") {
const tmpA = rawOutput.split("\n");
tmpA.forEach((l) => {
Expand Down Expand Up @@ -3011,7 +3015,7 @@ export function executeGradleProperties(dir, subProject) {
const stdout = result.stdout;
if (stdout) {
const cmdOutput = Buffer.from(stdout).toString();
return parseGradleProperties(cmdOutput);
return parseGradleProperties(cmdOutput, subProject);
}
return {};
}
Expand Down Expand Up @@ -10136,7 +10140,6 @@ export async function buildObjectForGradleModule(name, metadata) {
component.properties = component.properties.concat(
metadata.properties,
);
component.properties.push({ name: "GradleProjectName", value: name });
tmpDir = undefined;
} else {
tmpDir = tmpDir.substring(0, tmpDir.lastIndexOf("/"));
Expand Down

0 comments on commit 5108ab7

Please sign in to comment.