Skip to content

Commit

Permalink
project(gradle): Fix warnings and deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Owain94 committed May 30, 2022
1 parent 5c7302f commit 46b6def
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 64 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ subprojects {
}
}

configurations["compileOnly"].extendsFrom(configurations["annotationProcessor"])
configurations.compileOnly.get().extendsFrom(configurations["annotationProcessor"])
}

application {
Expand Down
13 changes: 3 additions & 10 deletions cache/cache.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,16 @@ dependencies {

tasks {
processTestResources {
finalizedBy("filterTestResources")
}

register<Copy>("filterTestResources") {
val tokens = mapOf(
"rs.version" to ProjectVersions.rsversion.toString(),
"cache.version" to ProjectVersions.cacheversion.toString()
)

inputs.properties(tokens)

from("src/test/resources") {
include("cache.properties")
filesMatching("cache.properties") {
filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
}
into("${buildDir}/resources/test")

filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
}
}
40 changes: 15 additions & 25 deletions deobfuscator/deobfuscator.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ plugins {
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 {
deobjars(group = "net.runelite.rs", name = "vanilla", version = ProjectVersions.rsversion.toString())
Expand All @@ -50,7 +54,6 @@ dependencies {

runtimeOnly(group = "org.slf4j", name = "slf4j-simple", version = "1.7.32")

testImplementation(deobjars)
testImplementation(group = "junit", name = "junit", version = "4.12")
testImplementation(group = "org.mockito", name = "mockito-core", version = "3.1.0")
}
Expand All @@ -63,57 +66,44 @@ tasks {
)

processResources {
finalizedBy("filterResources")
}

register<Copy>("filterResources") {
inputs.properties(tokens)

from("src/main/resources") {
include("deob.properties")
filesMatching("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 {
finalizedBy("filterTestResources")
}

register<Copy>("filterTestResources") {
inputs.properties(tokens)

from("src/test/resources") {
include("deob-test.properties")
filesMatching("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
register<JavaExec>("Downloader\$main()") {
group = "gamepack"

classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.gamepack.Downloader"
mainClass.set("net.runelite.gamepack.Downloader")
}

register<JavaExec>("Deob\$main()") {
group = "gamepack"

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")
}

register<JavaExec>("UpdateMappings\$main()") {
group = "gamepack"

classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.deob.updater.UpdateMappings"
mainClass.set("net.runelite.deob.updater.UpdateMappings")
}
}

Expand Down
13 changes: 3 additions & 10 deletions http-api/http-api.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ dependencies {

tasks {
processResources {
finalizedBy("filterResources")
}

register<Copy>("filterResources") {
val tokens = mapOf(
"projectver" to ProjectVersions.rlVersion,
"rsver" to ProjectVersions.rsversion.toString(),
Expand All @@ -58,12 +54,9 @@ tasks {

inputs.properties(tokens)

from("src/main/resources") {
include("runelite.properties")
filesMatching("runelite.properties") {
filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
}
into("${buildDir}/resources/main")

filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
}
}
7 changes: 5 additions & 2 deletions injector/injector.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ tasks.register<JavaExec>("inject") {

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"
outputs.file(out)
classpath = sourceSets["main"].runtimeClasspath

args("--outmode", "jar", "--vanilla", vanillaDep.singleFile, "--version", openosrsVersion, "--output", out)

outputs.upToDateWhen {
false
}
Expand Down
18 changes: 6 additions & 12 deletions runelite-client/runelite-client.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import java.text.SimpleDateFormat
import java.util.Date

plugins {
id("com.github.johnrengelman.shadow") version "6.1.0"
id("com.github.johnrengelman.shadow") version "7.1.2"
java
}

Expand Down Expand Up @@ -137,10 +137,6 @@ tasks {
}

processResources {
finalizedBy("filterResources")
}

register<Copy>("filterResources") {
val tokens = mapOf(
"project.version" to ProjectVersions.rlVersion,
"rs.version" to ProjectVersions.rsversion.toString(),
Expand All @@ -151,12 +147,10 @@ tasks {

inputs.properties(tokens)

from("src/main/resources/")
include("**/*.properties")
into("${buildDir}/resources/main")

filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
filesMatching("**/*.properties") {
filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
}
}

register<Copy>("packInjectedClient") {
Expand Down Expand Up @@ -196,7 +190,7 @@ tasks {
register<JavaExec>("RuneLite.main()") {
group = "openosrs"

classpath = sourceSets["main"].runtimeClasspath
classpath = project.sourceSets.main.get().runtimeClasspath
enableAssertions = true
mainClass.set("net.runelite.client.RuneLite")
}
Expand Down
1 change: 1 addition & 0 deletions runelite-mixins/runelite-mixins.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ tasks {
targetCompatibility = JavaVersion.VERSION_1_8
disableAutoTargetJvm()
}

withType<JavaCompile> {
options.compilerArgs.addAll(arrayOf("-Xlint:-unchecked"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ tasks {
outputs.dir(out)

classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.script.AssembleMojo"
mainClass.set("net.runelite.script.AssembleMojo")
args(listOf(inp, out))

doLast {
Expand Down
6 changes: 3 additions & 3 deletions wiki-scraper/wiki-scraper.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ tasks {
group = "openosrs"

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

register<JavaExec>("itemStatsScrape") {
group = "openosrs"

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

register<JavaExec>("itemLimitsScrape") {
group = "openosrs"

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

0 comments on commit 46b6def

Please sign in to comment.