2013-11-10 03:48:53 +00:00
buildscript {
repositories {
2019-02-14 23:08:53 +00:00
mavenLocal ( )
2022-01-17 20:50:10 +00:00
maven { url = 'https://files.minecraftforge.net/maven/' }
maven { url = 'https://libraries.minecraft.net/' }
2018-08-27 17:10:07 +00:00
jcenter ( )
2020-01-22 21:11:13 +00:00
//mavenCentral() //TODO: Update Gradle to use HTTPS by default
maven {
name 'maven_central'
url 'https://repo.maven.apache.org/maven2/'
}
2013-11-10 03:48:53 +00:00
}
dependencies {
2020-10-29 00:11:57 +00:00
classpath 'net.minecraftforge.gradle:ForgeGradle:3.0.187'
2019-12-11 02:27:07 +00:00
classpath 'org.ow2.asm:asm:7.2'
classpath 'org.ow2.asm:asm-tree:7.2'
2013-11-10 03:48:53 +00:00
}
}
2020-08-21 09:47:04 +00:00
2018-09-25 07:29:20 +00:00
import groovy.json.JsonBuilder
2019-10-15 22:00:03 +00:00
import java.nio.file.Files
2018-09-25 07:29:20 +00:00
import java.util.Date
2018-10-02 02:19:25 +00:00
import java.util.LinkedHashMap
2020-07-06 21:30:10 +00:00
import net.minecraftforge.forge.tasks.*
2020-08-21 09:47:04 +00:00
import static net . minecraftforge . forge . tasks . Util . *
2018-09-30 09:54:20 +00:00
import net.minecraftforge.gradle.common.task.DownloadMavenArtifact
2019-08-01 04:15:39 +00:00
import net.minecraftforge.gradle.common.task.ExtractInheritance
2018-09-25 07:29:20 +00:00
import net.minecraftforge.gradle.common.task.SignJar
2018-10-01 23:59:46 +00:00
import net.minecraftforge.gradle.patcher.task.ApplyBinPatches
2019-07-03 08:08:20 +00:00
import net.minecraftforge.gradle.patcher.task.TaskReobfuscateJar
import net.minecraftforge.gradle.userdev.tasks.RenameJar
2018-09-25 07:29:20 +00:00
import org.apache.tools.ant.filters.ReplaceTokens
2019-05-14 02:11:24 +00:00
import org.gradle.plugins.ide.eclipse.model.SourceFolder
2018-06-30 18:57:16 +00:00
2018-09-21 06:50:50 +00:00
plugins {
id 'net.minecrell.licenser' version '0.4'
2019-08-30 03:34:58 +00:00
id 'org.ajoberstar.grgit' version '3.1.1'
id 'com.github.ben-manes.versions' version '0.22.0'
2018-09-21 06:50:50 +00:00
}
2018-08-27 17:10:07 +00:00
apply plugin: 'eclipse'
2013-11-10 03:48:53 +00:00
2020-08-21 09:47:04 +00:00
Util . init ( ) //Init all our extension methods!
2020-06-30 02:33:30 +00:00
println ( 'Java: ' + System . getProperty ( 'java.version' ) + ' JVM: ' + System . getProperty ( 'java.vm.version' ) + '(' + System . getProperty ( 'java.vendor' ) + ') Arch: ' + System . getProperty ( 'os.arch' ) )
2020-03-15 20:55:03 +00:00
2018-11-14 00:32:55 +00:00
ext {
JAR_SIGNER = null
if ( project . hasProperty ( 'keystore' ) ) {
JAR_SIGNER = [
storepass: project . properties . keystoreStorePass ,
keypass: project . properties . keystoreKeyPass ,
keystore: project . properties . keystore
]
}
2018-11-14 21:39:56 +00:00
MAPPING_CHANNEL = 'snapshot'
2020-10-29 00:11:57 +00:00
MAPPING_VERSION = '20201028-1.16.3'
2020-11-02 17:00:53 +00:00
MC_VERSION = '1.16.4'
MCP_VERSION = '20201102.104115'
2018-11-14 00:32:55 +00:00
}
2018-08-27 17:10:07 +00:00
project ( ':mcp' ) {
2019-05-23 23:02:15 +00:00
apply plugin: 'net.minecraftforge.gradle.mcp'
2020-06-19 14:58:45 +00:00
repositories {
mavenLocal ( )
}
2018-08-27 17:10:07 +00:00
mcp {
2018-11-14 21:39:56 +00:00
config = MC_VERSION + '-' + MCP_VERSION
2018-08-27 17:10:07 +00:00
pipeline = 'joined'
2018-06-30 18:57:16 +00:00
}
2018-06-21 06:39:31 +00:00
}
2018-08-27 17:10:07 +00:00
project ( ':clean' ) {
evaluationDependsOn ( ':mcp' )
apply plugin: 'eclipse'
2019-05-23 23:02:15 +00:00
apply plugin: 'net.minecraftforge.gradle.patcher'
compileJava . sourceCompatibility = compileJava . targetCompatibility = sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
2018-08-27 17:10:07 +00:00
repositories {
2020-06-19 14:58:45 +00:00
mavenLocal ( )
2022-01-17 20:50:10 +00:00
maven { url = 'https://files.minecraftforge.net/maven/' }
maven { url = 'https://libraries.minecraft.net/' }
2020-01-22 21:11:13 +00:00
//mavenCentral() //TODO: Update Gradle to use HTTPS by default
maven {
name 'maven_central'
url 'https://repo.maven.apache.org/maven2/'
}
2018-03-24 03:42:33 +00:00
}
2019-05-23 23:02:15 +00:00
dependencies {
2019-12-11 02:27:07 +00:00
implementation 'net.minecraftforge:forgespi:2.0.+'
2019-05-23 23:02:15 +00:00
}
2018-08-27 17:10:07 +00:00
patcher {
parent = project ( ':mcp' )
2019-02-18 19:39:05 +00:00
mcVersion = MC_VERSION
2018-08-27 17:10:07 +00:00
patchedSrc = file ( 'src/main/java' )
2019-02-18 19:39:05 +00:00
2018-11-14 21:39:56 +00:00
mappings channel: MAPPING_CHANNEL , version: MAPPING_VERSION
2019-02-18 19:39:05 +00:00
runs {
clean_client {
taskName 'clean_client'
main 'net.minecraft.client.main.Main'
workingDirectory project . file ( 'run' )
args '--gameDir' , '.'
args '--version' , MC_VERSION
args '--assetsDir' , downloadAssets . output
args '--assetIndex' , '{asset_index}'
args '--accessToken' , '0'
}
clean_server {
taskName 'clean_server'
2020-06-29 23:39:04 +00:00
main 'net.minecraft.server.Main'
2019-02-18 19:39:05 +00:00
workingDirectory project . file ( 'run' )
}
2018-09-05 00:23:45 +00:00
}
}
2018-02-26 23:36:39 +00:00
}
2018-09-25 07:29:20 +00:00
project ( ':forge' ) {
2018-08-27 17:10:07 +00:00
evaluationDependsOn ( ':clean' )
2018-09-17 00:54:03 +00:00
apply plugin: 'java-library'
2018-09-25 07:29:20 +00:00
apply plugin: 'maven-publish'
2018-08-27 17:10:07 +00:00
apply plugin: 'eclipse'
2019-05-23 23:02:15 +00:00
apply plugin: 'net.minecraftforge.gradle.patcher'
2018-09-21 06:50:50 +00:00
apply plugin: 'net.minecrell.licenser'
2020-07-06 21:30:10 +00:00
2018-12-04 19:55:50 +00:00
compileJava . sourceCompatibility = compileJava . targetCompatibility = sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
2019-05-14 02:11:24 +00:00
group = 'net.minecraftforge'
2018-12-31 21:33:54 +00:00
2018-08-27 17:10:07 +00:00
sourceSets {
2018-12-31 21:33:54 +00:00
fmllauncher {
java {
2019-05-14 02:11:24 +00:00
srcDirs = [ "$rootDir/src/fmllauncher/java" ]
2018-12-31 21:33:54 +00:00
}
resources {
2019-05-14 02:11:24 +00:00
srcDirs = [ "$rootDir/src/fmllauncher/resources" ]
2018-12-31 21:33:54 +00:00
}
}
2018-08-27 17:10:07 +00:00
main {
2018-12-31 21:33:54 +00:00
compileClasspath + = sourceSets . fmllauncher . runtimeClasspath
runtimeClasspath + = sourceSets . fmllauncher . runtimeClasspath
2018-08-27 17:10:07 +00:00
java {
2019-05-14 02:11:24 +00:00
srcDirs = [ "$rootDir/src/main/java" ]
2018-08-27 17:10:07 +00:00
}
resources {
2019-06-14 03:58:03 +00:00
srcDirs = [
"$rootDir/src/main/resources" ,
"$rootDir/src/generated/resources"
]
2018-08-27 17:10:07 +00:00
}
2018-03-24 03:42:33 +00:00
}
2019-06-22 23:58:10 +00:00
test {
compileClasspath + = sourceSets . fmllauncher . runtimeClasspath
runtimeClasspath + = sourceSets . fmllauncher . runtimeClasspath
java {
srcDirs = [
"$rootDir/src/test/java" ,
"$rootDir/src/fmllaunchertest/java"
]
}
resources {
2019-10-25 02:33:24 +00:00
srcDirs = [
"$rootDir/src/test/resources" ,
"$rootDir/src/generated_test/resources"
]
2019-06-22 23:58:10 +00:00
}
}
2018-12-12 04:04:23 +00:00
userdev {
compileClasspath + = sourceSets . main . runtimeClasspath
runtimeClasspath + = sourceSets . main . runtimeClasspath
java {
2019-05-14 02:11:24 +00:00
srcDirs = [ "$rootDir/src/userdev/java" ]
2018-12-12 04:04:23 +00:00
}
resources {
2019-05-14 02:11:24 +00:00
srcDirs = [ "$rootDir/src/userdev/resources" ]
2018-12-12 04:04:23 +00:00
}
}
2019-12-19 16:51:07 +00:00
userdev_test {
compileClasspath + = sourceSets . userdev . runtimeClasspath
runtimeClasspath + = sourceSets . userdev . runtimeClasspath
compileClasspath + = sourceSets . test . runtimeClasspath
runtimeClasspath + = sourceSets . test . runtimeClasspath
}
2018-02-26 23:36:39 +00:00
}
2019-05-14 02:11:24 +00:00
//Eclipse adds the sourcesets twice, once where we tell it to, once in the projects folder. No idea why. So delete them
eclipse . classpath . file . whenMerged { cls - > cls . entries . removeIf { e - > e instanceof SourceFolder & & e . path . startsWith ( 'src/' ) & & ! e . path . startsWith ( 'src/main/' ) } }
2018-08-27 17:10:07 +00:00
repositories {
2018-09-11 00:31:51 +00:00
mavenLocal ( )
2022-01-17 20:50:10 +00:00
maven { url = 'https://files.minecraftforge.net/maven/' }
maven { url = 'https://libraries.minecraft.net/' }
2020-01-22 21:11:13 +00:00
//mavenCentral() //TODO: Update Gradle to use HTTPS by default
maven {
name 'maven_central'
url 'https://repo.maven.apache.org/maven2/'
}
2015-08-15 16:56:56 +00:00
}
2019-01-04 16:44:57 +00:00
2018-09-30 09:54:20 +00:00
ext {
2020-11-20 20:53:44 +00:00
SPEC_VERSION = '35.1' // This is overwritten by git tag, but here so dev time doesnt explode
2018-11-13 03:54:39 +00:00
// The new versioning sceme is <MCVersion>-<ForgeMC>.<RB>.<CommitsSinceRB>
// ForgeMC is a unique identifier for every MC version we have supported.
// Essentially, the same as the old, except dropping the first number, and the builds are no longer unique.
2018-09-30 09:54:20 +00:00
MCP_ARTIFACT = project ( ':mcp' ) . mcp . config
2019-07-03 08:08:20 +00:00
SPECIAL_SOURCE = 'net.md-5:SpecialSource:1.8.5'
2019-08-14 23:13:15 +00:00
VERSION_JSON = project ( ':mcp' ) . file ( 'build/mcp/downloadJson/version.json' )
2020-02-03 21:21:18 +00:00
BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.0.12:fatjar'
2020-06-30 02:33:30 +00:00
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.1.11'
2018-09-30 09:54:20 +00:00
}
2019-01-04 16:44:57 +00:00
def getVersion = {
//TAG-offset-hash
2019-08-30 03:34:58 +00:00
def raw = grgit . describe ( longDescr: true , tags: true )
def desc = ( raw = = null ? '0.0-0-unknown' : grgit . describe ( longDescr: true , tags: true ) ) . split ( '-' ) as List
2019-01-04 16:44:57 +00:00
def hash = desc . remove ( desc . size ( ) - 1 )
def offset = desc . remove ( desc . size ( ) - 1 )
def tag = desc . join ( '-' )
def branch = grgit . branch . current ( ) . name
if ( branch in [ 'master' , 'HEAD' , MC_VERSION , MC_VERSION + '.0' ] )
branch = null
if ( branch ! = null & & branch . endsWith ( '.x' ) & & MC_VERSION . startsWith ( branch . substring ( 0 , branch . length ( ) - 2 ) ) ) //1.13.x
branch = null
SPEC_VERSION = tag
return "${MC_VERSION}-${tag}.${offset}${t -> if (branch != null) t << '-' + branch}" . toString ( ) //Bake the response instead of making it dynamic
}
version = getVersion ( )
2020-04-26 23:50:42 +00:00
println ( 'Forge Version: ' + version )
2019-01-04 16:44:57 +00:00
2018-08-27 17:10:07 +00:00
patcher {
2019-02-18 19:39:05 +00:00
exc = file ( "$rootDir/src/main/resources/forge.exc" )
2018-08-27 17:10:07 +00:00
parent = project ( ':clean' )
patches = file ( "$rootDir/patches/minecraft" )
patchedSrc = file ( 'src/main/java' )
2018-09-22 03:28:47 +00:00
srgPatches = true
2019-02-18 19:39:05 +00:00
accessTransformer = file ( "$rootDir/src/main/resources/META-INF/accesstransformer.cfg" )
2019-08-03 01:03:27 +00:00
sideAnnotationStripper = file ( "$rootDir/src/main/resources/forge.sas" )
2019-02-18 19:39:05 +00:00
2019-01-08 08:29:36 +00:00
runs {
2019-02-18 19:39:05 +00:00
forge_client {
taskName 'forge_client'
2019-03-07 04:59:32 +00:00
main 'net.minecraftforge.userdev.LaunchTesting'
2019-02-18 19:39:05 +00:00
workingDirectory project . file ( 'run' )
environment 'target' , 'fmldevclient'
environment 'assetIndex' , '{asset_index}'
environment 'assetDirectory' , downloadAssets . output
environment 'nativesDirectory' , extractNatives . output
2019-03-07 04:59:32 +00:00
environment 'MC_VERSION' , MC_VERSION
environment 'MCP_VERSION' , MCP_VERSION
environment 'FORGE_GROUP' , project . group
environment 'FORGE_SPEC' , SPEC_VERSION
environment 'FORGE_VERSION' , project . version . substring ( MC_VERSION . length ( ) + 1 ) . toString ( )
environment 'LAUNCHER_VERSION' , SPEC_VERSION
2019-02-18 19:39:05 +00:00
property 'org.lwjgl.system.SharedLibraryExtractDirectory' , 'lwjgl_dll'
2020-07-28 23:44:29 +00:00
property 'eventbus.checkTypesOnDispatch' , 'true'
2019-05-11 05:13:38 +00:00
ideaModule "${rootProject.name}.${project.name}.userdev"
source sourceSets . main
source sourceSets . userdev
2019-01-08 08:29:36 +00:00
}
2019-02-18 19:39:05 +00:00
2019-05-11 19:41:20 +00:00
forge_test_client {
parent runs . forge_client
taskName 'forge_test_client'
environment 'MOD_CLASSES' , 'dummy' // Needed to work around FG limitation, FG will replace this!
2019-12-19 16:51:07 +00:00
ideaModule "${rootProject.name}.${project.name}.userdev_test"
2019-05-11 19:41:20 +00:00
mods {
TestMods { sources sourceSets . test }
}
}
2019-02-18 19:39:05 +00:00
forge_server {
taskName 'forge_server'
2019-03-07 04:59:32 +00:00
main 'net.minecraftforge.userdev.LaunchTesting'
2019-02-18 19:39:05 +00:00
workingDirectory project . file ( 'run' )
environment 'target' , 'fmldevserver'
2019-03-07 04:59:32 +00:00
environment 'MC_VERSION' , MC_VERSION
environment 'MCP_VERSION' , MCP_VERSION
environment 'FORGE_GROUP' , project . group
environment 'FORGE_SPEC' , SPEC_VERSION
environment 'FORGE_VERSION' , project . version . substring ( MC_VERSION . length ( ) + 1 ) . toString ( )
environment 'LAUNCHER_VERSION' , SPEC_VERSION
2020-07-28 23:44:29 +00:00
property 'eventbus.checkTypesOnDispatch' , 'true'
2019-05-11 05:13:38 +00:00
ideaModule "${rootProject.name}.${project.name}.userdev"
source sourceSets . main
source sourceSets . userdev
2019-01-08 08:29:36 +00:00
}
2019-05-11 19:41:20 +00:00
forge_test_server {
parent runs . forge_server
taskName 'forge_test_server'
environment 'MOD_CLASSES' , 'dummy' // Needed to work around FG limitation, FG will replace this!
2019-12-19 16:51:07 +00:00
ideaModule "${rootProject.name}.${project.name}.userdev_test"
2019-05-11 19:41:20 +00:00
mods {
TestMods { sources sourceSets . test }
}
}
2019-06-14 03:58:03 +00:00
forge_data {
taskName 'forge_data'
main 'net.minecraftforge.userdev.LaunchTesting'
workingDirectory project . file ( 'run' )
environment 'target' , 'fmldevdata'
environment 'MC_VERSION' , MC_VERSION
environment 'MCP_VERSION' , MCP_VERSION
environment 'FORGE_GROUP' , project . group
environment 'FORGE_SPEC' , SPEC_VERSION
environment 'FORGE_VERSION' , project . version . substring ( MC_VERSION . length ( ) + 1 ) . toString ( )
environment 'LAUNCHER_VERSION' , SPEC_VERSION
ideaModule "${rootProject.name}.${project.name}.userdev"
source sourceSets . main
source sourceSets . userdev
2019-10-25 02:33:24 +00:00
args '--mod' , 'forge' , '--all' , '--output' , rootProject . file ( 'src/generated/resources/' ) , '--validate' ,
'--existing' , sourceSets . main . resources . srcDirs [ 0 ]
2019-06-14 03:58:03 +00:00
}
2019-08-03 17:25:41 +00:00
forge_test_data {
parent runs . forge_data
taskName 'forge_test_data'
environment 'MOD_CLASSES' , 'dummy' // Needed to work around FG limitation, FG will replace this!
2019-12-19 16:51:07 +00:00
ideaModule "${rootProject.name}.${project.name}.userdev_test"
2019-08-03 17:25:41 +00:00
mods {
tests { sources sourceSets . test }
}
2020-06-03 23:57:07 +00:00
args '--flat' , '--all' , '--validate' ,
'--mod' , 'data_gen_test' ,
2020-09-08 19:11:08 +00:00
'--mod' , 'piston_event_test' ,
'--mod' , 'global_loot_test' ,
2020-09-08 21:00:09 +00:00
'--mod' , 'scaffolding_test' ,
2020-09-09 02:10:36 +00:00
'--mod' , 'custom_tag_types_test' ,
2020-11-02 01:09:49 +00:00
'--mod' , 'new_model_loader_test' ,
2020-06-03 23:57:07 +00:00
'--output' , rootProject . file ( 'src/generated_test/resources/' ) ,
2020-11-02 01:09:49 +00:00
'--existing' , sourceSets . main . resources . srcDirs [ 0 ] ,
'--existing' , sourceSets . test . resources . srcDirs [ 0 ]
2019-08-03 17:25:41 +00:00
}
2018-09-10 20:08:35 +00:00
}
2015-08-26 17:57:51 +00:00
}
2018-10-02 02:19:25 +00:00
2019-01-01 00:48:23 +00:00
ext {
MANIFESTS = [
'/' : [
'Timestamp' : new Date ( ) . format ( "yyyy-MM-dd'T'HH:mm:ssZ" ) ,
2019-01-01 21:50:04 +00:00
'GitCommit' : grgit . head ( ) . abbreviatedId ,
2019-01-01 00:48:23 +00:00
'Git-Branch' : grgit . branch . current ( ) . getName ( )
] as LinkedHashMap ,
'net/minecraftforge/versions/forge/' : [
'Specification-Title' : 'Forge' ,
'Specification-Vendor' : 'Forge Development LLC' ,
'Specification-Version' : SPEC_VERSION ,
'Implementation-Title' : project . group ,
'Implementation-Version' : project . version . substring ( MC_VERSION . length ( ) + 1 ) ,
'Implementation-Vendor' : 'Forge Development LLC'
] as LinkedHashMap ,
'net/minecraftforge/versions/mcp/' : [
'Specification-Title' : 'Minecraft' ,
'Specification-Vendor' : 'Mojang' ,
'Specification-Version' : MC_VERSION ,
'Implementation-Title' : 'MCP' ,
'Implementation-Version' : MCP_VERSION ,
'Implementation-Vendor' : 'Forge'
] as LinkedHashMap ,
'net/minecraftforge/fml/javafmlmod/' : [
'Specification-Title' : 'Mod Language Provider' ,
'Specification-Vendor' : 'Forge Development LLC' ,
'Specification-Version' : '1' ,
'Implementation-Title' : 'FML Java Mod' ,
'Implementation-Version' : SPEC_VERSION ,
'Implementation-Vendor' : 'Forge'
2019-01-01 21:50:04 +00:00
] as LinkedHashMap ,
2019-08-05 00:16:01 +00:00
'net/minecraftforge/fml/mclanguageprovider/' : [
2019-08-14 23:13:15 +00:00
'Specification-Title' : 'Mod Language Provider' ,
'Specification-Vendor' : 'Forge Development LLC' ,
'Specification-Version' : '1' ,
'Implementation-Title' : 'Minecraft Language Mod Provider' ,
'Implementation-Version' : '1' ,
'Implementation-Vendor' : 'Forge'
2019-08-05 00:16:01 +00:00
] as LinkedHashMap ,
2019-01-01 21:50:04 +00:00
'net/minecraftforge/fml/loading/' : [
2019-02-05 02:23:58 +00:00
'Specification-Title' : 'Launcher' ,
'Specification-Vendor' : 'Forge Development LLC' ,
'Specification-Version' : '1' ,
'Implementation-Title' : 'FML Launcher' ,
'Implementation-Version' : SPEC_VERSION ,
'Implementation-Vendor' : 'Forge'
2019-06-26 01:03:51 +00:00
] as LinkedHashMap ,
'net/minecraftforge/fml/userdev/' : [
'Specification-Title' : 'Forge User Development' ,
'Specification-Vendor' : 'Forge Development LLC' ,
'Specification-Version' : SPEC_VERSION ,
'Implementation-Title' : project . group ,
'Implementation-Version' : project . version . substring ( MC_VERSION . length ( ) + 1 ) ,
'Implementation-Vendor' : 'Forge Development LLC'
2019-01-01 00:48:23 +00:00
] as LinkedHashMap
]
}
2018-08-27 17:10:07 +00:00
applyPatches {
canonicalizeAccess true
canonicalizeWhitespace true
maxFuzz 3
2015-08-15 17:16:00 +00:00
}
2018-10-01 23:59:46 +00:00
configurations {
installer {
transitive = false //Don't pull all libraries, if we're missing something, add it to the installer list so the installer knows to download it.
}
api . extendsFrom ( installer )
2019-01-01 00:48:23 +00:00
fmllauncherImplementation . extendsFrom ( installer )
2018-10-01 23:59:46 +00:00
}
2018-08-27 17:10:07 +00:00
dependencies {
2019-12-11 02:27:07 +00:00
installer 'org.ow2.asm:asm:7.2'
installer 'org.ow2.asm:asm-commons:7.2'
installer 'org.ow2.asm:asm-tree:7.2'
2020-07-21 23:55:57 +00:00
installer 'org.ow2.asm:asm-util:7.2'
installer 'org.ow2.asm:asm-analysis:7.2'
2020-11-01 21:05:02 +00:00
installer 'cpw.mods:modlauncher:8.0.6'
2020-04-25 21:54:50 +00:00
installer 'cpw.mods:grossjava9hacks:1.3.+'
2020-07-27 21:36:30 +00:00
installer 'net.minecraftforge:accesstransformers:2.2.+:shadowed'
installer 'net.minecraftforge:eventbus:3.0.+:service'
2020-10-26 02:26:16 +00:00
installer 'net.minecraftforge:forgespi:3.2.+'
2020-07-28 00:09:45 +00:00
installer 'net.minecraftforge:coremods:3.0.+'
2019-02-18 20:54:14 +00:00
installer 'net.minecraftforge:unsafe:0.2.+'
2019-12-11 02:27:07 +00:00
installer 'com.electronwill.night-config:core:3.6.2'
installer 'com.electronwill.night-config:toml:3.6.2'
2019-08-30 03:34:58 +00:00
installer 'org.jline:jline:3.12.+'
2019-01-14 03:51:36 +00:00
installer 'org.apache.maven:maven-artifact:3.6.0'
2020-05-11 00:34:57 +00:00
installer 'net.jodah:typetools:0.8.+'
2022-01-17 20:50:10 +00:00
installer 'org.apache.logging.log4j:log4j-api:2.17.1'
installer 'org.apache.logging.log4j:log4j-core:2.17.1'
2019-08-30 03:34:58 +00:00
installer 'net.minecrell:terminalconsoleappender:1.2.+'
2019-02-26 15:28:41 +00:00
installer 'net.sf.jopt-simple:jopt-simple:5.0.4'
2020-10-05 14:34:07 +00:00
installer 'org.spongepowered:mixin:0.8.2'
2018-12-31 21:33:54 +00:00
fmllauncherImplementation 'com.google.guava:guava:21.0'
fmllauncherImplementation 'com.google.code.gson:gson:2.8.0'
2020-07-21 23:55:57 +00:00
fmllauncherImplementation 'org.lwjgl:lwjgl:3.2.2'
fmllauncherImplementation 'org.lwjgl:lwjgl-glfw:3.2.2'
fmllauncherImplementation 'org.lwjgl:lwjgl-opengl:3.2.2'
fmllauncherImplementation 'org.lwjgl:lwjgl-stb:3.2.2'
2019-05-23 23:02:15 +00:00
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.0.0'
2019-07-23 02:23:20 +00:00
testImplementation 'org.junit.vintage:junit-vintage-engine:5.+'
2019-05-23 23:02:15 +00:00
testImplementation 'org.opentest4j:opentest4j:1.0.0' // needed for junit 5
testImplementation 'org.hamcrest:hamcrest-all:1.3' // needs advanced matching for list order
2015-08-20 20:42:58 +00:00
}
2018-09-21 06:50:50 +00:00
2018-09-25 07:29:20 +00:00
def extraTxts = [
rootProject . file ( 'CREDITS.txt' ) ,
rootProject . file ( 'LICENSE.txt' )
]
2018-11-14 21:39:56 +00:00
2018-11-15 20:40:30 +00:00
def changelog = rootProject . file ( 'build/changelog.txt' )
if ( changelog . exists ( ) )
2018-09-25 07:29:20 +00:00
extraTxts + = changelog
2020-08-21 09:47:04 +00:00
task crowdin ( type: CrowdinTask ) {
key = project . hasProperty ( 'crowdinKey' ) ? project . crowdinKey : null
//TODO: Merge our english.json?
}
2018-09-25 07:29:20 +00:00
2018-10-01 23:59:46 +00:00
// We apply the bin patches we just created to make a jar that is JUST our changes
2020-08-21 09:47:04 +00:00
[ 'Client' , 'Server' , 'Joined' ] . each { side - >
def gen = tasks . getByName ( "gen${side}BinPatches" )
gen . tool = BINPATCH_TOOL
task "apply${side}BinPatches" ( type: ApplyBinPatches , dependsOn: gen ) {
clean = { gen . cleanJar }
input = gen . output
tool = BINPATCH_TOOL
}
if ( side ! = 'Joined' ) {
// Create SRG named Vanilla jars, using the SpecialSource we have in the installer
task "create${side}SRG" ( type: RenameJar , dependsOn: gen ) {
tool = SPECIAL_SOURCE + ':shaded'
args = [ '--stable' , '--in-jar' , '{input}' , '--out-jar' , '{output}' , '--srg-in' , '{mappings}' ]
mappings = { gen . srg }
input = { gen . cleanJar }
output = file ( "build/create${name}SRG/output.jar" )
}
}
}
2019-08-01 04:15:39 +00:00
2020-08-21 09:47:04 +00:00
task downloadLibraries ( type: DownloadLibrariesTask , dependsOn: ':mcp:setupMCP' ) {
input = VERSION_JSON
output = rootProject . file ( 'build/libraries/' )
2019-08-14 23:13:15 +00:00
}
task extractInheritance ( type: ExtractInheritance , dependsOn: [ genJoinedBinPatches , downloadLibraries ] ) {
2020-06-30 02:33:30 +00:00
tool = INSTALLER_TOOLS + ':fatjar'
2019-08-01 04:15:39 +00:00
input { genJoinedBinPatches . cleanJar }
2020-08-21 09:47:04 +00:00
doFirst { downloadLibraries . libraries . each { addLibrary ( it ) } }
2019-08-01 04:15:39 +00:00
}
2020-08-21 09:47:04 +00:00
task checkATs ( type: CheckATs , dependsOn: extractInheritance ) {
inheritance = extractInheritance . output
ats = patcher . accessTransformers
2019-07-11 00:39:19 +00:00
}
2020-08-21 09:47:04 +00:00
task checkSAS ( type: CheckSAS , dependsOn: extractInheritance ) {
inheritance = extractInheritance . output
sass = patcher . sideAnnotationStrippers
2019-08-01 04:15:39 +00:00
}
2020-08-21 09:47:04 +00:00
task checkExcs ( type: CheckExcs , dependsOn: jar ) {
binary = jar . archivePath
excs = patcher . excs
}
task checkAll ( dependsOn: [ checkATs , checkSAS , checkExcs ] ) { }
2019-08-03 01:03:27 +00:00
2020-07-06 21:30:10 +00:00
task checkPatchesAndFix ( type: CheckPatches ) {
patchDir = file ( "$rootDir/patches" )
autoFix = true
}
task checkPatches ( type: CheckPatches ) {
patchDir = file ( "$rootDir/patches" )
autoFix = false
}
project ( ':forge' ) . getTasks ( ) . getByName ( 'genPatches' ) . finalizedBy ( checkPatches )
2019-01-01 00:48:23 +00:00
task launcherJson ( dependsOn: [ 'signUniversalJar' , 'signLauncherJar' ] ) {
2018-10-02 04:32:41 +00:00
inputs . file universalJar . archivePath
2019-07-03 08:08:20 +00:00
inputs . file { launcherJar . archivePath }
2018-09-25 07:29:20 +00:00
ext {
2018-11-14 21:39:56 +00:00
output = file ( 'build/version.json' )
2018-09-25 07:29:20 +00:00
vanilla = project ( ':mcp' ) . file ( 'build/mcp/downloadJson/version.json' )
2020-08-21 09:47:04 +00:00
timestamp = iso8601Now ( )
2018-09-25 07:29:20 +00:00
comment = [
"Please do not automate the download and installation of Forge." ,
"Our efforts are supported by ads from the download page." ,
"If you MUST automate this, please consider supporting the project through https://www.patreon.com/LexManos/"
]
2018-10-01 23:59:46 +00:00
def idx = project . version . indexOf ( '-' )
id = project . version . substring ( 0 , idx ) + "-${project.name}" + project . version . substring ( idx )
2018-09-25 07:29:20 +00:00
}
inputs . file vanilla
outputs . file output
doLast {
2020-08-21 09:47:04 +00:00
def json_vanilla = vanilla . json ( )
2018-09-25 07:29:20 +00:00
def json = [
_comment_: comment ,
2018-10-01 23:59:46 +00:00
id: id ,
2018-09-25 07:29:20 +00:00
time: timestamp ,
releaseTime: timestamp ,
type: 'release' ,
mainClass: 'cpw.mods.modlauncher.Launcher' ,
2018-10-02 02:19:25 +00:00
inheritsFrom: MC_VERSION ,
2019-04-16 02:00:11 +00:00
logging: { } ,
2018-09-25 07:29:20 +00:00
arguments: [
2019-01-01 21:50:04 +00:00
game: [ '--launchTarget' , 'fmlclient' , '--fml.forgeVersion' , "${project.version.substring(MC_VERSION.length() + 1)}" , '--fml.mcVersion' , "${MC_VERSION}" , '--fml.forgeGroup' , "${project.group}" , '--fml.mcpVersion' , "${MCP_VERSION}" ]
2018-09-25 07:29:20 +00:00
] ,
libraries: [
2018-10-01 23:59:46 +00:00
[
2019-01-01 00:48:23 +00:00
//Package our launcher jar as the 'main' jar Mojang's launcher loads. It will in turn load Forge's regular jars itself.
2018-10-01 23:59:46 +00:00
name: "${project.group}:${project.name}:${project.version}" ,
downloads: [
artifact: [
path: "${project.group.replace('.', '/')}/${project.name}/${project.version}/${project.name}-${project.version}.jar" ,
2018-10-02 03:27:05 +00:00
url: "" , //Do not include the URL so that the installer/launcher won't grab it. This is also why we don't have the universal classifier
2020-08-21 09:47:04 +00:00
sha1: launcherJar . archivePath . sha1 ( ) ,
2019-01-01 00:48:23 +00:00
size: launcherJar . archivePath . length ( )
2018-10-01 23:59:46 +00:00
]
]
]
2018-09-25 07:29:20 +00:00
]
]
2018-10-01 23:59:46 +00:00
def artifacts = getArtifacts ( project , project . configurations . installer , false )
2018-09-29 03:50:01 +00:00
artifacts . each { key , lib - >
2018-10-01 23:59:46 +00:00
json . libraries . add ( lib )
2018-09-25 07:29:20 +00:00
}
output . text = new JsonBuilder ( json ) . toPrettyString ( )
}
}
2019-08-03 01:03:27 +00:00
2019-07-03 08:08:20 +00:00
task installerJson ( dependsOn: [ launcherJson , genClientBinPatches , applyClientBinPatches , applyServerBinPatches /*, createClientSRG, createServerSRG*/ ] ) {
2018-09-25 07:29:20 +00:00
ext {
2018-11-14 21:39:56 +00:00
output = file ( 'build/install_profile.json' )
2019-09-23 02:46:43 +00:00
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.2'
2018-09-30 09:54:20 +00:00
}
doFirst {
2019-09-23 00:30:29 +00:00
ext . BIN_PATCHER = BINPATCH_TOOL . substring ( 0 , BINPATCH_TOOL . length ( ) - 1 - BINPATCH_TOOL . split ( ':' ) [ 3 ] . length ( ) )
2018-09-25 07:29:20 +00:00
}
2018-10-02 20:13:33 +00:00
inputs . file applyClientBinPatches . output
inputs . file applyServerBinPatches . output
2018-10-01 23:59:46 +00:00
inputs . file genClientBinPatches . toolJar
2018-09-25 07:29:20 +00:00
inputs . file launcherJson . output
2019-07-03 08:08:20 +00:00
/ *
inputs . file createClientSRG . output
inputs . file createServerSRG . output
* /
2018-09-25 07:29:20 +00:00
outputs . file output
doLast {
2019-01-01 00:48:23 +00:00
def libs = [
"${project.group}:${project.name}:${project.version}:universal" : [
name: "${project.group}:${project.name}:${project.version}:universal" ,
downloads: [
artifact: [
path: "${project.group.replace('.', '/')}/${project.name}/${project.version}/${project.name}-${project.version}-universal.jar" ,
url: "" , //Do not include the URL so that the installer/launcher won't grab it. This is also why we don't have the universal classifier
2020-08-21 09:47:04 +00:00
sha1: universalJar . archivePath . sha1 ( ) ,
2019-01-01 00:48:23 +00:00
size: universalJar . archivePath . length ( )
]
]
]
]
2018-09-25 07:29:20 +00:00
def json = [
2018-09-29 03:50:01 +00:00
_comment_: launcherJson . comment ,
2018-12-13 23:33:35 +00:00
spec: 0 ,
2018-09-29 03:50:01 +00:00
profile: project . name ,
2018-10-01 23:59:46 +00:00
version: launcherJson . id ,
2019-10-15 22:00:03 +00:00
icon: "data:image/png;base64," + new String ( Base64 . getEncoder ( ) . encode ( Files . readAllBytes ( rootProject . file ( "icon.ico" ) . toPath ( ) ) ) ) ,
2018-09-29 03:50:01 +00:00
json: '/version.json' ,
2018-10-01 23:59:46 +00:00
path: "${project.group}:${project.name}:${project.version}" ,
2018-09-29 03:50:01 +00:00
logo: '/big_logo.png' ,
2018-10-02 02:19:25 +00:00
minecraft: MC_VERSION ,
2018-09-29 03:50:01 +00:00
welcome: "Welcome to the simple ${project.name.capitalize()} installer." ,
data: [
MAPPINGS: [
2018-09-30 09:54:20 +00:00
client: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings@txt]" ,
server: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings@txt]"
2018-09-29 03:50:01 +00:00
] ,
BINPATCH: [
client: '/data/client.lzma' ,
server: '/data/server.lzma'
] ,
MC_SLIM: [
2020-06-26 19:52:50 +00:00
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:slim]" ,
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:slim]"
2018-09-29 03:50:01 +00:00
] ,
2018-10-02 20:13:33 +00:00
MC_SLIM_SHA: [
2020-08-21 09:47:04 +00:00
client: "'${tasks.getByName('downloadClientSlim').output.sha1()}'" ,
server: "'${tasks.getByName('downloadServerSlim').output.sha1()}'"
2018-10-02 20:13:33 +00:00
] ,
2018-09-29 03:50:01 +00:00
MC_EXTRA: [
2020-06-26 19:52:50 +00:00
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:extra]" ,
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:extra]"
2018-09-29 03:50:01 +00:00
] ,
2018-10-02 20:13:33 +00:00
MC_EXTRA_SHA: [
2020-08-21 09:47:04 +00:00
client: "'${tasks.getByName('downloadClientExtra').output.sha1()}'" ,
server: "'${tasks.getByName('downloadServerExtra').output.sha1()}'"
2018-10-02 20:13:33 +00:00
] ,
2018-09-30 09:54:20 +00:00