Skip to content

Commit

Permalink
Fix issue with submodule library overrides. (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
dscalzi committed Nov 12, 2024
1 parent 03dac9e commit 9cca37c
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions app/assets/js/processbuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
}
}
Expand All @@ -850,9 +848,7 @@ class ProcessBuilder {
for(let i=0; i<mods.length; i++){
if(mods.sub_modules != null){
const res = this._resolveModuleLibraries(mods[i])
if(res.length > 0){
libs = {...libs, ...res}
}
libs = {...libs, ...res}
}
}

Expand All @@ -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.<string>} 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
Expand Down

0 comments on commit 9cca37c

Please sign in to comment.