Gradle modifications

This commit is contained in:
Lucwousin
2019-10-31 01:04:14 +01:00
parent e0142c7f77
commit 1071e43b04
4 changed files with 54 additions and 41 deletions

View File

@@ -29,10 +29,12 @@ import org.ajoberstar.grgit.Grgit
buildscript {
repositories {
maven(url = "https://plugins.gradle.org/m2/")
mavenLocal()
}
dependencies {
classpath(Plugins.grgitPlugin)
classpath(Plugins.versionsPlugin)
classpath(Plugins.injectorPlugin)
}
}
@@ -57,7 +59,9 @@ fun isNonStable(version: String): Boolean {
}
allprojects {
apply<JavaLibraryPlugin>()
apply<MavenPlugin>()
apply<MavenPublishPlugin>()
group = "com.openosrs"
version = ProjectVersions.rlVersion
@@ -66,16 +70,23 @@ allprojects {
project.extra["gitCommitShort"] = localGitCommitShort
project.extra["rootPath"] = rootDir.toString().replace("\\", "/")
project.extra["injectedClassesPath"] = "${rootDir}/injector-plugin/out/injected-client/"
}
subprojects {
apply<JavaLibraryPlugin>()
apply<MavenPlugin>()
apply<MavenPublishPlugin>()
apply(plugin = Plugins.testLogger.first)
if (this.name != "rs-client") apply(plugin = "checkstyle")
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"))
maxWarnings = 0
toolVersion = "6.4.1"
isShowViolations = true
isIgnoreFailures = false
}
}
repositories {
mavenLocal()
@@ -90,16 +101,6 @@ subprojects {
}
}
configure<CheckstyleExtension> {
sourceSets = setOf(project.sourceSets.main.get())
configFile = file("${rootDir}/checkstyle/checkstyle.xml")
configProperties = mapOf("suppressionFile" to file("${rootDir}/checkstyle/suppressions.xml"))
maxWarnings = 0
toolVersion = "6.4.1"
isShowViolations = true
isIgnoreFailures = false
}
configure<PublishingExtension> {
repositories {
maven {

View File

@@ -38,7 +38,7 @@ object ProjectVersions {
object Plugins {
val grgitPlugin = "org.ajoberstar:grgit:2.3.0"
val versionsPlugin = "com.github.ben-manes:gradle-versions-plugin:0.27.0"
val injectorPlugin = "com.openosrs:injector-plugin:1.0.0"
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")

View File

@@ -28,31 +28,44 @@ apply<FernflowerPlugin>()
description = "Injected Client"
tasks {
compileJava {
dependsOn(":injector-plugin:assemble")
outputs.upToDateWhen { false }
doLast {
copy {
val f = file ("build/classes/java/main")
f.deleteRecursively()
f.mkdirs()
from(project.extra["injectedClassesPath"])
into("build/classes/java/main")
}
}
}
classes {
val f = file("build/classes/java/main/Placeholder.class")
f.delete()
}
// this is just here to show how the fernflower plugin could be used
//build {
// dependsOn(project.tasks.getByName("decompile"))
//}
plugins {
id("com.openosrs.injector")
}
configurations {
create("vanilla")
create("injected-client")
}
dependencies {
"vanilla"(Libraries.vanilla)
}
injector {
mixins.set(tasks.getByPath(":runelite-mixins:jar").outputs.files.singleFile)
rsapi.set(tasks.getByPath(":runescape-api:jar").outputs.files.singleFile)
rsclient.set(tasks.getByPath(":runescape-client:jar").outputs.files.singleFile)
vanilla.set(project.file(configurations["vanilla"].asPath))
}
artifacts {
add("runtime", tasks.inject.get().output) {
builtBy(tasks.inject)
}
}
// keep the sourcesets etc but remove useless tasks
tasks {
classes {
enabled = false
}
compileJava {
enabled = false
}
jar {
enabled = false
}
processResources {
enabled = false
}
}

View File

@@ -38,7 +38,6 @@ include(":deobfuscator")
include(":runelite-script-assembler-plugin")
include(":runelite-client")
include(":runelite-mixins")
include(":injector-plugin")
include(":injected-client")
include(":runelite-plugin-archetype")
include(":http-service")
@@ -47,7 +46,7 @@ include(":wiki-scraper")
for (project in rootProject.children) {
project.apply {
projectDir = file("$name")
projectDir = file(name)
buildFileName = "$name.gradle.kts"
require(projectDir.isDirectory) { "Project '${project.path} must have a $projectDir directory" }