gradle: kts dsl (#1845)

* gradle: kts dsl

* deob: Fix tests

* gradle: Convert fernflower plugin to kotlin
This commit is contained in:
Owain van Brakel
2019-10-27 19:35:25 +01:00
committed by Ganom
parent a3667f10e3
commit b859cec91a
52 changed files with 1598 additions and 975 deletions

View File

@@ -1,118 +0,0 @@
import org.apache.tools.ant.filters.ReplaceTokens
import java.text.SimpleDateFormat
plugins {
id 'com.github.johnrengelman.shadow' version '5.1.0'
id 'java'
}
description = 'RuneLite Client'
dependencies {
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok
compileOnly group: 'javax.annotation', name: 'javax.annotation-api', version: javax
compileOnly group: 'net.runelite', name: 'orange-extensions', version: orangeExtensions
compileOnly group: 'org.projectlombok', name: 'lombok', version: lombok
implementation group: 'ch.qos.logback', name: 'logback-classic', version: logback
implementation group: 'com.google.code.gson', name: 'gson', version: gson
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'com.google.inject', name: 'guice', version: guice, classifier: 'no_aop'
implementation group: 'com.h2database', name: 'h2', version: h2
implementation group: 'com.jakewharton.rxrelay2', name: 'rxrelay', version: rxrelay
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: okhttp3
implementation group: 'io.reactivex.rxjava2', name: 'rxjava', version: rxjava
implementation group: 'net.java.dev.jna', name: 'jna', version: jna
implementation group: 'net.java.dev.jna', name: 'jna-platform', version: jna
implementation group: 'net.runelite', name: 'discord', version: discord
implementation group: 'net.runelite.pushingpixels', name: 'substance', version: substance
implementation group: 'net.sf.jopt-simple', name: 'jopt-simple', version: jopt
implementation group: 'org.apache.commons', name: 'commons-text', version: apacheCommonsText
implementation group: 'org.apache.httpcomponents', name: 'httpcore', version: httpcore
implementation group: 'org.apache.httpcomponents', name: 'httpmime', version: httpmime
implementation group: 'org.codehaus.plexus', name: 'plexus-utils', version: plexus
implementation group: 'org.javassist', name: 'javassist', version: javassist
implementation group: 'org.jetbrains', name: 'annotations', version: annotations
implementation group: 'org.jogamp.gluegen', name: 'gluegen-rt', version: jogamp
implementation group: 'org.jogamp.jogl', name: 'jogl-all', version: jogamp
implementation group: 'org.jooq', name: 'jooq', version: jooq
implementation group: 'org.jooq', name: 'jooq-codegen', version: jooq
implementation group: 'org.jooq', name: 'jooq-meta', version: jooq
implementation group: 'org.ow2.asm', name: 'asm-tree', version: asm
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
implementation group: 'org.xeustechnologies', name: 'jcl-core', version: jclCore
implementation project(':http-api')
implementation project(':runelite-api')
implementation(group: 'io.sigpipe', name: 'jbsdiff', version: jbsdiff) {
exclude(module: 'xz')
}
implementation group: 'com.github.joonasvali.naturalmouse', name: 'naturalmouse', version: '2.0.2'
runtime group: 'net.runelite.pushingpixels', name: 'trident', version: trident
runtime group: 'org.jogamp.gluegen', name: 'gluegen-rt', version: jogamp, classifier: 'natives-linux-amd64'
runtime group: 'org.jogamp.gluegen', name: 'gluegen-rt', version: jogamp, classifier: 'natives-linux-i586'
runtime group: 'org.jogamp.gluegen', name: 'gluegen-rt', version: jogamp, classifier: 'natives-windows-amd64'
runtime group: 'org.jogamp.gluegen', name: 'gluegen-rt', version: jogamp, classifier: 'natives-windows-i586'
runtime group: 'org.jogamp.jogl', name: 'jogl-all', version: jogamp, classifier: 'natives-linux-amd64'
runtime group: 'org.jogamp.jogl', name: 'jogl-all', version: jogamp, classifier: 'natives-linux-i586'
runtime group: 'org.jogamp.jogl', name: 'jogl-all', version: jogamp, classifier: 'natives-windows-amd64'
runtime group: 'org.jogamp.jogl', name: 'jogl-all', version: jogamp, classifier: 'natives-windows-i586'
runtime project(':injected-client')
runtime project(':runescape-api')
testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok
testCompileOnly group: 'org.projectlombok', name: 'lombok', version: lombok
testImplementation group: 'com.google.inject.extensions', name: 'guice-grapher', version: guice
testImplementation group: 'com.google.inject.extensions', name: 'guice-testlib', version: guice
testImplementation group: 'junit', name: 'junit', version: junit
testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: hamcrest
testImplementation group: 'org.mockito', name: 'mockito-core', version: mockito
testImplementation group: 'org.mockito', name: 'mockito-inline', version: mockito
testImplementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
}
static def getDate() {
return new SimpleDateFormat("MM-dd-yyyy", Locale.forLanguageTag("en-US")).format(new Date())
}
def buildDate = getDate()
processResources {
from file("src/main/resources/open.osrs.properties"), {
filter(ReplaceTokens, tokens: [
"project.version": project.version,
"rs.version": rsversion.toString(),
"open.osrs.version": plusVersion.toString(),
"open.osrs.builddate": buildDate.toString(),
"launcher.version": launcherVersion.toString()
])
}
}
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
jar {
manifest {
attributes 'Main-Class': 'net.runelite.client.RuneLite'
}
}
shadowJar {
archiveClassifier.set("shaded")
exclude("net/runelite/injector/**")
}
task dependencyReportFile(type: DependencyReportTask) {
outputFile = file('dependencies.txt')
Set configs = [project.configurations.runtimeClasspath]
setConfigurations(configs)
}
tasks.build.dependsOn tasks.shadowJar
tasks.shadowJar.dependsOn tasks.dependencyReportFile

View File

@@ -0,0 +1,153 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import org.apache.tools.ant.filters.ReplaceTokens
import java.util.Date
import java.text.SimpleDateFormat
buildscript {
dependencies {
classpath(gradleApi())
}
}
plugins {
id(Plugins.shadow.first) version Plugins.shadow.second
java
}
description = "RuneLite Client"
dependencies {
annotationProcessor(Libraries.lombok)
compileOnly(Libraries.javax)
compileOnly(Libraries.orangeExtensions)
compileOnly(Libraries.lombok)
implementation(Libraries.logback)
implementation(Libraries.gson)
implementation(Libraries.guava)
implementation(Libraries.guice)
implementation(Libraries.h2)
implementation(Libraries.rxrelay)
implementation(Libraries.okhttp3)
implementation(Libraries.rxjava)
implementation(Libraries.jna)
implementation(Libraries.jnaPlatform)
implementation(Libraries.discord)
implementation(Libraries.substance)
implementation(Libraries.jopt)
implementation(Libraries.apacheCommonsText)
implementation(Libraries.httpcore)
implementation(Libraries.httpmime)
implementation(Libraries.plexus)
implementation(Libraries.javassist)
implementation(Libraries.annotations)
implementation(Libraries.jogampGluegen)
implementation(Libraries.jogampJogl)
implementation(Libraries.jooq)
implementation(Libraries.jooqCodegen)
implementation(Libraries.jooqMeta)
implementation(Libraries.asmTree)
implementation(Libraries.slf4jApi)
implementation(Libraries.jclCore)
implementation(project(":http-api"))
implementation(project(":runelite-api"))
implementation(Libraries.jbsdiff) {
exclude(module = "xz")
}
implementation(Libraries.naturalMouse)
runtime(Libraries.trident)
runtime(Libraries.jogampGluegenLinuxAmd64)
runtime(Libraries.jogampGluegenLinuxI586)
runtime(Libraries.jogampGluegenWindowsAmd64)
runtime(Libraries.jogampGluegenWindowsI586)
runtime(Libraries.jogampJoglLinuxAmd64)
runtime(Libraries.jogampJoglLinuxI586)
runtime(Libraries.jogampJoglWindowsAmd64)
runtime(Libraries.jogampJoglWindowsI586)
runtime(project(":injected-client"))
runtime(project(":runescape-api"))
testAnnotationProcessor(Libraries.lombok)
testCompileOnly(Libraries.lombok)
testImplementation(Libraries.guiceGrapher)
testImplementation(Libraries.guiceTestlib)
testImplementation(Libraries.junit)
testImplementation(Libraries.hamcrest)
testImplementation(Libraries.mockitoCore)
testImplementation(Libraries.mockitoInline)
testImplementation(Libraries.slf4jApi)
}
fun formatDate(date: Date?) = with(date ?: Date()) {
SimpleDateFormat("MM-dd-yyyy").format(this)
}
tasks {
register<DependencyReportTask>("dependencyReportFile") {
outputFile = file("dependencies.txt")
setConfiguration("runtimeClasspath")
}
build {
finalizedBy("shadowJar")
}
"processResources"(ProcessResources::class) {
val tokens = mapOf(
"project.version" to ProjectVersions.rlVersion,
"rs.version" to ProjectVersions.rsversion.toString(),
"open.osrs.version" to ProjectVersions.openosrsVersion,
"open.osrs.builddate" to formatDate(Date()),
"launcher.version" to ProjectVersions.launcherVersion
)
inputs.properties(tokens)
from("src/main/resources") {
include("open.osrs.properties")
filter<ReplaceTokens>("tokens" to tokens)
}
}
jar {
manifest {
attributes(mutableMapOf("Main-Class" to "net.runelite.client.RuneLite"))
}
}
shadowJar {
dependsOn("dependencyReportFile")
archiveClassifier.set("shaded")
exclude("net/runelite/injector/**")
}
}