Files
Applied-Energistics-2/build.gradle
T
2020-06-27 23:25:38 +02:00

153 lines
4.3 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 "org.jetbrains.kotlin.jvm" apply false
}
allprojects {
apply plugin: 'fabric-loom'
// Maven group and artifact name
group = artifact_group
// 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.release = System.getenv('RELEASE') ?: ""
if (ext.release) {
version = ext.release.substring(1)
}
// Avoid build-directories for each subproject
setBuildDir(rootProject.getBuildDir())
repositories {
maven { url = "http://maven.fabricmc.net/" }
maven {
name = "BuildCraft"
url = "https://mod-buildcraft.com/maven"
}
}
minecraft {
}
dependencies {
minecraft "com.mojang:minecraft:1.16.1"
mappings "net.fabricmc:yarn:1.16.1+build.9:v2"
modImplementation "net.fabricmc:fabric-loader:0.8.8+build.202"
//Fabric api
modImplementation "net.fabricmc.fabric-api:fabric-api:0.14.0+build.371-1.16"
modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}"
modCompile "alexiil.mc.lib:libblockattributes-all:0.7.0"
compile 'com.google.code.findbugs:jsr305:3.0.2'
}
}
dependencies {
compile project(":api")
}
subprojects {
apply plugin: 'kotlin-platform-jvm'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
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"
}
}
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}
jar {
from "LICENSE"
}
compileKotlin.kotlinOptions.jvmTarget = "1.8"
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
}
}
// configure the maven publication
publishing {
// select the repositories you want to publish to
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"
}
}
}