apply plugin: 'java' sourceSets { // Only defines classes that override the package-private Google methods as public, to allow access from other // packages. Loaded on the app classloader googleaccess { java } // Defines custom implementations of ImmutableMap (and related classes). These classes live on the transforming/knot // classloader, but need to be loaded after googleaccess googleimpl { java { compileClasspath += googleaccess.output + main.compileClasspath + main.output } } main { java { runtimeClasspath += googleimpl.output } } test { java { runtimeClasspath += googleaccess.output + googleimpl.output } } } dependencies { compileOnly "com.google.code.findbugs:jsr305:3.+" // We depend on fabric loader here to use the fabric @Environment annotations // Do NOT use other classes from fabric loader modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" testImplementation(platform('org.junit:junit-bom:5.7.1')) testImplementation('org.junit.jupiter:junit-jupiter') googleaccessCompileOnly('com.google.guava:guava:31.0.1-jre') googleaccessCompileOnly('org.jetbrains:annotations:19.0.0') } architectury { injectInjectables = false common() } jar { // Move googleaccess to a directory that does not match the package to prevent accidental loads into('googleaccess') { from sourceSets.googleaccess.output rename { String filename -> // Add suffix to stop parts of the toolchain from moving these classes to the "correct" package filename + "_manual" } } from(sourceSets.googleimpl.output) } test { useJUnitPlatform() } configurations { dev } artifacts { dev(jar) }