Use classpath flag instead of hardcode.

This commit is contained in:
Daniel Scalzi 2022-11-26 18:54:09 -05:00
parent 4636f7200c
commit a6e3d2b85c
No known key found for this signature in database
GPG Key ID: 9E3E2AFE45328AA5
3 changed files with 13 additions and 11 deletions

View File

@ -5,7 +5,7 @@
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2019,
"ecmaVersion": 2021,
"sourceType": "module"
},
"rules": {

View File

@ -118,7 +118,7 @@ class Module {
* @returns {Module} The parsed Module.
*/
static fromJSON(json, serverid){
return new Module(json.id, json.name, json.type, json.required, json.artifact, json.subModules, serverid)
return new Module(json.id, json.name, json.type, json.classpath, json.required, json.artifact, json.subModules, serverid)
}
/**
@ -143,9 +143,10 @@ class Module {
}
}
constructor(id, name, type, required, artifact, subModules, serverid) {
constructor(id, name, type, classpath, required, artifact, subModules, serverid) {
this.identifier = id
this.type = type
this.classpath = classpath
this._resolveMetaData()
this.name = name
this.required = Required.fromJSON(required)
@ -306,6 +307,13 @@ class Module {
return this.type
}
/**
* @returns {boolean} Whether or not this library should be on the classpath.
*/
getClasspath(){
return this.classpath ?? true
}
}
exports.Module

View File

@ -816,15 +816,9 @@ class ProcessBuilder {
for(let sm of mdl.getSubModules()){
if(sm.getType() === DistroManager.Types.Library){
// TODO Add as file or something.
const x = sm.getIdentifier()
console.log(x)
if(x.includes(':universal') || x.includes(':slim') || x.includes(':extra') || x.includes(':srg') || x.includes(':client')) {
console.log('SKIPPING ' + x)
continue
if(sm.getClasspath()) {
libs.push(sm.getArtifact().getPath())
}
libs.push(sm.getArtifact().getPath())
}
// If this module has submodules, we need to resolve the libraries for those.
// To avoid unnecessary recursive calls, base case is checked here.