Skip to content

Commit

Permalink
Merge branch 'exp/1.4' into share-multiproject-jars
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 authored Sep 25, 2023
2 parents a87826d + bd09af1 commit 99d5356
Show file tree
Hide file tree
Showing 61 changed files with 1,593 additions and 290 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [8.1.0-jdk17]
version: [8.3.0-jdk17]
runs-on: ubuntu-22.04
container:
image: gradle:${{ matrix.version }}
Expand All @@ -27,7 +27,7 @@ jobs:

runs-on: ubuntu-22.04
container:
image: gradle:8.1.0-jdk17
image: gradle:8.3.0-jdk17
options: --user root

steps:
Expand All @@ -46,7 +46,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [8.1.0-jdk17]
version: [8.3.0-jdk17]
test: ${{ fromJson(needs.prepare_test_matrix.outputs.matrix) }}

runs-on: ubuntu-22.04
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@
!/Jenkinsfile
!/checkstyle.xml
!/codenarc.groovy
!/bootstrap
!/bootstrap

/src/**/generated
6 changes: 4 additions & 2 deletions bootstrap/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ plugins {
id 'groovy'
}

sourceCompatibility = 8
targetCompatibility = 8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
@SuppressWarnings("unused")
public class LoomGradlePluginBootstrap implements Plugin<PluginAware> {
private static final String MIN_SUPPORTED_GRADLE_VERSION = "8.1";
private static final String MIN_SUPPORTED_GRADLE_VERSION = "8.3";
private static final int MIN_SUPPORTED_MAJOR_JAVA_VERSION = 17;
private static final int MIN_SUPPORTED_MAJOR_IDEA_VERSION = 2021;

Expand Down
147 changes: 109 additions & 38 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,37 @@ plugins {
id 'checkstyle'
id 'jacoco'
id 'codenarc'
alias(libs.plugins.kotlin)
id "com.diffplug.spotless" version "6.18.0"
id "org.gradle.test-retry" version "1.5.2"
alias(libs.plugins.kotlin) apply false // Delay this so we can perform magic 🪄 first.
alias(libs.plugins.spotless)
alias(libs.plugins.retry)
}

/**
* Haha this is fun :) The Kotlin gradle plugin triggers deprecation warnings for custom configurations (https://youtrack.jetbrains.com/issue/KT-60879)
* We need to make DefaultConfiguration.isSpecialCaseOfChangingUsage think that our configurstion is a special case and not deprecated.
* We do this by setting DefaultConfiguration.roleAtCreation to LEGACY, thus isInLegacyRole will now return true.
*
* Yeah I know we can just ignore the deprecation warning, but doing so wouldn't alert us to issues when testing against pre-release Gradle versions. Also this is more fun :)
*/
def brokenConfigurations = [
"commonDecompilerRuntimeClasspath",
"fernflowerRuntimeClasspath",
"cfrRuntimeClasspath",
"vineflowerRuntimeClasspath"
]

configurations.configureEach {
if (brokenConfigurations.contains(it.name)) {
// For some reason Gradle stops us from using Groovy magic to do this, so lets do it the boring way.
def field = org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.class.getDeclaredField("roleAtCreation")
field.setAccessible(true)
field.set(it, ConfigurationRoles.LEGACY)
}
}

// Ensure we apply the Kotlin plugin after, to allow for the above configuration to take place first
apply plugin: libs.plugins.kotlin.get().pluginId

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
}
Expand All @@ -24,8 +50,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
}

group = 'net.fabricmc'
archivesBaseName = project.name
def baseVersion = '1.3'
def baseVersion = '1.4'

def ENV = System.getenv()
if (ENV.BUILD_NUMBER) {
Expand Down Expand Up @@ -63,45 +88,79 @@ configurations.all {
}
}

sourceSets {
commonDecompiler {
java {
srcDir("src/decompilers/common")
}
}
fernflower {
java {
srcDir("src/decompilers/fernflower")
}
}
cfr {
java {
srcDir("src/decompilers/cfr")
}
}
vineflower {
java {
srcDir("src/decompilers/vineflower")
}
}
}

dependencies {
implementation gradleApi()

bootstrap project(":bootstrap")

// libraries
implementation ('commons-io:commons-io:2.11.0')
implementation ('com.google.code.gson:gson:2.10.1')
implementation ('com.fasterxml.jackson.core:jackson-databind:2.14.2')
implementation ('com.google.guava:guava:31.1-jre')
implementation ('org.ow2.asm:asm:9.5')
implementation ('org.ow2.asm:asm-analysis:9.5')
implementation ('org.ow2.asm:asm-commons:9.5')
implementation ('org.ow2.asm:asm-tree:9.5')
implementation ('org.ow2.asm:asm-util:9.5')
implementation libs.commons.io
implementation libs.gson
implementation libs.jackson
implementation libs.guava
implementation libs.bundles.asm

// game handling utils
implementation ('net.fabricmc:stitch:0.6.2') {
implementation (libs.fabric.stitch) {
exclude module: 'enigma'
}

// tinyfile management
implementation ('net.fabricmc:tiny-remapper:0.8.7')
implementation 'net.fabricmc:access-widener:2.1.0'
implementation 'net.fabricmc:mapping-io:0.2.1'
implementation libs.fabric.tiny.remapper
implementation libs.fabric.access.widener
implementation libs.fabric.mapping.io

implementation ('net.fabricmc:lorenz-tiny:4.0.2') {
implementation (libs.fabric.lorenz.tiny) {
transitive = false
}

// decompilers
implementation ('net.fabricmc:fabric-fernflower:2.0.0')
implementation ('net.fabricmc:cfr:0.2.1')
fernflowerCompileOnly runtimeLibs.fernflower
fernflowerCompileOnly libs.fabric.mapping.io

cfrCompileOnly runtimeLibs.cfr
cfrCompileOnly libs.fabric.mapping.io

vineflowerCompileOnly runtimeLibs.vineflower
vineflowerCompileOnly libs.fabric.mapping.io

fernflowerApi sourceSets.commonDecompiler.output
cfrApi sourceSets.commonDecompiler.output
vineflowerApi sourceSets.commonDecompiler.output

implementation sourceSets.commonDecompiler.output
implementation sourceSets.fernflower.output
implementation sourceSets.cfr.output
implementation sourceSets.vineflower.output

// source code remapping
implementation ('net.fabricmc:mercury:0.3.0')
implementation libs.fabric.mercury

// Kotlin
implementation('org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.6.2') {
implementation(libs.kotlin.metadata) {
transitive = false
}

Expand All @@ -110,20 +169,21 @@ dependencies {

// Testing
testImplementation(gradleTestKit())
testImplementation('org.spockframework:spock-core:2.3-groovy-3.0') {
testImplementation(testLibs.spock) {
exclude module: 'groovy-all'
}
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.2'
testImplementation ('io.javalin:javalin:5.4.2') {
testImplementation testLibs.junit.jupiter.engine
testRuntimeOnly testLibs.junit.platform.launcher
testImplementation (testLibs.javalin) {
exclude group: 'org.jetbrains.kotlin'
}
testImplementation 'org.mockito:mockito-core:5.2.0'
testImplementation 'com.microsoft.java:com.microsoft.java.debug.core:0.46.0'
testImplementation testLibs.mockito
testImplementation testLibs.java.debug

compileOnly 'org.jetbrains:annotations:24.0.1'
testCompileOnly 'org.jetbrains:annotations:24.0.1'
compileOnly runtimeLibs.jetbrains.annotations
testCompileOnly runtimeLibs.jetbrains.annotations

testCompileOnly ('net.fabricmc:sponge-mixin:0.11.4+mixin.0.8.5') {
testCompileOnly (testLibs.mixin) {
transitive = false
}
}
Expand All @@ -134,17 +194,24 @@ jar {
}

from configurations.bootstrap.collect { it.isDirectory() ? it : zipTree(it) }
from sourceSets.commonDecompiler.output.classesDirs
from sourceSets.cfr.output.classesDirs
from sourceSets.fernflower.output.classesDirs
from sourceSets.vineflower.output.classesDirs
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
base {
archivesName = project.name
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}

java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

spotless {
Expand Down Expand Up @@ -174,11 +241,11 @@ spotless {

checkstyle {
configFile = file('checkstyle.xml')
toolVersion = '10.6.0'
toolVersion = libs.versions.checkstyle.get()
}

codenarc {
toolVersion = "3.2.0"
toolVersion = libs.versions.codenarc.get()
configFile = file("codenarc.groovy")
}

Expand All @@ -192,7 +259,7 @@ gradlePlugin {
}

jacoco {
toolVersion = "0.8.8"
toolVersion = libs.versions.jacoco.get()
}

// Run to get test coverage.
Expand All @@ -201,7 +268,7 @@ jacocoTestReport {
reports {
xml.required = false
csv.required = false
html.outputLocation = file("${buildDir}/jacocoHtml")
html.outputLocation = file("${layout.buildDirectory.get().asFile}/jacocoHtml")
}
}

Expand All @@ -223,6 +290,8 @@ test {
}
}


import org.gradle.api.internal.artifacts.configurations.ConfigurationRoles
import org.gradle.launcher.cli.KotlinDslVersion
import org.gradle.util.GradleVersion
import org.w3c.dom.Document
Expand All @@ -234,7 +303,7 @@ publishing {
// Also publish a snapshot so people can use the latest version if they wish
snapshot(MavenPublication) { publication ->
groupId project.group
artifactId project.archivesBaseName
artifactId project.base.archivesName.get()
version baseVersion + '-SNAPSHOT'

from components.java
Expand Down Expand Up @@ -360,3 +429,5 @@ class PrintActionsTestName extends DefaultTask {
new File(System.getenv().GITHUB_OUTPUT) << "\ntest=$sanitised"
}
}

apply from: rootProject.file('gradle/versions.gradle')
50 changes: 48 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,54 @@
[versions]
kotlin = "1.8.10"
kotlin = "1.9.0"
asm = "9.5"
commons-io = "2.13.0"
gson = "2.10.1"
jackson = "2.15.2"
guava = "32.1.2-jre"

stitch = "0.6.2"
tiny-remapper = "0.8.9"
access-widener = "2.1.0"
mapping-io = "0.4.2"
lorenz-tiny = "4.0.2"
mercury = "0.4.0"
kotlinx-metadata = "0.7.0"

# Plugins
spotless = "6.20.0"
test-retry = "1.5.4"
checkstyle = "10.12.2"
codenarc = "3.3.0"
jacoco = "0.8.10"

[libraries]
# Loom compile libraries
asm = { module = "org.ow2.asm:asm", version.ref = "asm" }
asm-analysis = { module = "org.ow2.asm:asm-analysis", version.ref = "asm" }
asm-commons = { module = "org.ow2.asm:asm-commons", version.ref = "asm" }
asm-tree = { module = "org.ow2.asm:asm-tree", version.ref = "asm" }
asm-util = { module = "org.ow2.asm:asm-util", version.ref = "asm" }

commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" }
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
jackson = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }

fabric-stitch = { module = "net.fabricmc:stitch", version.ref = "stitch" }
fabric-tiny-remapper = { module = "net.fabricmc:tiny-remapper", version.ref = "tiny-remapper" }
fabric-access-widener = { module = "net.fabricmc:access-widener", version.ref = "access-widener" }
fabric-mapping-io = { module = "net.fabricmc:mapping-io", version.ref = "mapping-io" }
fabric-lorenz-tiny = { module = "net.fabricmc:lorenz-tiny", version.ref = "lorenz-tiny" }
fabric-mercury = { module = "net.fabricmc:mercury", version.ref = "mercury" }

# Misc
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-metadata = { module = "org.jetbrains.kotlinx:kotlinx-metadata-jvm", version.ref = "kotlinx-metadata" }

[plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
retry = { id = "org.gradle.test-retry", version.ref = "test-retry" }

[bundles]
asm = ["asm", "asm-analysis", "asm-commons", "asm-tree", "asm-util"]
Loading

0 comments on commit 99d5356

Please sign in to comment.