2019-02-23 00:12:04 +00:00
|
|
|
/*
|
|
|
|
* This file is part of Baritone.
|
|
|
|
*
|
|
|
|
* Baritone 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.
|
|
|
|
*
|
|
|
|
* Baritone 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 Baritone. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2021-06-23 17:24:22 +00:00
|
|
|
|
|
|
|
plugins {
|
|
|
|
id 'java'
|
|
|
|
id 'dev.architectury.loom' version '0.8.0-SNAPSHOT'
|
|
|
|
id 'maven-publish'
|
2019-02-23 00:12:04 +00:00
|
|
|
}
|
|
|
|
|
2021-06-16 08:12:47 +00:00
|
|
|
|
2021-06-23 17:24:22 +00:00
|
|
|
group 'baritone'
|
|
|
|
version '1.7.0'
|
2021-01-30 05:02:16 +00:00
|
|
|
|
2019-02-23 00:12:04 +00:00
|
|
|
import baritone.gradle.task.CreateDistTask
|
|
|
|
import baritone.gradle.task.ProguardTask
|
2021-01-20 06:03:57 +00:00
|
|
|
|
2021-06-16 08:12:47 +00:00
|
|
|
def compileType = project.hasProperty("baritone.fabric_build") ? "FABRIC" : project.hasProperty("baritone.forge_build") ? "FORGE" : "OFFICIAL"
|
2021-01-20 06:03:03 +00:00
|
|
|
|
2021-06-23 17:24:22 +00:00
|
|
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
|
2019-02-23 00:12:04 +00:00
|
|
|
|
|
|
|
compileJava {
|
|
|
|
sourceCompatibility = targetCompatibility = '1.8'
|
|
|
|
options.encoding = "UTF-8" // allow emoji in comments :^)
|
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
2019-03-08 20:30:43 +00:00
|
|
|
api {
|
|
|
|
compileClasspath += main.compileClasspath
|
|
|
|
}
|
|
|
|
main {
|
|
|
|
compileClasspath += api.output
|
|
|
|
}
|
|
|
|
test {
|
2019-03-12 06:05:39 +00:00
|
|
|
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
|
2019-03-12 16:38:05 +00:00
|
|
|
runtimeClasspath += main.compileClasspath + main.runtimeClasspath + main.output
|
2019-03-08 20:30:43 +00:00
|
|
|
}
|
2019-02-23 00:12:04 +00:00
|
|
|
launch {
|
|
|
|
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
|
2019-03-15 22:32:51 +00:00
|
|
|
runtimeClasspath += main.compileClasspath + main.runtimeClasspath + main.output
|
2019-02-23 00:12:04 +00:00
|
|
|
}
|
2019-07-22 00:54:02 +00:00
|
|
|
schematica_api {
|
|
|
|
compileClasspath += main.compileClasspath
|
|
|
|
}
|
|
|
|
main {
|
|
|
|
compileClasspath += schematica_api.output
|
|
|
|
}
|
2019-02-23 00:12:04 +00:00
|
|
|
}
|
|
|
|
|
2021-06-16 08:12:47 +00:00
|
|
|
loom {
|
|
|
|
mixinConfig 'mixins.baritone.json'
|
|
|
|
}
|
|
|
|
|
2021-06-23 17:24:22 +00:00
|
|
|
minecraft {}
|
2019-03-12 06:05:39 +00:00
|
|
|
|
2021-06-16 08:12:47 +00:00
|
|
|
minecraft.refmapName = "mixins.baritone.refmap.json"
|
2019-02-23 00:12:04 +00:00
|
|
|
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
name = 'impactdevelopment-repo'
|
|
|
|
url = 'https://impactdevelopment.github.io/maven/'
|
|
|
|
}
|
2020-08-17 23:56:32 +00:00
|
|
|
maven {
|
|
|
|
url = 'https://www.dogforce-games.com/maven/'
|
|
|
|
}
|
2021-06-23 17:24:22 +00:00
|
|
|
mavenCentral()
|
2019-02-23 00:12:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2021-07-06 14:25:30 +00:00
|
|
|
if (compileType.equals("FORGE")) {
|
2021-06-16 08:12:47 +00:00
|
|
|
forge "net.minecraftforge:forge:1.16.5-36.1.0"
|
|
|
|
}
|
|
|
|
minecraft "com.mojang:minecraft:1.16.5"
|
2021-06-23 17:24:22 +00:00
|
|
|
mappings minecraft.officialMojangMappings()
|
2021-07-06 14:25:30 +00:00
|
|
|
if (!compileType.equals("FORGE")) {
|
2021-01-20 06:11:08 +00:00
|
|
|
modImplementation "net.fabricmc:fabric-loader:0.9.1+build.205"
|
2019-02-23 00:12:04 +00:00
|
|
|
}
|
2021-06-16 08:12:47 +00:00
|
|
|
// this makes it compile with the forge tweak stuff
|
|
|
|
implementation 'com.github.ImpactDevelopment:SimpleTweaker:1.2'
|
|
|
|
implementation('net.minecraft:launchwrapper:1.12') {
|
|
|
|
exclude module: 'lwjgl'
|
|
|
|
}
|
|
|
|
|
|
|
|
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
2019-03-08 20:30:43 +00:00
|
|
|
|
2019-02-23 00:12:04 +00:00
|
|
|
testImplementation 'junit:junit:4.12'
|
|
|
|
}
|
|
|
|
|
|
|
|
javadoc {
|
|
|
|
options.addStringOption('Xwerror', '-quiet') // makes the build fail on travis when there is a javadoc error
|
|
|
|
options.linkSource true
|
|
|
|
options.encoding "UTF-8" // allow emoji in comments :^)
|
2019-02-23 07:29:08 +00:00
|
|
|
source = sourceSets.api.allJava
|
2019-02-23 00:12:04 +00:00
|
|
|
classpath += sourceSets.api.compileClasspath
|
|
|
|
}
|
|
|
|
|
2021-06-16 08:12:47 +00:00
|
|
|
// skidded from fabric-example-mod (comments and all)
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
|
|
// 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
|
|
|
|
// If Javadoc is generated, this must be specified in that task too.
|
|
|
|
it.options.encoding = "UTF-8"
|
|
|
|
|
|
|
|
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
|
|
|
|
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
|
|
|
|
// We'll use that if it's available, but otherwise we'll use the older option.
|
|
|
|
def targetVersion = 8
|
|
|
|
if (JavaVersion.current().isJava9Compatible()) {
|
|
|
|
it.options.release = targetVersion
|
2021-01-20 06:03:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-16 08:12:47 +00:00
|
|
|
|
2019-02-23 00:12:04 +00:00
|
|
|
jar {
|
|
|
|
from sourceSets.launch.output, sourceSets.api.output
|
2020-10-28 00:19:20 +00:00
|
|
|
|
|
|
|
if (!getProject().hasProperty("baritone.forge_build")) {
|
|
|
|
exclude "**/BaritoneForgeModXD.class"
|
|
|
|
exclude "**/mods.toml"
|
|
|
|
}
|
|
|
|
|
2019-02-23 00:12:04 +00:00
|
|
|
preserveFileTimestamps = false
|
|
|
|
reproducibleFileOrder = true
|
|
|
|
|
2021-01-20 06:11:08 +00:00
|
|
|
if (getProject().hasProperty("baritone.fabric_build")) {
|
|
|
|
filesMatching("fabric.mod.json") {
|
|
|
|
expand "version": version
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
exclude("fabric.mod.json")
|
2021-01-20 06:03:03 +00:00
|
|
|
}
|
|
|
|
|
2021-01-20 06:11:08 +00:00
|
|
|
|
2019-02-23 00:12:04 +00:00
|
|
|
manifest {
|
|
|
|
attributes(
|
|
|
|
'MixinConfigs': 'mixins.baritone.json',
|
2020-03-25 04:28:55 +00:00
|
|
|
"MixinConnector": "baritone.launch.BaritoneMixinConnector",
|
2019-02-23 00:12:04 +00:00
|
|
|
|
|
|
|
'Implementation-Title': 'Baritone',
|
2020-03-25 04:28:55 +00:00
|
|
|
'Implementation-Version': version,
|
2019-02-23 00:12:04 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-16 08:12:47 +00:00
|
|
|
if (compileType.equals("OFFICIAL")) {
|
|
|
|
remapJar {
|
|
|
|
toM.set "official"
|
2021-01-20 06:03:03 +00:00
|
|
|
}
|
2021-06-16 08:12:47 +00:00
|
|
|
}
|
2019-02-23 00:12:04 +00:00
|
|
|
|
2020-03-25 04:28:55 +00:00
|
|
|
|
2019-02-23 00:12:04 +00:00
|
|
|
|
2021-06-16 08:12:47 +00:00
|
|
|
task proguard(type: ProguardTask) {
|
|
|
|
url 'https://downloads.sourceforge.net/project/proguard/v7.1.0-beta5/proguard-7.1.0-beta5.zip'
|
|
|
|
extract 'proguard-7.1.0-beta5/lib/proguard.jar'
|
|
|
|
compType compileType
|
|
|
|
}
|
2019-02-23 00:12:04 +00:00
|
|
|
|
2021-06-16 08:12:47 +00:00
|
|
|
task createDist(type: CreateDistTask, dependsOn: proguard)
|
2021-01-20 06:03:03 +00:00
|
|
|
|
2019-02-23 00:12:04 +00:00
|
|
|
|
2021-06-16 08:12:47 +00:00
|
|
|
build.finalizedBy(createDist)
|