Skip to content

Commit 9cca37c

Browse files
committed
Fix issue with submodule library overrides. (#366)
1 parent 03dac9e commit 9cca37c

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

app/assets/js/processbuilder.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -839,9 +839,7 @@ class ProcessBuilder {
839839
libs[mdl.getVersionlessMavenIdentifier()] = mdl.getPath()
840840
if(mdl.subModules.length > 0){
841841
const res = this._resolveModuleLibraries(mdl)
842-
if(res.length > 0){
843-
libs = {...libs, ...res}
844-
}
842+
libs = {...libs, ...res}
845843
}
846844
}
847845
}
@@ -850,9 +848,7 @@ class ProcessBuilder {
850848
for(let i=0; i<mods.length; i++){
851849
if(mods.sub_modules != null){
852850
const res = this._resolveModuleLibraries(mods[i])
853-
if(res.length > 0){
854-
libs = {...libs, ...res}
855-
}
851+
libs = {...libs, ...res}
856852
}
857853
}
858854

@@ -863,27 +859,25 @@ class ProcessBuilder {
863859
* Recursively resolve the path of each library required by this module.
864860
*
865861
* @param {Object} mdl A module object from the server distro index.
866-
* @returns {Array.<string>} An array containing the paths of each library this module requires.
862+
* @returns {{[id: string]: string}} An object containing the paths of each library this server requires.
867863
*/
868864
_resolveModuleLibraries(mdl){
869865
if(!mdl.subModules.length > 0){
870-
return []
866+
return {}
871867
}
872-
let libs = []
868+
let libs = {}
873869
for(let sm of mdl.subModules){
874870
if(sm.rawModule.type === Type.Library){
875871

876872
if(sm.rawModule.classpath ?? true) {
877-
libs.push(sm.getPath())
873+
libs[sm.getVersionlessMavenIdentifier()] = sm.getPath()
878874
}
879875
}
880876
// If this module has submodules, we need to resolve the libraries for those.
881877
// To avoid unnecessary recursive calls, base case is checked here.
882878
if(mdl.subModules.length > 0){
883879
const res = this._resolveModuleLibraries(sm)
884-
if(res.length > 0){
885-
libs = libs.concat(res)
886-
}
880+
libs = {...libs, ...res}
887881
}
888882
}
889883
return libs

0 commit comments

Comments
 (0)