242 lines
7.7 KiB
Groovy
242 lines
7.7 KiB
Groovy
/*
|
|
* This file is part of Applied Energistics 2.
|
|
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
|
*
|
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
|
*/
|
|
|
|
plugins {
|
|
id 'java'
|
|
id 'fabric-loom'
|
|
id 'maven-publish'
|
|
id "com.diffplug.gradle.spotless" version "4.3.0"
|
|
id "com.matthewprenger.cursegradle" version "1.4.0"
|
|
id "org.sonarqube" version "2.8"
|
|
id "jacoco"
|
|
}
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
jcenter()
|
|
mavenCentral()
|
|
maven { url = "https://maven.fabricmc.net/" }
|
|
maven {
|
|
name = "BuildCraft"
|
|
url = "https://mod-buildcraft.com/maven"
|
|
content {
|
|
includeGroup "alexiil.mc.lib"
|
|
}
|
|
}
|
|
maven {
|
|
name = "HYWLA"
|
|
url = "https://maven.tehnut.info/"
|
|
content {
|
|
includeGroup "mcp.mobius.waila"
|
|
}
|
|
}
|
|
}
|
|
|
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
|
|
compileJava {
|
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
|
|
options.deprecation = false
|
|
}
|
|
|
|
// ensure everything uses UTF-8 and not some random codepage chosen by gradle
|
|
compileJava.options.encoding = 'UTF-8'
|
|
tasks.withType(JavaCompile) {
|
|
options.encoding = 'UTF-8'
|
|
}
|
|
|
|
// Create version number
|
|
ext.pr = System.getenv('PR_NUMBER') ?: ""
|
|
if (ext.pr) {
|
|
version = version + "+pr." + ext.pr
|
|
}
|
|
|
|
ext.branch = System.getenv('BRANCH') ?: ""
|
|
if (ext.branch) {
|
|
version = version + "+branch." + ext.branch
|
|
}
|
|
|
|
ext.tag = System.getenv('TAG') ?: ""
|
|
if (ext.tag && ext.tag.startsWith("fabric/v")) {
|
|
version = ext.tag.substring("fabric/v".length())
|
|
// Validate that the rest is a semver version
|
|
if (version ==~ /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/) {
|
|
println("::set-env name=VERSION::${version}")
|
|
} else {
|
|
throw new GradleException("Invalid semver: $version")
|
|
}
|
|
}
|
|
|
|
// Maven group and artifact name
|
|
group = artifact_group
|
|
archivesBaseName = artifact_basename
|
|
|
|
sourceSets {
|
|
api
|
|
main {
|
|
compileClasspath += sourceSets.api.output
|
|
runtimeClasspath += sourceSets.api.output
|
|
resources {
|
|
srcDir 'src/generated/resources'
|
|
}
|
|
}
|
|
datagen {
|
|
compileClasspath += sourceSets.api.output
|
|
runtimeClasspath += sourceSets.api.output
|
|
compileClasspath += sourceSets.main.output
|
|
runtimeClasspath += sourceSets.main.output
|
|
}
|
|
test {
|
|
compileClasspath += sourceSets.api.output
|
|
runtimeClasspath += sourceSets.api.output
|
|
}
|
|
siteexport {
|
|
compileClasspath += sourceSets.api.output
|
|
runtimeClasspath += sourceSets.api.output
|
|
compileClasspath += sourceSets.main.output
|
|
runtimeClasspath += sourceSets.main.output
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
apiCompile.extendsFrom(compileClasspath)
|
|
datagenCompile.extendsFrom(compileClasspath)
|
|
siteexportCompile.extendsFrom(compileClasspath)
|
|
siteexportRuntime.extendsFrom(runtimeClasspath)
|
|
}
|
|
|
|
apply from: 'gradle/scripts/spotless.gradle'
|
|
|
|
minecraft {
|
|
accessWidener "src/main/resources/appliedenergistics2.accesswidener"
|
|
}
|
|
|
|
dependencies {
|
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
|
|
|
//Fabric api
|
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
|
|
|
|
modImplementation "alexiil.mc.lib:libblockattributes-core:${libblockattributes_version}"
|
|
modImplementation "alexiil.mc.lib:libblockattributes-items:${libblockattributes_version}"
|
|
modImplementation "alexiil.mc.lib:libblockattributes-fluids:${libblockattributes_version}"
|
|
include "alexiil.mc.lib:libblockattributes-core:${libblockattributes_version}"
|
|
include "alexiil.mc.lib:libblockattributes-items:${libblockattributes_version}"
|
|
include "alexiil.mc.lib:libblockattributes-fluids:${libblockattributes_version}"
|
|
|
|
// Energy API
|
|
modApi "teamreborn:energy:${tr_energy_version}"
|
|
include "teamreborn:energy:${tr_energy_version}"
|
|
|
|
modCompileOnly("me.shedaniel:RoughlyEnoughItems:${rei_version}") {
|
|
exclude group: "net.fabricmc.fabric-api"
|
|
}
|
|
modCompileOnly("mcp.mobius.waila:Hwyla:1.16.1-1.9.22-75") {
|
|
exclude group: "net.fabricmc.fabric-api"
|
|
}
|
|
modRuntime("me.shedaniel:RoughlyEnoughItems:${rei_version}") {
|
|
exclude group: "net.fabricmc.fabric-api"
|
|
}
|
|
modRuntime("TechReborn:TechReborn-1.16:3.5.1+build.101") {
|
|
exclude group: "net.fabricmc.fabric-api"
|
|
}
|
|
// modRuntimeOnly "mcp.mobius.waila:Hwyla:1.16.1-1.9.22-75"
|
|
|
|
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
|
|
|
// unit test dependencies
|
|
testCompile "junit:junit:4.13"
|
|
}
|
|
|
|
processResources {
|
|
inputs.property "version", project.version
|
|
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
include "fabric.mod.json"
|
|
expand "version": project.version
|
|
}
|
|
|
|
from(sourceSets.main.resources.srcDirs) {
|
|
exclude "fabric.mod.json"
|
|
}
|
|
}
|
|
|
|
apply from: 'gradle/scripts/artifacts.gradle'
|
|
apply from: 'gradle/scripts/curseforge.gradle'
|
|
|
|
// configure the maven publication
|
|
publishing {
|
|
if (!version.endsWith("-SNAPSHOT")) {
|
|
publications {
|
|
maven(MavenPublication) {
|
|
groupId = project.group
|
|
artifactId = 'appliedenergistics2-fabric'
|
|
version = project.version
|
|
|
|
// add all the jars that should be included when publishing to maven
|
|
artifact(remapJar) {
|
|
builtBy remapJar
|
|
}
|
|
artifact(sourcesJar) {
|
|
builtBy remapSourcesJar
|
|
}
|
|
artifact javadocJar
|
|
artifact apiJar
|
|
}
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
credentials {
|
|
username System.getenv("GITHUB_ACTOR")
|
|
password System.getenv("GITHUB_TOKEN")
|
|
}
|
|
name = "GitHubPackages"
|
|
url = "https://maven.pkg.github.com/AppliedEnergistics/Applied-Energistics-2"
|
|
}
|
|
maven {
|
|
credentials {
|
|
username System.getenv("MODMAVEN_USER")
|
|
password System.getenv("MODMAVEN_PASSWORD")
|
|
}
|
|
name = "modmaven"
|
|
url = "https://modmaven.k-4u.nl/artifactory/local-releases/"
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
import net.fabricmc.loom.task.RunClientTask;
|
|
|
|
task generateData(type: RunClientTask, dependsOn: downloadAssets, group: "ae2", description: "Generates various JSON assets for the mod") {
|
|
classpath = configurations.runtimeClasspath
|
|
classpath sourceSets.api.output
|
|
classpath sourceSets.main.output
|
|
classpath sourceSets.datagen.output
|
|
systemProperty "appeng.generateData", "true"
|
|
}
|
|
build.dependsOn generateData
|
|
|
|
task runSiteExport(type: RunClientTask, dependsOn: downloadAssets, group: "ae2", description: "Export game assets for the website") {
|
|
classpath = configurations.runtimeClasspath
|
|
classpath sourceSets.api.output
|
|
classpath sourceSets.main.output
|
|
classpath sourceSets.siteexport.output
|
|
}
|