gradle: Refactor and update to gradle 6

This commit is contained in:
Owain van Brakel
2019-11-10 01:42:11 +01:00
parent 7085ad14f3
commit 18021f6bed
22 changed files with 172 additions and 121 deletions

View File

@@ -29,28 +29,3 @@ jobs:
PULL_REQUEST_BODY: This is an auto-generated PR with an updated gradle version
COMMIT_MESSAGE: 'project: Update gradle wrapper'
PULL_REQUEST_LABELS: automated-pull-request, gradle
update-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Update Gradle dependencies
run: ./gradlew useLatestVersions --console=plain
- name: Create Gradle dependencies update Pull Request
uses: Owain94/create-pull-request@master
env:
GITHUB_TOKEN: ${{ secrets.OpenOSRS }}
PULL_REQUEST_BRANCH: GRADLE-DEPENDENCY-UPDATE
PULL_REQUEST_TITLE: 'project: Update gradle dependencies'
PULL_REQUEST_BODY: This is an auto-generated PR with an updated gradle dependencies versions
COMMIT_MESSAGE: 'project: Update gradle dependencies'
PULL_REQUEST_LABELS: automated-pull-request, gradle

View File

@@ -60,8 +60,8 @@ jobs:
- name: Testing
run: ./gradlew test --stacktrace --console=plain
checkstyle:
name: Checkstyle
checkstyleMain:
name: Checkstyle main
runs-on: ubuntu-latest
steps:
@@ -83,9 +83,32 @@ jobs:
- name: Checking code conventions
run: ./gradlew checkstyleMain --console=plain
checkstyleTest:
name: Checkstyle test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Assembling
run: ./gradlew assemble --console=plain
- name: Checking code conventions
run: ./gradlew checkstyleTest --console=plain
approve:
name: Approve
needs: [build, test, checkstyle]
needs: [build, test, checkstyleMain, checkstyleTest]
runs-on: ubuntu-latest
steps:

View File

@@ -52,8 +52,8 @@ jobs:
- name: Testing
run: ./gradlew test --stacktrace --console=plain
checkstyle:
name: Checkstyle
checkstyleMain:
name: Checkstyle main
runs-on: ubuntu-latest
steps:
@@ -75,6 +75,29 @@ jobs:
- name: Checking code conventions
run: ./gradlew checkstyleMain --console=plain
checkstyleTest:
name: Checkstyle test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Assembling
run: ./gradlew assemble --console=plain
- name: Checking code conventions
run: ./gradlew checkstyleTest --console=plain
update_draft_release:
name: Draft release
runs-on: ubuntu-latest

View File

@@ -28,9 +28,8 @@ import org.ajoberstar.grgit.Grgit
buildscript {
repositories {
maven(url = "https://plugins.gradle.org/m2/")
gradlePluginPortal()
maven(url = "https://raw.githubusercontent.com/open-osrs/hosting/master")
mavenLocal()
}
dependencies {
classpath(Plugins.grgitPlugin)
@@ -42,10 +41,10 @@ buildscript {
plugins {
id(Plugins.testLogger.first) version Plugins.testLogger.second apply false
id(Plugins.versions.first) version Plugins.versions.second
id(Plugins.buildScan.first) version Plugins.buildScan.second
id(Plugins.latestVersion.first) version Plugins.latestVersion.second
id(Plugins.grgit.first) version Plugins.grgit.second
checkstyle
application
}
@@ -60,48 +59,40 @@ fun isNonStable(version: String): Boolean {
}
allprojects {
apply<JavaLibraryPlugin>()
apply<MavenPlugin>()
apply<MavenPublishPlugin>()
group = "com.openosrs"
version = ProjectVersions.rlVersion
}
subprojects {
repositories {
//mavenLocal()
jcenter()
maven(url = "https://mvnrepository.com/artifact")
maven(url = "https://repo.runelite.net")
maven(url = "https://raw.githubusercontent.com/open-osrs/hosting/master")
maven(url = "https://jitpack.io")
}
apply<JavaLibraryPlugin>()
apply<MavenPublishPlugin>()
apply(plugin = Plugins.testLogger.first)
project.extra["gitCommit"] = localGitCommit
project.extra["gitCommitShort"] = localGitCommitShort
project.extra["rootPath"] = rootDir.toString().replace("\\", "/")
}
subprojects {
apply(plugin = Plugins.testLogger.first)
if (this.name != "runescape-client") {
apply(plugin = "checkstyle")
configure<CheckstyleExtension> {
sourceSets = setOf(project.sourceSets.main.get())
configFile = file("${rootDir}/checkstyle/checkstyle.xml")
configProperties = mapOf("suppressionFile" to file("${rootDir}/checkstyle/suppressions.xml"))
checkstyle {
maxWarnings = 0
toolVersion = "6.4.1"
toolVersion = "8.25"
isShowViolations = true
isIgnoreFailures = false
}
}
repositories {
mavenLocal()
maven(url = "http://repo1.maven.org/maven2")
maven(url = "http://repo.runelite.net")
maven(url = "http://repo.maven.apache.org/maven2")
maven(url = "https://raw.githubusercontent.com/open-osrs/hosting/master")
if (System.getenv("NEXUS-URL") != null) {
maven(url = System.getenv("NEXUS-URL"))
}
}
configure<PublishingExtension> {
repositories {
maven {
@@ -120,6 +111,7 @@ subprojects {
}
}
tasks {
java {
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -129,6 +121,13 @@ subprojects {
withType<JavaCompile> {
options.encoding = "UTF-8"
}
withType<Checkstyle> {
group = "verification"
exclude("**/ScriptVarType.java")
exclude("**/LayoutSolver.java")
}
}
}
@@ -138,6 +137,8 @@ application {
tasks {
named<JavaExec>("run") {
group = "openosrs"
classpath = project(":runelite-client").sourceSets.main.get().runtimeClasspath
}

View File

@@ -28,7 +28,7 @@ plugins {
}
repositories {
mavenCentral()
jcenter()
maven(url = "https://raw.githubusercontent.com/open-osrs/hosting/master")
}

View File

@@ -41,8 +41,7 @@ object Plugins {
val injectorPlugin = "com.openosrs:injector-plugin:1.0.2"
val testLogger = Pair("com.adarshr.test-logger", "2.0.0")
val versions = Pair("com.github.ben-manes.versions", "0.27.0")
val buildScan = Pair("com.gradle.build-scan", "3.0")
val latestVersion = Pair("se.patrikerdes.use-latest-versions", "0.2.12")
val latestVersion = Pair("se.patrikerdes.use-latest-versions", "0.2.13")
val grgit = Pair("org.ajoberstar.grgit", "4.0.0-rc.1")
val jarTest = Pair("com.github.hauner.jarTest", "1.0.1")
val shadow = Pair("com.github.johnrengelman.shadow", "5.1.0")
@@ -50,7 +49,7 @@ object Plugins {
object Libraries {
private object Versions {
const val annotations = "17.0.0"
const val annotations = "18.0.0"
const val antlr = "4.7.2"
const val apacheCommonsCompress = "1.19"
const val apacheCommonsCsv = "1.7"
@@ -73,10 +72,10 @@ object Libraries {
const val jbsdiff = "1.0"
const val jclCore = "2.8"
const val jedis = "3.1.0"
const val jna = "5.4.0"
const val jna = "5.5.0"
const val jogamp = "2.3.2"
const val jopt = "5.0.4"
const val jooq = "3.12.2"
const val jooq = "3.12.3"
const val junit = "4.12"
const val jupiter = "5.6.0-M1"
const val logback = "1.2.3"
@@ -87,22 +86,22 @@ object Libraries {
const val mavenPluginApi = "3.6.2"
const val minio = "6.0.11"
const val mockito = "3.1.0"
const val mongodbDriverSync = "3.11.1"
const val mongodbDriverSync = "3.11.2"
const val mysqlConnectorJava = "8.0.18"
const val naturalMouse = "2.0.2"
const val netty = "4.1.42.Final"
const val netty = "4.1.43.Final"
const val okhttp3 = "4.2.2"
const val orangeExtensions = "1.0"
const val petitparser = "2.2.0"
const val plexus = "3.3.0"
const val rxjava = "2.2.13"
const val rxjava = "2.2.14"
const val rxrelay = "2.1.1"
const val scribejava = "6.9.0"
const val sisu = "0.3.3"
const val sisu = "0.3.4"
const val sentry = "1.7.28"
const val slf4j = "1.7.28"
const val springJdbc = "5.2.0.RELEASE"
const val springboot = "2.2.0.RELEASE"
const val slf4j = "1.7.29"
const val springJdbc = "5.2.1.RELEASE"
const val springboot = "2.2.1.RELEASE"
const val sql2o = "1.6.0"
const val substance = "8.0.02"
const val trident = "1.5.00"

View File

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

View File

@@ -24,18 +24,19 @@
*/
package net.runelite.cache;
import com.google.common.io.FileWriteMode;
import com.google.common.io.Files;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.IOException;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import net.runelite.cache.definitions.loaders.sound.SoundEffectTrackLoader;
import net.runelite.cache.definitions.sound.SoundEffectTrackDefinition;
import net.runelite.cache.fs.Archive;
@@ -48,11 +49,6 @@ import org.junit.rules.TemporaryFolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
public class SoundEffectsDumperTest
{
private static final Logger logger = LoggerFactory.getLogger(SoundEffectsDumperTest.class);

View File

@@ -28,8 +28,8 @@
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="SuppressionCommentFilter"/>
<module name="TreeWalker">
<module name="SuppressionCommentFilter"/>
<module name="LeftCurly">
<property name="option" value="nl"/>
</module>
@@ -58,6 +58,6 @@
<property name="message" value="Newline should not be between else and if"/>
</module>
<module name="SuppressionFilter">
<property name="file" value="${suppressionFile}"/>
<property name="file" value="${config_loc}/suppressions.xml"/>
</module>
</module>

View File

@@ -24,11 +24,10 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.1//EN"
"https://checkstyle.org/dtds/suppressions_1_1.dtd">
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress files="RuntimeTypeAdapterFactory\.java" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]runescape-client[\\/]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]ScriptVarType[\./]" checks="[a-zA-Z0-9]*"/>
<suppress files="[\\/]LayoutSolver[\./]" checks="[a-zA-Z0-9]*"/>
</suppressions>

View File

@@ -45,7 +45,7 @@ dependencies {
implementation(project(":runelite-api"))
implementation(project(":runescape-api"))
runtime(Libraries.slf4jSimple)
runtimeOnly(Libraries.slf4jSimple)
testImplementation(deobjars)
testImplementation(Libraries.junit)
@@ -60,22 +60,34 @@ tasks {
)
processResources {
finalizedBy("filterResources")
}
register<Copy>("filterResources") {
inputs.properties(tokens)
from("src/main/resources") {
include("deob.properties")
filter<ReplaceTokens>("tokens" to tokens)
}
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")
filter<ReplaceTokens>("tokens" to tokens)
}
into("${buildDir}/resources/test")
filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
}
}

View File

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

View File

@@ -49,7 +49,7 @@ injector {
}
artifacts {
add("runtime", tasks.inject.get().output) {
add("runtimeOnly", tasks.inject.get().output) {
builtBy(tasks.inject)
}
}

View File

@@ -27,12 +27,6 @@ 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
@@ -119,8 +113,10 @@ tasks {
}
processResources {
finalizedBy("filterResources")
}
register<Copy>("filterResources") {
val tokens = mapOf(
"project.version" to ProjectVersions.rlVersion,
"rs.version" to ProjectVersions.rsversion.toString(),
@@ -133,13 +129,14 @@ tasks {
from("src/main/resources") {
include("open.osrs.properties")
filter<ReplaceTokens>("tokens" to tokens)
}
into("${buildDir}/resources/main")
filter(ReplaceTokens::class, "tokens" to tokens)
filteringCharset = "UTF-8"
}
jar {
manifest {
attributes(mutableMapOf("Main-Class" to "net.runelite.client.RuneLite"))
}
@@ -148,4 +145,8 @@ tasks {
shadowJar {
archiveClassifier.set("shaded")
}
withType<BootstrapTask> {
group = "openosrs"
}
}

View File

@@ -216,7 +216,8 @@ public class GauntletPlugin extends Plugin
if (client.getGameState() != GameState.STARTING && client.getGameState() != GameState.UNKNOWN)
{
completeStartup = false;
clientThread.invoke(() -> {
clientThread.invoke(() ->
{
timer.initStates();
completeStartup = true;
});

View File

@@ -1194,7 +1194,9 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
glDrawable.swapBuffers();
}
catch (GLException ignored)
{ }
{
// Ignore
}
drawManager.processDrawComplete(this::screenshot);
}

View File

@@ -99,7 +99,8 @@ class NotesPanel extends PluginPanel
private void buildAddTab()
{
addTab = new MaterialTab(addIcon, tabGroup, new JPanel());
addTab.setOnSelectEvent(() -> {
addTab.setOnSelectEvent(() ->
{
notesManager.addPage();
return false;
});
@@ -178,7 +179,8 @@ class NotesPanel extends PluginPanel
final JMenuItem deleteMenuItem = new JMenuItem();
deleteMenuItem.setText(String.format("Delete note %s", name));
deleteMenuItem.addActionListener(e -> {
deleteMenuItem.addActionListener(e ->
{
if (JOptionPane.showConfirmDialog(getRootFrame(), String.format("Delete note page %s?", name), "Notes", YES_NO_OPTION) != YES_OPTION)
{
return;

View File

@@ -331,7 +331,8 @@ public class SwingUtil
button.setOpaque(true);
// Selecting the button option requires us to determine which parent element is the JOptionPane
button.addActionListener(e -> {
button.addActionListener(e ->
{
JComponent component = (JComponent) e.getSource();
while (component != null)
{
@@ -401,7 +402,8 @@ public class SwingUtil
dialog.setIconImage(ImageUtil.getResourceStreamFromClass(SwingUtil.class, "/openosrs.png"));
// Listen for value changes and close dialog when necessary
pane.addPropertyChangeListener(e -> {
pane.addPropertyChangeListener(e ->
{
String prop = e.getPropertyName();
if (dialog.isVisible()

View File

@@ -35,7 +35,6 @@ import net.runelite.api.MessageNode;
import net.runelite.api.events.ChatMessage;
import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.eventbus.EventBus;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@@ -33,7 +33,6 @@ import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.ItemID;
import net.runelite.api.MenuOpcode;
import net.runelite.api.MenuEntry;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.widgets.Widget;

View File

@@ -25,6 +25,10 @@
rootProject.name = "OpenOSRS"
plugins {
id("com.gradle.enterprise").version("3.0")
}
include(":http-api")
include(":cache")
include(":runelite-api")

View File

@@ -23,11 +23,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
repositories {
mavenCentral()
maven(url = "https://jitpack.io")
}
description = "RuneLite Wiki scraper"
dependencies {
@@ -50,18 +45,24 @@ dependencies {
tasks {
register<JavaExec>("npcStatsScrape") {
group = "openosrs"
classpath = project.sourceSets.main.get().runtimeClasspath
main = "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"
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"
args(listOf("itemLimits", rootProject.file("./runelite-client/src/main/resources/").absolutePath))