Files
architectury-loom/build.gradle
shedaniel ec2b47fa14 Merge remote-tracking branch 'FabricMC/dev/0.8' into dev/0.8
# Conflicts:
#	README.md
#	build.gradle
#	src/main/java/net/fabricmc/loom/LoomGradlePlugin.java
#	src/main/java/net/fabricmc/loom/build/mixin/AnnotationProcessorInvoker.java
#	src/main/java/net/fabricmc/loom/configuration/DependencyProvider.java
#	src/main/java/net/fabricmc/loom/configuration/mods/ModProcessor.java
#	src/main/java/net/fabricmc/loom/configuration/providers/MinecraftProvider.java
#	src/main/java/net/fabricmc/loom/configuration/providers/minecraft/assets/MinecraftAssetsProvider.java
#	src/main/java/net/fabricmc/loom/task/GenVsCodeProjectTask.java
2021-05-14 06:43:07 +08:00

313 lines
7.9 KiB
Groovy

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id 'java'
id 'maven-publish'
id 'java-gradle-plugin'
id 'idea'
id 'eclipse'
id 'groovy'
id 'checkstyle'
id 'jacoco'
id 'codenarc'
id "org.cadixdev.licenser" version "0.5.0"
id 'com.github.johnrengelman.shadow' version '4.0.4'
}
sourceCompatibility = 16
targetCompatibility = 16
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 16
}
group = "dev.architectury"
archivesBaseName = project.name
def baseVersion = '0.8.0'
def runNumber = System.getenv("GITHUB_RUN_NUMBER") ?: "9999"
def isSnapshot = System.getenv("PR_NUM") != null
def buildNum = "release #$runNumber"
if (!isSnapshot) {
version = baseVersion + "." + runNumber
} else {
version = baseVersion + "-PR." + System.getenv("PR_NUM") + "." + runNumber
}
logger.lifecycle(":building plugin v${version}")
configurations {
forgeInjectShadow
forgeInjectCompileClasspath.extendsFrom(forgeInjectShadow)
forgeInjectRuntimeClasspath.extendsFrom(forgeInjectShadow)
}
sourceSets {
forgeInject
}
repositories {
mavenCentral()
maven { url "https://maven.fabricmc.net/" }
maven { url "https://maven.architectury.dev/" }
maven { url "https://maven.minecraftforge.net/" }
}
dependencies {
implementation gradleApi()
// libraries
implementation ('commons-io:commons-io:2.8.0')
implementation ('org.zeroturnaround:zt-zip:1.14')
implementation ('com.google.code.gson:gson:2.8.6')
implementation ('com.fasterxml.jackson.core:jackson-databind:2.12.3')
implementation ('com.google.guava:guava:30.1-jre')
implementation ('org.ow2.asm:asm:9.1')
implementation ('org.ow2.asm:asm-analysis:9.1')
implementation ('org.ow2.asm:asm-commons:9.1')
implementation ('org.ow2.asm:asm-tree:9.1')
implementation ('org.ow2.asm:asm-util:9.1')
implementation ('me.tongfei:progressbar:0.9.0')
// game handling utils
implementation ('net.fabricmc:stitch:0.6.1') {
exclude module: 'mercury'
exclude module: 'enigma'
}
// tinyfile management
implementation ('dev.architectury:tiny-remapper:1.0.0')
implementation ('dev.architectury:mappings-layers-core:1.1.6')
implementation ('net.fabricmc:tiny-mappings-parser:0.3.0+build.17')
implementation 'net.fabricmc:access-widener:1.0.0'
implementation ('net.fabricmc:lorenz-tiny:3.0.0') {
transitive = false
}
implementation ('org.cadixdev:lorenz-io-proguard:0.5.6')
implementation "dev.architectury:refmap-remapper:1.0.5"
// decompilers
implementation ('net.fabricmc:fabric-fernflower:1.4.0')
implementation ('org.benf:cfr:0.151')
// source code remapping
implementation ('org.cadixdev:mercury:0.2.9-architectury')
// Kapt integration
compileOnly('org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0')
// Forge patches
implementation ('net.minecraftforge:binarypatcher:1.1.1')
implementation ('org.cadixdev:lorenz:0.5.3')
implementation ('org.cadixdev:lorenz-asm:0.5.3')
implementation ('net.minecraftforge:accesstransformers:2.2.0')
implementation ('de.oceanlabs.mcp:mcinjector:3.8.0')
implementation ('com.opencsv:opencsv:5.4')
// Forge injection
forgeInjectShadow ('net.fabricmc:tiny-mappings-parser:0.2.2.14')
forgeInjectImplementation ('cpw.mods:modlauncher:6.1.3')
forgeInjectImplementation ('org.spongepowered:mixin:0.8.2')
forgeInjectImplementation ('com.google.code.gson:gson:2.8.6')
forgeInjectImplementation ('com.google.guava:guava:21.0')
forgeInjectImplementation ('org.apache.logging.log4j:log4j-api:2.11.2')
// Testing
testImplementation(gradleTestKit())
testImplementation('org.spockframework:spock-core:2.0-M5-groovy-3.0') {
exclude module: 'groovy-all'
}
testImplementation 'io.javalin:javalin:3.13.7'
compileOnly 'org.jetbrains:annotations:20.1.0'
}
task forgeInjectJar(type: ShadowJar, dependsOn: [compileForgeInjectJava, processForgeInjectResources]) {
configurations = [project.configurations.forgeInjectShadow]
classifier = 'forgeinject'
from compileForgeInjectJava.outputs
from processForgeInjectResources.outputs
}
jar {
classifier 'jar'
}
task mainJar(type: Jar, dependsOn: jar) {
dependsOn forgeInjectJar
from zipTree(jar.archivePath)
from(forgeInjectJar.outputs) {
into "inject"
rename { "injection.jar" }
}
manifest {
attributes 'Implementation-Version': project.version + ' Build(' + buildNum + ')'
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
license {
header rootProject.file("HEADER")
include "**/*.java"
include "**/*.groovy"
exclude '**/loom/util/DownloadUtil.java'
exclude '**/projects'
exclude '**/loom/util/FileSystemUtil.java'
exclude '**/loom/inject/mixin/MixinIntermediaryDevRemapper.java'
}
checkstyle {
configFile = file('checkstyle.xml')
toolVersion = '8.42'
}
codenarc {
toolVersion = "2.1.0"
configFile = file("codenarc.groovy")
}
gradlePlugin {
plugins {
fabricLoom {
id = 'dev.architectury.loom'
implementationClass = 'net.fabricmc.loom.LoomGradlePlugin'
}
}
}
build.dependsOn mainJar
jacoco {
toolVersion = "0.8.6"
}
// Run to get test coverage.
jacocoTestReport {
dependsOn test
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/jacocoHtml")
}
}
test {
maxHeapSize = "4096m"
useJUnitPlatform()
}
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.Node
publishing {
publications {
plugin(MavenPublication) {
groupId 'dev.architectury.loom'
artifactId 'dev.architectury.loom.gradle.plugin'
from components.java
artifact mainJar
artifact sourcesJar
}
maven(MavenPublication) { publication ->
groupId project.group
artifactId project.archivesBaseName
from components.java
artifact mainJar
artifact sourcesJar
artifact javadocJar
}
if (isSnapshot) return
mavenSnapshot(MavenPublication) { publication ->
groupId project.group
artifactId project.archivesBaseName
version baseVersion + '-SNAPSHOT'
from components.java
artifact mainJar
artifact sourcesJar
artifact javadocJar
}
pluginSnapshot(MavenPublication) {
groupId 'dev.architectury.loom'
artifactId 'dev.architectury.loom.gradle.plugin'
version baseVersion + '-SNAPSHOT'
pom.withXml {
// Based off org.gradle.plugin.devel.plugins.MavenPluginPublishPlugin
Element root = asElement()
Document document = root.getOwnerDocument()
Node dependencies = root.appendChild(document.createElement('dependencies'))
Node dependency = dependencies.appendChild(document.createElement('dependency'))
Node groupId = dependency.appendChild(document.createElement('groupId'))
groupId.setTextContent(project.group)
Node artifactId = dependency.appendChild(document.createElement('artifactId'))
artifactId.setTextContent(project.archivesBaseName)
Node version = dependency.appendChild(document.createElement('version'))
version.setTextContent(baseVersion + '-SNAPSHOT')
}
}
}
repositories {
if (System.getenv("MAVEN_PASS") != null) {
maven {
url = "https://deploy.shedaniel.me/"
credentials {
username = "shedaniel"
password = System.getenv("MAVEN_PASS")
}
}
}
}
}
// A task to output a json file with a list of all the test to run
task writeActionsTestMatrix() {
doLast {
def testMatrix = []
file('src/test/groovy/net/fabricmc/loom/test/integration').eachFile {
if (it.name.endsWith("Test.groovy")) {
if (it.name.endsWith("ReproducibleBuildTest.groovy")) {
// This test gets a special case to run across all os's
return
}
def className = it.name.replace(".groovy", "")
testMatrix.add("net.fabricmc.loom.test.integration.${className}")
}
}
// Run all the unit tests togeather
testMatrix.add("net.fabricmc.loom.test.unit.*")
def json = groovy.json.JsonOutput.toJson(testMatrix)
def output = file("build/test_matrix.json")
output.parentFile.mkdir()
output.text = json
}
}