Merge branch 'dscalzi:master' into master

This commit is contained in:
Sandro Soria 2024-11-20 13:28:58 +01:00 committed by GitHub
commit afb461dbc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -839,22 +839,18 @@ class ProcessBuilder {
libs[mdl.getVersionlessMavenIdentifier()] = mdl.getPath()
if(mdl.subModules.length > 0){
const res = this._resolveModuleLibraries(mdl)
if(res.length > 0){
libs = {...libs, ...res}
}
}
}
}
//Check for any libraries in our mod list.
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}
}
}
}
return libs
}
@ -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 module 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