Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport current buildscripts to 1.12.2 #3856

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
backport current buildscripts to 1.12.2
  • Loading branch information
wagyourtail committed Feb 28, 2023
commit ce20b47e1b2fc063264e8f634cc568a930eb3a1e
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
run/
autotest/
dist/
mapping/

# Gradle
build/
Expand Down
207 changes: 94 additions & 113 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,97 +15,130 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/

group 'baritone'
version '1.2.17'
allprojects {
apply plugin: 'java'
apply plugin: "xyz.wagyourtail.unimined"
apply plugin: "maven-publish"

archivesBaseName = rootProject.archives_base_name
def vers = 'git describe --always --tags --dirty'.execute().text.trim()
if (!vers.startsWith("v")) {
wagyourtail marked this conversation as resolved.
Show resolved Hide resolved
println "git doesn't appear to be installed!"
println "using version number: " + rootProject.mod_version
version = rootProject.mod_version
wagyourtail marked this conversation as resolved.
Show resolved Hide resolved
} else {
version = vers.substring(1)
}
group = rootProject.maven_group

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8

minecraft {
mcRemapper.tinyRemapperConf = {
ignoreFieldDesc(true)
ignoreConflicts(true)
}
}

buildscript {
repositories {
maven {
name = 'forge'
url = 'http://files.minecraftforge.net/maven'
name = 'spongepowered-repo'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}
maven {
name = 'SpongePowered'
url = 'https://repo.spongepowered.org/repository/maven-public/'
name = 'fabric-maven'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'forge-maven'
url = 'https://maven.minecraftforge.net/'
metadataSources {
artifact()
}
}
jcenter()
maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'
}
maven {
name = "ldtteam"
url = "https://maven.parchmentmc.net/"
}
// for the newer version of launchwrapper
maven {
name = "multimc-maven"
url = "https://files.multimc.org/maven/"
metadataSources {
artifact()
}
}
mavenCentral()
}

dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
}
}
minecraft "net.minecraft:minecraft:${rootProject.minecraft_version}"

mappings "de.oceanlabs.mcp:mcp_config:${rootProject.minecraft_version}@zip"
mappings "de.oceanlabs.mcp:mcp_${rootProject.mcp_channel}:${rootProject.mcp_version}@zip"

import baritone.gradle.task.CreateDistTask
import baritone.gradle.task.ProguardTask
implementation "org.spongepowered:mixin:0.7.11-SNAPSHOT", {
transitive = false
}
}

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'net.minecraftforge.gradle.tweaker-client'
apply plugin: 'org.spongepowered.mixin'
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"

def targetVersion = 8
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = targetVersion
}
}
}

sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
options.encoding = "UTF-8" // allow emoji in comments :^)
minecraft {
runs.off = true
}

archivesBaseName = archivesBaseName + "-common"

sourceSets {
api {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
}
main {
compileClasspath += api.output
runtimeClasspath += api.output
}
test {
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
runtimeClasspath += main.compileClasspath + main.runtimeClasspath + main.output
}
launch {
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
runtimeClasspath += main.compileClasspath + main.runtimeClasspath + main.output
}

schematica_api {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
}

main {
compileClasspath += schematica_api.output
runtimeClasspath += schematica_api.output
}
}

minecraft {
version = '1.12.2'
mappings = 'stable_39'
tweakClass = 'baritone.launch.BaritoneTweaker'
runDir = 'run'

// The sources jar should use SRG names not MCP to ensure compatibility with all mappings
makeObfSourceJar = true
}

repositories {
mavenCentral()

maven {
name = 'spongepowered-repo'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}

maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'
}
dependencies {
testImplementation 'junit:junit:4.13.2'
}

dependencies {
runtime launchCompile('com.github.ImpactDevelopment:SimpleTweaker:1.2')
runtime launchCompile('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core'
}
testImplementation 'junit:junit:4.12'
jar {
from sourceSets.main.output, sourceSets.launch.output, sourceSets.api.output
}

mixin {
defaultObfuscationEnv searge
add sourceSets.launch, 'mixins.baritone.refmap.json'
remapJar {
target = "mcp"
}

javadoc {
Expand All @@ -114,56 +147,4 @@ javadoc {
options.encoding "UTF-8" // allow emoji in comments :^)
source = sourceSets.api.allJava
classpath += sourceSets.api.compileClasspath
}

jar {
from sourceSets.launch.output, sourceSets.api.output

if (!getProject().hasProperty("baritone.forge_build")) {
exclude "**/BaritoneForgeModXD.class"
exclude "**/mods.toml"
}

preserveFileTimestamps = false
reproducibleFileOrder = true

manifest {
attributes(
'MixinConfigs': 'mixins.baritone.json',

'Implementation-Title': 'Baritone',
'Implementation-Version': version
)
}
}

task proguard(type: ProguardTask) {
url 'https://downloads.sourceforge.net/project/proguard/proguard/6.0/proguard6.0.3.zip'
extract 'proguard6.0.3/lib/proguard.jar'
}

task createDist(type: CreateDistTask, dependsOn: proguard)

build.finalizedBy(createDist)

install {
def jarApiName = String.format("%s-api-%s", rootProject.name, version.toString())
def jarApiForgeName = String.format("%s-api-forge-%s", rootProject.name, version.toString())
def jarSAName = String.format("%s-standalone-%s", rootProject.name, version.toString())
def jarSAForgeName = String.format("%s-standalone-forge-%s", rootProject.name, version.toString())

artifacts {
archives file("$buildDir/libs/"+jarApiName+".jar")
archives file("$buildDir/libs/"+jarApiForgeName+".jar")
archives file("$buildDir/libs/"+jarSAName+".jar")
archives file("$buildDir/libs/"+jarSAForgeName+".jar")
}
repositories.mavenInstaller {
addFilter('api') { artifact, file -> artifact.name == "baritone-api" }
addFilter('api-forge') { artifact, file -> artifact.name == "baritone-api-forge" }
addFilter('standalone') { artifact, file -> artifact.name == "baritone-standalone" }
addFilter('standalone-forge') { artifact, file -> artifact.name == "baritone-standalone-forge" }
}
}

install.dependsOn(build)
}
19 changes: 17 additions & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,25 @@
*/

repositories {
mavenLocal()
maven {
name = 'WagYourMaven'
url = 'https://maven.wagyourtail.xyz/releases'
}
maven {
name = 'ForgeMaven'
url = 'https://maven.minecraftforge.net/'
}
maven {
name = 'FabricMaven'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
}

dependencies {
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.6'

implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '0.4.1'
}
Loading