103 lines
2.8 KiB
Groovy
103 lines
2.8 KiB
Groovy
plugins {
|
|
id 'java'
|
|
}
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
maven {
|
|
url = 'https://repo.runelite.net'
|
|
content {
|
|
includeGroupByRegex("net\\.runelite.*")
|
|
}
|
|
}
|
|
mavenCentral()
|
|
}
|
|
|
|
def runeLiteVersion = 'latest.release'
|
|
def pluginMainClass = 'com.example.ExamplePluginTest'
|
|
|
|
dependencies {
|
|
compileOnly group: 'net.runelite', name: 'client', version: runeLiteVersion
|
|
|
|
compileOnly 'org.projectlombok:lombok:1.18.30'
|
|
annotationProcessor 'org.projectlombok:lombok:1.18.30'
|
|
|
|
testImplementation 'junit:junit:4.12'
|
|
testImplementation group: 'net.runelite', name: 'client', version: runeLiteVersion
|
|
testImplementation group: 'net.runelite', name: 'jshell', version: runeLiteVersion
|
|
testCompileOnly 'org.projectlombok:lombok:1.18.30'
|
|
testAnnotationProcessor 'org.projectlombok:lombok:1.18.30'
|
|
}
|
|
|
|
group = 'com.example'
|
|
version = '1.0-SNAPSHOT'
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = 'UTF-8'
|
|
options.release.set(11)
|
|
}
|
|
|
|
tasks.register('run', JavaExec) {
|
|
classpath = sourceSets.test.runtimeClasspath
|
|
mainClass = pluginMainClass
|
|
|
|
jvmArgs "-ea"
|
|
args "--developer-mode", "--debug"
|
|
}
|
|
|
|
tasks.register('shadowJar', Jar) {
|
|
dependsOn configurations.testRuntimeClasspath
|
|
manifest {
|
|
attributes('Main-Class': pluginMainClass, 'Multi-Release': true)
|
|
}
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
from sourceSets.main.output
|
|
from sourceSets.test.output
|
|
from {
|
|
configurations.testRuntimeClasspath.collect { file ->
|
|
file.isDirectory() ? file : zipTree(file)
|
|
}
|
|
}
|
|
|
|
exclude 'META-INF/INDEX.LIST'
|
|
exclude 'META-INF/*.SF'
|
|
exclude 'META-INF/*.DSA'
|
|
exclude 'META-INF/*.RSA'
|
|
exclude '**/module-info.class'
|
|
|
|
group = BasePlugin.BUILD_GROUP
|
|
archiveClassifier.set('shadow')
|
|
archiveFileName.set("${rootProject.name}-${project.version}-all.jar")
|
|
}
|
|
|
|
tasks.register('deploy') {
|
|
dependsOn 'shadowJar'
|
|
doLast {
|
|
def destDir = new File("${System.getProperty('user.home')}/.local/share/bolt-launcher")
|
|
destDir.mkdirs()
|
|
def srcFile = file("build/libs/${rootProject.name}-${project.version}-all.jar")
|
|
def targetFile = new File(destDir, "custom-runelite.jar")
|
|
def tmpFile = new File(destDir, "custom-runelite.jar.tmp")
|
|
|
|
// Copy to temporary file first
|
|
tmpFile.bytes = srcFile.bytes
|
|
|
|
// Atomic move (keeps open file descriptors valid on running Linux processes)
|
|
java.nio.file.Files.move(
|
|
tmpFile.toPath(),
|
|
targetFile.toPath(),
|
|
java.nio.file.StandardCopyOption.ATOMIC_MOVE,
|
|
java.nio.file.StandardCopyOption.REPLACE_EXISTING
|
|
)
|
|
// Also copy to Downloads as documented in CLAUDE.md
|
|
def downloadsDir = new File("${System.getProperty('user.home')}/Downloads")
|
|
if (downloadsDir.exists()) {
|
|
new File(downloadsDir, "RuneLite.jar").bytes = srcFile.bytes
|
|
}
|
|
println "Plugin sicher und atomar nach ~/.local/share/bolt-launcher/custom-runelite.jar installiert!"
|
|
}
|
|
}
|
|
|
|
|