Skip to content

Commit

Permalink
gradle: Refactor and update to gradle 6
Browse files Browse the repository at this point in the history
  • Loading branch information
Owain94 committed Nov 10, 2019
1 parent 7085ad1 commit 18021f6
Show file tree
Hide file tree
Showing 22 changed files with 172 additions and 121 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,4 @@ jobs:
PULL_REQUEST_TITLE: 'project: Update gradle wrapper'
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
29 changes: 26 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
27 changes: 25 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
59 changes: 30 additions & 29 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}

Expand All @@ -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 {
Expand All @@ -120,6 +111,7 @@ subprojects {
}
}


tasks {
java {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -129,6 +121,13 @@ subprojects {
withType<JavaCompile> {
options.encoding = "UTF-8"
}

withType<Checkstyle> {
group = "verification"

exclude("**/ScriptVarType.java")
exclude("**/LayoutSolver.java")
}
}
}

Expand All @@ -138,6 +137,8 @@ application {

tasks {
named<JavaExec>("run") {
group = "openosrs"

classpath = project(":runelite-client").sourceSets.main.get().runtimeClasspath
}

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ plugins {
}

repositories {
mavenCentral()
jcenter()
maven(url = "https://raw.githubusercontent.com/open-osrs/hosting/master")
}

Expand Down
23 changes: 11 additions & 12 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,15 @@ 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")
}

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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down
10 changes: 8 additions & 2 deletions cache/cache.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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"
}
}
18 changes: 7 additions & 11 deletions cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -48,11 +49,6 @@
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Loading

0 comments on commit 18021f6

Please sign in to comment.