From 9cca37ca8aca474d21f2088df6b77d00812eb77a Mon Sep 17 00:00:00 2001 From: Daniel Scalzi Date: Tue, 12 Nov 2024 14:48:55 -0500 Subject: [PATCH] Fix issue with submodule library overrides. (#366) --- app/assets/js/processbuilder.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/app/assets/js/processbuilder.js b/app/assets/js/processbuilder.js index 0e955621..f64820b7 100644 --- a/app/assets/js/processbuilder.js +++ b/app/assets/js/processbuilder.js @@ -839,9 +839,7 @@ class ProcessBuilder { libs[mdl.getVersionlessMavenIdentifier()] = mdl.getPath() if(mdl.subModules.length > 0){ const res = this._resolveModuleLibraries(mdl) - if(res.length > 0){ - libs = {...libs, ...res} - } + libs = {...libs, ...res} } } } @@ -850,9 +848,7 @@ class ProcessBuilder { for(let i=0; i 0){ - libs = {...libs, ...res} - } + libs = {...libs, ...res} } } @@ -863,27 +859,25 @@ class ProcessBuilder { * Recursively resolve the path of each library required by this module. * * @param {Object} mdl A module object from the server distro index. - * @returns {Array.} An array containing the paths of each library this module requires. + * @returns {{[id: string]: string}} An object containing the paths of each library this server requires. */ _resolveModuleLibraries(mdl){ if(!mdl.subModules.length > 0){ - return [] + return {} } - let libs = [] + let libs = {} for(let sm of mdl.subModules){ if(sm.rawModule.type === Type.Library){ if(sm.rawModule.classpath ?? true) { - libs.push(sm.getPath()) + libs[sm.getVersionlessMavenIdentifier()] = sm.getPath() } } // If this module has submodules, we need to resolve the libraries for those. // To avoid unnecessary recursive calls, base case is checked here. if(mdl.subModules.length > 0){ const res = this._resolveModuleLibraries(sm) - if(res.length > 0){ - libs = libs.concat(res) - } + libs = {...libs, ...res} } } return libs