-
Notifications
You must be signed in to change notification settings - Fork 36
Early plugin support #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: plugin
Are you sure you want to change the base?
Conversation
| def generatedJarFileParentPath = "${projectDir.absolutePath}/build/libs" | ||
| programParameters += " --accept-early-plugins --early-plugins=${generatedJarFileParentPath}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.