Skip to content

Conversation

@EvanMevel
Copy link
Contributor

No description provided.

Comment on lines +98 to +99
def generatedJarFileParentPath = "${projectDir.absolutePath}/build/libs"
programParameters += " --accept-early-plugins --early-plugins=${generatedJarFileParentPath}"
Copy link
Contributor Author

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:

Suggested change
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

Comment on lines +121 to +129
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
}
}
}
Copy link
Contributor Author

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

Suggested change
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")
Copy link
Contributor Author

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

Suggested change
def tasksFile = file("$vscodeDir/tasks.json")

Comment on lines +156 to +177
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))
}
Copy link
Contributor Author

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

Suggested change
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))
}

@EvanMevel EvanMevel marked this pull request as ready for review January 17, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant