project(gradle): Fix warnings and deprecations

This commit is contained in:
Owain van Brakel
2022-05-30 01:27:11 +02:00
parent 5c7302fd5a
commit 46b6def0df
9 changed files with 38 additions and 64 deletions

View File

@@ -188,7 +188,7 @@ subprojects {
} }
} }
configurations["compileOnly"].extendsFrom(configurations["annotationProcessor"]) configurations.compileOnly.get().extendsFrom(configurations["annotationProcessor"])
} }
application { application {

View File

@@ -57,10 +57,6 @@ dependencies {
tasks { tasks {
processTestResources { processTestResources {
finalizedBy("filterTestResources")
}
register<Copy>("filterTestResources") {
val tokens = mapOf( val tokens = mapOf(
"rs.version" to ProjectVersions.rsversion.toString(), "rs.version" to ProjectVersions.rsversion.toString(),
"cache.version" to ProjectVersions.cacheversion.toString() "cache.version" to ProjectVersions.cacheversion.toString()
@@ -68,12 +64,9 @@ tasks {
inputs.properties(tokens) inputs.properties(tokens)
from("src/test/resources") { filesMatching("cache.properties") {
include("cache.properties") filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
} }
into("${buildDir}/resources/test")
filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
} }
} }

View File

@@ -29,7 +29,11 @@ plugins {
id("com.github.hauner.jarTest") version "1.0.1" id("com.github.hauner.jarTest") version "1.0.1"
} }
val deobjars = configurations.create("deobjars") val deobjars: Configuration = configurations.create("deobjars")
configurations {
testImplementation.get().extendsFrom(deobjars)
}
dependencies { dependencies {
deobjars(group = "net.runelite.rs", name = "vanilla", version = ProjectVersions.rsversion.toString()) deobjars(group = "net.runelite.rs", name = "vanilla", version = ProjectVersions.rsversion.toString())
@@ -50,7 +54,6 @@ dependencies {
runtimeOnly(group = "org.slf4j", name = "slf4j-simple", version = "1.7.32") runtimeOnly(group = "org.slf4j", name = "slf4j-simple", version = "1.7.32")
testImplementation(deobjars)
testImplementation(group = "junit", name = "junit", version = "4.12") testImplementation(group = "junit", name = "junit", version = "4.12")
testImplementation(group = "org.mockito", name = "mockito-core", version = "3.1.0") testImplementation(group = "org.mockito", name = "mockito-core", version = "3.1.0")
} }
@@ -63,49 +66,36 @@ tasks {
) )
processResources { processResources {
finalizedBy("filterResources")
}
register<Copy>("filterResources") {
inputs.properties(tokens) inputs.properties(tokens)
from("src/main/resources") { filesMatching("deob.properties") {
include("deob.properties") filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
} }
into("${buildDir}/resources/main")
filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
} }
processTestResources { processTestResources {
finalizedBy("filterTestResources")
}
register<Copy>("filterTestResources") {
inputs.properties(tokens) inputs.properties(tokens)
from("src/test/resources") { filesMatching("deob-test.properties") {
include("deob-test.properties") filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
} }
into("${buildDir}/resources/test")
filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
} }
// TODO: Enable assertions on all 3 // TODO: Enable assertions on all 3
register<JavaExec>("Downloader\$main()") { register<JavaExec>("Downloader\$main()") {
group = "gamepack" group = "gamepack"
classpath = project.sourceSets.main.get().runtimeClasspath classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.gamepack.Downloader" mainClass.set("net.runelite.gamepack.Downloader")
} }
register<JavaExec>("Deob\$main()") { register<JavaExec>("Deob\$main()") {
group = "gamepack" group = "gamepack"
classpath = project.sourceSets.main.get().runtimeClasspath classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.deob.Deob" mainClass.set("net.runelite.deob.Deob")
args = listOf(tokens["vanilla.jar"], "$buildDir/libs/deobfuscated-$version.jar") args = listOf(tokens["vanilla.jar"], "$buildDir/libs/deobfuscated-$version.jar")
} }
@@ -113,7 +103,7 @@ tasks {
group = "gamepack" group = "gamepack"
classpath = project.sourceSets.main.get().runtimeClasspath classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.deob.updater.UpdateMappings" mainClass.set("net.runelite.deob.updater.UpdateMappings")
} }
} }

View File

@@ -46,10 +46,6 @@ dependencies {
tasks { tasks {
processResources { processResources {
finalizedBy("filterResources")
}
register<Copy>("filterResources") {
val tokens = mapOf( val tokens = mapOf(
"projectver" to ProjectVersions.rlVersion, "projectver" to ProjectVersions.rlVersion,
"rsver" to ProjectVersions.rsversion.toString(), "rsver" to ProjectVersions.rsversion.toString(),
@@ -58,12 +54,9 @@ tasks {
inputs.properties(tokens) inputs.properties(tokens)
from("src/main/resources") { filesMatching("runelite.properties") {
include("runelite.properties") filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
} }
into("${buildDir}/resources/main")
filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
} }
} }

View File

@@ -42,11 +42,14 @@ tasks.register<JavaExec>("inject") {
enableAssertions = true enableAssertions = true
main = "com.openosrs.injector.Injector" classpath = project.sourceSets.main.get().runtimeClasspath
mainClass.set("com.openosrs.injector.Injector")
val out = "${project.extra["rootPath"]}/runelite-client/build/injected/injected-client.oprs" val out = "${project.extra["rootPath"]}/runelite-client/build/injected/injected-client.oprs"
outputs.file(out) outputs.file(out)
classpath = sourceSets["main"].runtimeClasspath
args("--outmode", "jar", "--vanilla", vanillaDep.singleFile, "--version", openosrsVersion, "--output", out) args("--outmode", "jar", "--vanilla", vanillaDep.singleFile, "--version", openosrsVersion, "--output", out)
outputs.upToDateWhen { outputs.upToDateWhen {
false false
} }

View File

@@ -28,7 +28,7 @@ import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
plugins { plugins {
id("com.github.johnrengelman.shadow") version "6.1.0" id("com.github.johnrengelman.shadow") version "7.1.2"
java java
} }
@@ -137,10 +137,6 @@ tasks {
} }
processResources { processResources {
finalizedBy("filterResources")
}
register<Copy>("filterResources") {
val tokens = mapOf( val tokens = mapOf(
"project.version" to ProjectVersions.rlVersion, "project.version" to ProjectVersions.rlVersion,
"rs.version" to ProjectVersions.rsversion.toString(), "rs.version" to ProjectVersions.rsversion.toString(),
@@ -151,12 +147,10 @@ tasks {
inputs.properties(tokens) inputs.properties(tokens)
from("src/main/resources/") filesMatching("**/*.properties") {
include("**/*.properties") filter(ReplaceTokens::class, "tokens" to tokens)
into("${buildDir}/resources/main") filteringCharset = "UTF-8"
}
filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
} }
register<Copy>("packInjectedClient") { register<Copy>("packInjectedClient") {
@@ -196,7 +190,7 @@ tasks {
register<JavaExec>("RuneLite.main()") { register<JavaExec>("RuneLite.main()") {
group = "openosrs" group = "openosrs"
classpath = sourceSets["main"].runtimeClasspath classpath = project.sourceSets.main.get().runtimeClasspath
enableAssertions = true enableAssertions = true
mainClass.set("net.runelite.client.RuneLite") mainClass.set("net.runelite.client.RuneLite")
} }

View File

@@ -40,6 +40,7 @@ tasks {
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
disableAutoTargetJvm() disableAutoTargetJvm()
} }
withType<JavaCompile> { withType<JavaCompile> {
options.compilerArgs.addAll(arrayOf("-Xlint:-unchecked")) options.compilerArgs.addAll(arrayOf("-Xlint:-unchecked"))
} }

View File

@@ -48,7 +48,7 @@ tasks {
outputs.dir(out) outputs.dir(out)
classpath = project.sourceSets.main.get().runtimeClasspath classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.script.AssembleMojo" mainClass.set("net.runelite.script.AssembleMojo")
args(listOf(inp, out)) args(listOf(inp, out))
doLast { doLast {

View File

@@ -49,7 +49,7 @@ tasks {
group = "openosrs" group = "openosrs"
classpath = project.sourceSets.main.get().runtimeClasspath classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.data.App" mainClass.set("net.runelite.data.App")
args(listOf("npcStats", rootProject.file("./runelite-client/src/main/resources/").absolutePath)) args(listOf("npcStats", rootProject.file("./runelite-client/src/main/resources/").absolutePath))
} }
@@ -57,7 +57,7 @@ tasks {
group = "openosrs" group = "openosrs"
classpath = project.sourceSets.main.get().runtimeClasspath classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.data.App" mainClass.set("net.runelite.data.App")
args(listOf("itemStats", rootProject.file("./runelite-client/src/main/resources/").absolutePath)) args(listOf("itemStats", rootProject.file("./runelite-client/src/main/resources/").absolutePath))
} }
@@ -65,7 +65,7 @@ tasks {
group = "openosrs" group = "openosrs"
classpath = project.sourceSets.main.get().runtimeClasspath classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.data.App" mainClass.set("net.runelite.data.App")
args(listOf("itemLimits", rootProject.file("./runelite-client/src/main/resources/").absolutePath)) args(listOf("itemLimits", rootProject.file("./runelite-client/src/main/resources/").absolutePath))
} }
} }