Conversation
| def generatedJarFileParentPath = "${projectDir.absolutePath}/build/libs" | ||
| programParameters += " --accept-early-plugins --early-plugins=${generatedJarFileParentPath}" |
There was a problem hiding this comment.
What I've done here is use the generated plugin jar to enable ClassTransformer
But this requires us to build the jar before running the server, which is prone to errors. The generated jar directory can easily be modified for example.
What could be done here instead is to use the HytaleServer parent directory:
| def generatedJarFileParentPath = "${projectDir.absolutePath}/build/libs" | |
| programParameters += " --accept-early-plugins --early-plugins=${generatedJarFileParentPath}" | |
| def serverJarFileParentPath = "$hytaleHome/install/$patchline/package/game/latest/Server" | |
| programParameters += " --accept-early-plugins --early-plugins=${serverJarFileParentPath }" |
We would be sure that at least a jar is contained in the directory, and we would not have to build the plugin jar!
But it could lead to unexpected behavior if another jar is present in the HytaleServer parent directory.
I don't see a perfect solution here, but I'd be interested in hearing alternative approaches
| if (early_plugin.toBoolean()) { | ||
| // Ensure that the Gradle task to build the jar is run before launching | ||
| // so that the early-plugins folder contains a jar file. | ||
| beforeRun { | ||
| 'GradleTask'(org.jetbrains.gradle.ext.GradleTask) { | ||
| task = jar | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
If building the plugin jar is not needed anymore
| if (early_plugin.toBoolean()) { | |
| // Ensure that the Gradle task to build the jar is run before launching | |
| // so that the early-plugins folder contains a jar file. | |
| beforeRun { | |
| 'GradleTask'(org.jetbrains.gradle.ext.GradleTask) { | |
| task = jar | |
| } | |
| } | |
| } |
| tasks.register('generateVSCodeLaunch') { | ||
| def vscodeDir = file("$projectDir/.vscode") | ||
| def launchFile = file("$vscodeDir/launch.json") | ||
| def tasksFile = file("$vscodeDir/tasks.json") |
There was a problem hiding this comment.
If building the plugin jar is not needed anymore
| def tasksFile = file("$vscodeDir/tasks.json") |
| if (early_plugin.toBoolean()) { | ||
| // Ensure that the Gradle task to build the jar is run before launching | ||
| // so that the early-plugins folder contains a jar file. | ||
| launchConfig.configurations[0].preLaunchTask = "gradle: jar" | ||
|
|
||
| def tasksConfig = [ | ||
| version: "2.0.0", | ||
| tasks: [ | ||
| [ | ||
| "label": "gradle: jar", | ||
| "type": "shell", | ||
| "command": "./gradlew", | ||
| "args": ["jar"], | ||
| "problemMatcher": ["\$gradle"], | ||
| "windows": [ | ||
| "command": "gradlew.bat" | ||
| ] | ||
| ] | ||
| ] | ||
| ] | ||
| tasksFile.text = groovy.json.JsonOutput.prettyPrint(groovy.json.JsonOutput.toJson(tasksConfig)) | ||
| } |
There was a problem hiding this comment.
If building the plugin jar is not needed anymore
| if (early_plugin.toBoolean()) { | |
| // Ensure that the Gradle task to build the jar is run before launching | |
| // so that the early-plugins folder contains a jar file. | |
| launchConfig.configurations[0].preLaunchTask = "gradle: jar" | |
| def tasksConfig = [ | |
| version: "2.0.0", | |
| tasks: [ | |
| [ | |
| "label": "gradle: jar", | |
| "type": "shell", | |
| "command": "./gradlew", | |
| "args": ["jar"], | |
| "problemMatcher": ["\$gradle"], | |
| "windows": [ | |
| "command": "gradlew.bat" | |
| ] | |
| ] | |
| ] | |
| ] | |
| tasksFile.text = groovy.json.JsonOutput.prettyPrint(groovy.json.JsonOutput.toJson(tasksConfig)) | |
| } |
No description provided.