mirror of https://github.com/FabricMC/yarn.git
117 lines
3.1 KiB
Groovy
117 lines
3.1 KiB
Groovy
import org.gradle.util.GradleVersion
|
|
|
|
plugins {
|
|
id 'java-library'
|
|
id 'java-gradle-plugin'
|
|
id 'checkstyle'
|
|
id 'maven-publish'
|
|
}
|
|
|
|
group = 'net.fabricmc'
|
|
version = project.filament_version
|
|
|
|
def ENV = System.getenv()
|
|
|
|
// Needed to read the main projects properties
|
|
def properties = new Properties()
|
|
file('../gradle.properties').newInputStream().withCloseable {
|
|
properties.load(it)
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
name "Fabric Repository"
|
|
url 'https://maven.fabricmc.net'
|
|
}
|
|
mavenCentral()
|
|
mavenLocal()
|
|
}
|
|
|
|
dependencies {
|
|
implementation "org.ow2.asm:asm:${properties.asm_version}"
|
|
implementation "org.ow2.asm:asm-tree:${properties.asm_version}"
|
|
implementation "cuchaz:enigma:$properties.enigma_version"
|
|
implementation "cuchaz:enigma-cli:$properties.enigma_version"
|
|
implementation "net.fabricmc.unpick:unpick:$properties.unpick_version"
|
|
implementation "net.fabricmc.unpick:unpick-format-utils:$properties.unpick_version"
|
|
implementation "net.fabricmc.unpick:unpick-cli:$properties.unpick_version"
|
|
implementation "net.fabricmc:tiny-remapper:$properties.tiny_remapper_version"
|
|
implementation "net.fabricmc:mappingpoet:$properties.mappingpoet_version"
|
|
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.4.2'
|
|
implementation 'net.fabricmc:mapping-io:0.5.1'
|
|
|
|
// Contains a number of useful utilities we can re-use.
|
|
implementation ("net.fabricmc:fabric-loom:1.5.7") {
|
|
transitive = false
|
|
}
|
|
|
|
testImplementation platform("org.junit:junit-bom:$properties.junit_version")
|
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
|
testImplementation "org.assertj:assertj-core:$properties.assertj_version"
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
options.encoding = "UTF-8"
|
|
options.release = 17
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
checkstyle {
|
|
configFile = file('checkstyle.xml')
|
|
toolVersion = '10.13.0'
|
|
}
|
|
|
|
// Workaround https://github.com/gradle/gradle/issues/27035
|
|
configurations.checkstyle {
|
|
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
|
|
select("com.google.guava:guava:0")
|
|
}
|
|
}
|
|
|
|
gradlePlugin {
|
|
plugins {
|
|
filament {
|
|
id = 'net.fabricmc.filament'
|
|
implementationClass = 'net.fabricmc.filament.FilamentGradlePlugin'
|
|
}
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
repositories {
|
|
if (ENV.MAVEN_URL) {
|
|
repositories.maven {
|
|
name "fabric"
|
|
url ENV.MAVEN_URL
|
|
credentials {
|
|
username ENV.MAVEN_USERNAME
|
|
password ENV.MAVEN_PASSWORD
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Run this task to download the gradle sources next to the api jar, you may need to manually attach the sources jar
|
|
*/
|
|
tasks.register('downloadGradleSources') {
|
|
doLast {
|
|
// Awful hack to find the gradle api location
|
|
def gradleApiFile = project.configurations.detachedConfiguration(dependencies.gradleApi()).files.stream()
|
|
.filter {
|
|
it.name.startsWith("gradle-api")
|
|
}.findFirst().orElseThrow()
|
|
|
|
def gradleApiSources = new File(gradleApiFile.absolutePath.replace(".jar", "-sources.jar"))
|
|
def url = "https://services.gradle.org/distributions/gradle-${GradleVersion.current().getVersion()}-src.zip"
|
|
|
|
gradleApiSources.delete()
|
|
|
|
println("Downloading (${url}) to (${gradleApiSources})")
|
|
gradleApiSources << new URL(url).newInputStream()
|
|
}
|
|
} |