2013-11-10 03:48:53 +00:00
buildscript {
repositories {
2019-02-14 23:08:53 +00:00
mavenLocal ( )
2018-11-14 00:32:55 +00:00
maven { url = 'https://files.minecraftforge.net/maven' }
2018-08-27 17:10:07 +00:00
jcenter ( )
2013-11-10 03:48:53 +00:00
mavenCentral ( )
}
dependencies {
2018-09-15 18:25:36 +00:00
classpath 'net.minecraftforge.gradle:ForgeGradle:3.+'
2013-11-10 03:48:53 +00:00
}
}
2018-09-25 07:29:20 +00:00
import groovy.json.JsonSlurper
import groovy.json.JsonBuilder
import java.text.SimpleDateFormat
import java.util.Date
2018-10-02 02:19:25 +00:00
import java.util.LinkedHashMap
2018-09-25 07:29:20 +00:00
import java.security.MessageDigest
2018-09-29 03:50:01 +00:00
import java.net.URL
2018-10-01 23:59:46 +00:00
import net.minecraftforge.gradle.common.task.ArchiveChecksum
2018-09-30 09:54:20 +00:00
import net.minecraftforge.gradle.common.task.DownloadMavenArtifact
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
2018-09-25 07:29:20 +00:00
import org.apache.tools.ant.filters.ReplaceTokens
import de.undercouch.gradle.tasks.download.Download
2018-12-12 04:04:23 +00:00
import net.minecraftforge.gradle.patcher.task.TaskReobfuscateJar
import java.util.stream.Collectors
2018-06-30 18:57:16 +00:00
2018-09-21 06:50:50 +00:00
plugins {
id 'net.minecrell.licenser' version '0.4'
2018-09-25 07:29:20 +00:00
id 'org.ajoberstar.grgit' version '2.3.0'
id 'de.undercouch.download' version '3.3.0'
2019-01-14 03:51:36 +00:00
id "com.github.ben-manes.versions" version '0.20.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
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'
MAPPING_VERSION = '20180921-1.13'
2019-02-14 23:08:53 +00:00
MC_VERSION = '1.13.2'
MCP_VERSION = '20190213.203750'
2018-11-14 00:32:55 +00:00
}
2018-08-27 17:10:07 +00:00
project ( ':mcp' ) {
apply plugin: 'net.minecraftforge.gradle.forgedev.mcp'
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'
apply plugin: 'net.minecraftforge.gradle.forgedev.patcher'
repositories {
mavenCentral ( )
2018-03-24 03:42:33 +00:00
}
2019-02-18 19:39:05 +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'
main 'net.minecraft.server.MinecraftServer'
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'
apply plugin: 'net.minecraftforge.gradle.forgedev.patcher'
2018-09-21 06:50:50 +00:00
apply plugin: 'net.minecrell.licenser'
2018-09-25 07:29:20 +00:00
apply plugin: 'de.undercouch.download'
2018-09-22 03:28:47 +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-02-15 04:09:06 +00:00
group = 'net.minecraftforge' //TODO: remove test when we finish patches and want users to find it
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 {
srcDir "$rootDir/src/fmllauncher/java"
}
resources {
srcDir "$rootDir/src/fmllauncher/resources"
}
}
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 {
srcDir "$rootDir/src/main/java"
}
resources {
srcDir "$rootDir/src/main/resources"
}
2018-03-24 03:42:33 +00:00
}
2019-01-02 00:42:56 +00:00
test {
compileClasspath + = sourceSets . fmllauncher . runtimeClasspath
runtimeClasspath + = sourceSets . fmllauncher . runtimeClasspath
java {
// srcDir "$rootDir/src/test/java" TODO fix later
srcDir "$rootDir/src/fmllaunchertest/java"
}
resources {
srcDir "$rootDir/src/test/resources"
}
}
2018-12-12 04:04:23 +00:00
userdev {
compileClasspath + = sourceSets . main . runtimeClasspath
runtimeClasspath + = sourceSets . main . runtimeClasspath
java {
srcDir "$rootDir/src/userdev/java"
}
resources {
srcDir "$rootDir/src/userdev/resources"
}
}
2018-02-26 23:36:39 +00:00
}
2018-08-27 17:10:07 +00:00
repositories {
2018-09-11 00:31:51 +00:00
mavenLocal ( )
2018-08-27 17:10:07 +00:00
mavenCentral ( )
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 {
2019-02-14 23:08:53 +00:00
SPEC_VERSION = '25.0' // 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-01-04 16:44:57 +00:00
def getVersion = {
//TAG-offset-hash
def raw = grgit . describe ( longDescr: true )
def desc = ( raw = = null ? '0.0-0-unknown' : grgit . describe ( longDescr: true ) ) . split ( '-' ) as List
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 ( )
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-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 'terminal.ansi' , 'true'
property 'org.lwjgl.system.SharedLibraryExtractDirectory' , 'lwjgl_dll'
2019-01-08 08:29:36 +00:00
}
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
2019-01-08 08:29:36 +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 ,
'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-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-02-15 06:11:31 +00:00
api 'net.minecraft:client:${MC_VERSION}:extra'
2018-10-01 23:59:46 +00:00
installer 'com.paulscode:soundsystem:2018+'
installer 'org.ow2.asm:asm:6.2'
installer 'org.ow2.asm:asm-commons:6.2'
installer 'org.ow2.asm:asm-tree:6.2'
2019-04-06 16:10:54 +00:00
installer 'cpw.mods:modlauncher:1.0.+'
installer 'net.minecraftforge:accesstransformers:0.16.+:shadowed'
2019-02-23 19:36:05 +00:00
installer 'net.minecraftforge:eventbus:0.8.+:service'
2019-03-02 00:27:22 +00:00
installer 'net.minecraftforge:forgespi:0.11.+'
2019-02-23 19:36:05 +00:00
installer 'net.minecraftforge:coremods:0.4.+'
2019-02-18 20:54:14 +00:00
installer 'net.minecraftforge:unsafe:0.2.+'
2019-03-23 03:38:43 +00:00
installer 'com.electronwill.night-config:core:3.5.0'
installer 'com.electronwill.night-config:toml:3.5.0'
2019-02-10 19:35:21 +00:00
installer 'org.jline:jline:3.9.0'
2019-01-14 03:51:36 +00:00
installer 'org.apache.maven:maven-artifact:3.6.0'
installer 'net.jodah:typetools:0.6.0'
2018-10-01 23:59:46 +00:00
installer 'java3d:vecmath:1.5.2'
2018-10-05 05:25:27 +00:00
installer 'org.apache.logging.log4j:log4j-api:2.11.1'
installer 'org.apache.logging.log4j:log4j-core:2.11.1'
2019-02-10 19:35:21 +00:00
installer 'net.minecrell:terminalconsoleappender:1.1.+'
2019-02-26 15:28:41 +00:00
installer 'net.sf.jopt-simple:jopt-simple:5.0.4'
2018-12-31 21:33:54 +00:00
fmllauncherImplementation 'com.google.guava:guava:21.0'
fmllauncherImplementation 'com.google.code.gson:gson:2.8.0'
2019-01-02 00:42:56 +00:00
testImplementation "org.junit.jupiter:junit-jupiter-api:5.0.0"
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
task downloadCrowdin ( ) {
ext {
output = file ( 'build/crowdin_raw.zip' )
update = file ( 'build/crowdin.json' )
id = 'minecraft-forge'
}
onlyIf {
project . hasProperty ( 'crowdinKey' ) & & ! project . gradle . startParameter . isOffline ( )
}
doLast {
download {
src "https://api.crowdin.com/api/project/${id}/export?key=${project.crowdinKey}&json"
dest update
overwrite true
}
if ( ! update . text . contains ( 'success' ) ) {
throw new RuntimeException ( "Crowdin export failed, see ${update} for more info" )
}
download {
src "https://api.crowdin.com/api/project/${id}/download/all.zip?key=${project.crowdinKey}"
dest output
overwrite true
}
}
}
task crowdin ( type: Zip ) {
dependsOn downloadCrowdin
2018-10-01 23:59:46 +00:00
onlyIf {
! downloadCrowdin . state . skipped
}
2018-09-25 07:29:20 +00:00
baseName = project . name
version = project . version
classifier = 'crowdin'
destinationDir = file ( 'build/distributions' )
from ( zipTree ( downloadCrowdin . output ) ) {
eachFile { //Tired of waiting for crowdin API, rename things myself. Remove once crowdin stops being dumb
2018-10-02 04:32:41 +00:00
if ( it . name . equals ( 'en_us.json' ) & & ! it . path . startsWith ( 'assets/' ) ) {
it . name = it . path . split ( '/' ) [ 0 ] + '.json'
it . path = 'assets/forge/lang/' + it . name
}
2018-09-25 07:29:20 +00:00
}
2018-10-02 04:32:41 +00:00
exclude { it . isDirectory ( ) }
rename { it . toLowerCase ( ) } //Minecraft needs it lowercase.
exclude '**/*.lang' //Pre-1.13 format
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
task applyClientBinPatches ( type: ApplyBinPatches , dependsOn: genClientBinPatches ) {
clean = { genClientBinPatches . cleanJar }
input = genClientBinPatches . output
}
task applyServerBinPatches ( type: ApplyBinPatches , dependsOn: genServerBinPatches ) {
clean = { genServerBinPatches . cleanJar }
input = genServerBinPatches . output
}
task applyJoinedBinPatches ( type: ApplyBinPatches , dependsOn: genJoinedBinPatches ) {
clean = { genJoinedBinPatches . cleanJar }
input = genJoinedBinPatches . output
}
// Checksum tasks so that we can know if the vanilla classes are what we expect them to do!
task clientBaseChecksum ( type: ArchiveChecksum , dependsOn: genClientBinPatches ) {
input = { genClientBinPatches . cleanJar } //Lazy because Patcher Plugin sets the value afterEvaluate
name = 'client'
}
task serverBaseChecksum ( type: ArchiveChecksum , dependsOn: genServerBinPatches ) {
input = { genServerBinPatches . cleanJar }
name = 'server'
}
task joinedBaseChecksum ( type: ArchiveChecksum , dependsOn: genJoinedBinPatches ) {
input = { genJoinedBinPatches . cleanJar }
name = 'joined'
}
task clientPatchedChecksum ( type: ArchiveChecksum , dependsOn: applyClientBinPatches ) {
input = applyClientBinPatches . output
name = 'client_patched'
}
task serverPatchedChecksum ( type: ArchiveChecksum , dependsOn: applyServerBinPatches ) {
input = applyServerBinPatches . output
name = 'server_patched'
}
task joinedPatchedChecksum ( type: ArchiveChecksum , dependsOn: applyJoinedBinPatches ) {
input = applyJoinedBinPatches . output
name = 'joined_patched'
}
// Utility methods for testing checksums
task cleanChecksums ( ) {
[ 'client' , 'server' , 'joined' ] . each { side - >
[ 'Base' , 'Patched' ] . each { type - >
def clean = "clean${side.capitalize()}${type}Checksum"
dependsOn ( clean )
tasks . findByName ( "${side}${type}Checksum" ) . mustRunAfter ( clean )
}
}
}
task checksums ( ) {
[ 'client' , 'server' , 'joined' ] . each { side - >
[ 'Base' , 'Patched' ] . each { type - >
dependsOn ( "${side}${type}Checksum" )
}
}
}
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
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' )
timestamp = dateToIso8601 ( new Date ( ) )
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 {
def json_vanilla = new JsonSlurper ( ) . parseText ( vanilla . text )
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-01-01 00:48:23 +00:00
logging: [
client: [
2018-10-05 05:25:27 +00:00
argument: '-Dlog4j.configurationFile=${path}' ,
file: [
2019-01-01 00:48:23 +00:00
id: 'client-1.12.xml' ,
sha1: 'ef4f57b922df243d0cef096efe808c72db042149' ,
size: 877 ,
url: 'https://launcher.mojang.com/v1/objects/ef4f57b922df243d0cef096efe808c72db042149/client-1.12.xml'
2018-10-05 05:25:27 +00:00
] ,
type: 'log4j2-xml'
2019-01-01 00:48:23 +00:00
]
] ,
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
2019-01-01 00:48:23 +00:00
sha1: sha1 ( launcherJar . archivePath ) ,
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 ( )
}
}
2018-10-02 20:13:33 +00:00
task installerJson ( dependsOn: [ launcherJson , genClientBinPatches , applyClientBinPatches , applyServerBinPatches ] ) {
2018-09-25 07:29:20 +00:00
ext {
2018-11-14 21:39:56 +00:00
output = file ( 'build/install_profile.json' )
2018-09-30 09:54:20 +00:00
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.0.3'
2019-02-21 12:24:39 +00:00
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.0'
2018-09-30 09:54:20 +00:00
}
doFirst {
ext . BIN_PATCHER = 'net.minecraftforge:binarypatcher:' + genClientBinPatches . resolvedVersion
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
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
sha1: sha1 ( universalJar . archivePath ) ,
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 ,
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: [
2018-10-02 02:19:25 +00:00
client: "[net.minecraft:client:${MC_VERSION}:slim]" ,
server: "[net.minecraft:server:${MC_VERSION}:slim]"
2018-09-29 03:50:01 +00:00
] ,
2018-10-02 20:13:33 +00:00
MC_SLIM_SHA: [
client: "'${sha1(tasks.getByName('downloadClientSlim').output)}'" ,
server: "'${sha1(tasks.getByName('downloadServerSlim').output)}'"
] ,
2018-09-29 03:50:01 +00:00
MC_EXTRA: [
2018-10-02 02:19:25 +00:00
client: "[net.minecraft:client:${MC_VERSION}:extra]" ,
server: "[net.minecraft:server:${MC_VERSION}:extra]"
2018-09-29 03:50:01 +00:00
] ,
2018-10-02 20:13:33 +00:00
MC_EXTRA_SHA: [
client: "'${sha1(tasks.getByName('downloadClientExtra').output)}'" ,
server: "'${sha1(tasks.getByName('downloadServerExtra').output)}'"
] ,
2018-09-30 09:54:20 +00:00
MC_SRG: [
2018-10-02 02:19:25 +00:00
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:srg]" ,
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:srg]"
2018-09-29 03:50:01 +00:00
] ,
2018-09-30 09:54:20 +00:00
PATCHED: [
client: "[${project.group}:${project.name}:${project.version}:client]" ,
server: "[${project.group}:${project.name}:${project.version}:server]"
2018-10-02 20:13:33 +00:00
] ,
PATCHED_SHA: [
client: "'${sha1(applyClientBinPatches.output)}'" ,
server: "'${sha1(applyServerBinPatches.output)}'"
2018-09-30 09:54:20 +00:00
]
] ,
processors: [
[
jar: INSTALLER_TOOLS ,
classpath: getClasspath ( project , libs , INSTALLER_TOOLS ) ,
args: [
'--task' , 'MCP_DATA' ,
'--input' , "[${MCP_ARTIFACT.descriptor}]" ,
'--output' , '{MAPPINGS}' ,
'--key' , 'mappings'
]
] , [
2018-10-01 23:59:46 +00:00
jar: JAR_SPLITTER ,
classpath: getClasspath ( project , libs , JAR_SPLITTER ) ,
2018-09-30 09:54:20 +00:00
args: [
'--input' , '{MINECRAFT_JAR}' ,
'--slim' , '{MC_SLIM}' ,
'--extra' , '{MC_EXTRA}' ,
'--srg' , '{MAPPINGS}'
2018-10-02 20:13:33 +00:00
] ,
outputs: [
'{MC_SLIM}' : '{MC_SLIM_SHA}' ,
'{MC_EXTRA}' : '{MC_EXTRA_SHA}'
2018-09-30 09:54:20 +00:00
]
] , [ // SpecialSource has a bug where it won't create the nessasary directories, remove when they fix that.
jar: INSTALLER_TOOLS ,
classpath: getClasspath ( project , libs , INSTALLER_TOOLS ) ,
args: [
'--task' , 'CREATE_PARENTS' ,
'--target' , '{MC_SRG}'
]
] , [
jar: 'net.md-5:SpecialSource:1.8.3' ,
classpath: getClasspath ( project , libs , 'net.md-5:SpecialSource:1.8.3' ) ,
args: [
'--in-jar' , '{MC_SLIM}' ,
'--out-jar' , '{MC_SRG}' ,
'--srg-in' , '{MAPPINGS}'
]
] , [
jar: BIN_PATCHER ,
classpath: getClasspath ( project , libs , BIN_PATCHER ) ,
args: [
'--clean' , '{MC_SRG}' ,
'--output' , '{PATCHED}' ,
'--apply' , '{BINPATCH}'
2018-10-02 20:13:33 +00:00
] ,
outputs: [
'{PATCHED}' : '{PATCHED_SHA}'
2018-09-30 09:54:20 +00:00
]
2018-09-29 03:50:01 +00:00
]
2018-09-25 07:29:20 +00:00
]
]
2018-09-30 09:54:20 +00:00
getClasspath ( project , libs , MCP_ARTIFACT . descriptor ) //Tell it to download mcp_config
json . libraries = libs . values ( ) . sort { a , b - > a . name . compareTo ( b . name ) }
2018-09-29 03:50:01 +00:00
2018-09-25 07:29:20 +00:00
output . text = new JsonBuilder ( json ) . toPrettyString ( )
}
}
2018-10-02 20:13:33 +00:00
[ 'client' , 'server' ] . each { side - >
2019-02-21 12:24:39 +00:00
[ 'slim' , 'extra' ] . each { type - >
2018-10-02 20:13:33 +00:00
def name = "download${side.capitalize()}${type.capitalize()}"
task "${name}" ( type: DownloadMavenArtifact ) {
artifact = "net.minecraft:${side}:${MC_VERSION}:${type}"
}
installerJson . dependsOn ( name )
installerJson . inputs . file ( tasks . getByName ( name ) . output )
}
}
2018-09-25 07:29:20 +00:00
universalJar {
from extraTxts
2018-10-02 02:19:25 +00:00
/ * TODO: Annotation Cache ? need to talk to cpw about his new design .
2018-09-25 07:29:20 +00:00
from ( fixAnnotationsJson ) {
into 'META-INF'
}
dependsOn fixAnnotationsJson
* /
2018-10-01 23:59:46 +00:00
// Add checksum files of clean and patched vanilla classes.
[ 'client' , 'server' ] . each { side - >
[ 'Base' , 'Patched' ] . each { type - >
from ( tasks . getByName ( "${side}${type}Checksum" ) . output ) {
into 'checksums/'
}
}
}
dependsOn checksums
2018-09-25 07:29:20 +00:00
// add crowdin locales
2018-10-01 23:59:46 +00:00
from { ! crowdin . state . skipped ? zipTree ( crowdin . archivePath ) : null }
2018-09-25 07:29:20 +00:00
dependsOn crowdin
2019-01-01 00:48:23 +00:00
doFirst {
MANIFESTS . each { pkg , values - >
if ( pkg = = '/' ) {
manifest . attributes ( values )
} else {
manifest . attributes ( values , pkg )
}
}
}
}
2019-02-05 02:23:58 +00:00
2019-02-26 15:28:41 +00:00
task launcherJar ( type: Jar ) {
2019-01-01 00:48:23 +00:00
classifier 'launcher'
from sourceSets . fmllauncher . output
2018-09-25 07:29:20 +00:00
doFirst {
def classpath = new StringBuilder ( )
2018-10-01 23:59:46 +00:00
def artifacts = getArtifacts ( project , project . configurations . installer , false )
artifacts . each { key , lib - >
classpath + = "libraries/${lib.downloads.artifact.path} "
2018-09-25 07:29:20 +00:00
}
2018-10-05 05:25:27 +00:00
classpath + = "libraries/net/minecraft/server/${MC_VERSION}/server-${MC_VERSION}-extra.jar"
2019-01-01 00:48:23 +00:00
MANIFESTS . each { pkg , values - >
if ( pkg = = '/' ) {
manifest . attributes ( values + = [
'Main-Class' : 'net.minecraftforge.server.ServerMain' ,
2019-02-26 15:28:41 +00:00
'Class-Path' : classpath . toString ( ) ,
'ServerLaunchArgs' : [
'--gameDir' , '.' ,
'--launchTarget' , 'fmlserver' ,
'--fml.forgeVersion' , "${project.version.substring(MC_VERSION.length() + 1)}" . toString ( ) ,
'--fml.mcpVersion' , MCP_VERSION ,
'--fml.mcVersion' , MC_VERSION ,
'--fml.forgeGroup' , project . group
] . join ( ' ' )
2019-01-01 00:48:23 +00:00
] )
} else {
manifest . attributes ( values , pkg )
}
}
2018-09-30 09:54:20 +00:00
}
}
task downloadInstaller ( type: DownloadMavenArtifact ) {
2018-10-12 01:54:05 +00:00
artifact = 'net.minecraftforge:installer:2.0.+:shrunk'
changing = true
2018-09-25 07:29:20 +00:00
}
2019-01-01 00:48:23 +00:00
task installerJar ( type: Zip , dependsOn: [ downloadInstaller , installerJson , launcherJson , genClientBinPatches , genServerBinPatches , 'signUniversalJar' , 'signLauncherJar' ] ) {
2018-09-25 07:29:20 +00:00
classifier = 'installer'
2018-09-30 09:54:20 +00:00
extension = 'jar' //Needs to be Zip task to not override Manifest, so set extension
2018-11-14 21:39:56 +00:00
destinationDir = file ( 'build/libs' )
2018-09-30 09:54:20 +00:00
from ( extraTxts )
from ( rootProject . file ( '/src/main/resources/forge_logo.png' ) ) {
rename { 'big_logo.png' }
}
from ( rootProject . file ( '/src/main/resources/url.png' ) )
from ( genClientBinPatches . output ) {
rename { 'data/client.lzma' }
}
from ( genServerBinPatches . output ) {
rename { 'data/server.lzma' }
}
from ( universalJar ) {
into "/maven/${project.group.replace('.', '/')}/${project.name}/${project.version}/"
2019-01-01 00:48:23 +00:00
}
from ( launcherJar ) {
into "/maven/${project.group.replace('.', '/')}/${project.name}/${project.version}/"
2018-10-02 03:27:05 +00:00
rename { "${project.name}-${project.version}.jar" }
2018-09-30 09:54:20 +00:00
}
from ( installerJson . output )
from ( launcherJson . output )
from ( zipTree ( downloadInstaller . output ) ) {
duplicatesStrategy = 'exclude'
}
2018-09-25 07:29:20 +00:00
}
2019-01-01 00:48:23 +00:00
[ universalJar , launcherJar , installerJar ] . each { t - >
task "sign${t.name.capitalize()}" ( type: SignJar , dependsOn: t ) {
onlyIf {
JAR_SIGNER ! = null & & t . state . failure = = null
}
def jarsigner = JAR_SIGNER = = null ? [ : ] : JAR_SIGNER
alias = 'forge'
storePass = jarsigner . storepass
keyPass = jarsigner . keypass
keyStore = jarsigner . keystore
inputFile = t . archivePath
outputFile = t . archivePath
doFirst {
project . logger . lifecycle ( 'Signing: ' + inputFile )
}
2018-09-30 09:54:20 +00:00
}
2019-01-01 00:48:23 +00:00
t . finalizedBy ( tasks . getByName ( "sign${t.name.capitalize()}" ) )
2018-09-30 09:54:20 +00:00
}
2018-09-25 07:29:20 +00:00
task makeMdk ( type: Zip ) {
baseName = project . name
classifier = 'mdk'
version = project . version
2018-11-14 21:39:56 +00:00
destinationDir = file ( 'build/libs' )
2018-09-25 07:29:20 +00:00
from rootProject . file ( 'gradlew' )
from rootProject . file ( 'gradlew.bat' )
from extraTxts
from ( rootProject . file ( 'gradle/' ) ) {
into ( 'gradle/' )
}
from ( rootProject . file ( 'mdk/' ) ) {
2018-11-14 21:39:56 +00:00
rootProject . file ( 'mdk/gitignore.txt' ) . eachLine {
if ( ! it . trim ( ) . isEmpty ( ) & & ! it . trim ( ) . startsWith ( '#' ) )
exclude it
}
filter ( ReplaceTokens , tokens: [
FORGE_VERSION: project . version ,
2018-11-14 21:42:11 +00:00
FORGE_GROUP: project . group ,
FORGE_NAME: project . name ,
2018-11-14 21:39:56 +00:00
MC_VERSION: MC_VERSION ,
MAPPING_CHANNEL: MAPPING_CHANNEL ,
MAPPING_VERSION: MAPPING_VERSION
2018-09-25 07:29:20 +00:00
] )
rename 'gitignore\\.txt' , '.gitignore'
}
}
2018-10-12 01:54:05 +00:00
userdevConfig {
def artifacts = getArtifacts ( project , project . configurations . installer , true )
artifacts . each { key , lib - >
addLibrary ( lib . name )
}
2019-01-08 08:29:36 +00:00
addLibrary ( "${project.group}:${project.name}:${project.version}:launcher" )
runs {
2019-02-18 19:39:05 +00:00
client {
2019-03-07 04:59:32 +00:00
main 'net.minecraftforge.userdev.LaunchTesting'
2019-02-18 19:39:05 +00:00
2019-01-08 08:29:36 +00:00
environment 'target' , 'fmluserdevclient'
2019-02-18 19:39:05 +00:00
environment 'assetIndex' , '{asset_index}'
2019-01-08 08:29:36 +00:00
environment 'assetDirectory' , '{assets_root}'
environment 'nativesDirectory' , '{natives}'
2019-02-18 19:39:05 +00:00
environment 'MC_VERSION' , "${MC_VERSION}"
environment 'FORGE_GROUP' , "${project.group}"
environment 'MCP_VERSION' , "${MCP_VERSION}"
2019-01-08 08:29:36 +00:00
environment 'MOD_CLASSES' , '{source_roots}'
environment 'MCP_MAPPINGS' , '{mcp_mappings}'
2019-02-18 19:39:05 +00:00
environment 'FORGE_VERSION' , "${project.version.substring(MC_VERSION.length() + 1)}"
2019-01-08 08:29:36 +00:00
}
2019-02-18 19:39:05 +00:00
server {
2019-03-07 04:59:32 +00:00
main 'net.minecraftforge.userdev.LaunchTesting'
2019-02-18 19:39:05 +00:00
2019-01-10 04:57:01 +00:00
environment 'target' , 'fmluserdevserver'
2019-02-18 19:39:05 +00:00
environment 'MC_VERSION' , "${MC_VERSION}"
environment 'FORGE_GROUP' , "${project.group}"
environment 'MCP_VERSION' , "${MCP_VERSION}"
2019-01-08 08:29:36 +00:00
environment 'MOD_CLASSES' , '{source_roots}'
environment 'MCP_MAPPINGS' , '{mcp_mappings}'
2019-02-18 19:39:05 +00:00
environment 'FORGE_VERSION' , "${project.version.substring(MC_VERSION.length() + 1)}"
2019-01-08 08:29:36 +00:00
}
}
2018-10-12 01:54:05 +00:00
}
2018-09-21 06:50:50 +00:00
license {
header = file ( "$rootDir/LICENSE-header.txt" )
include 'net/minecraftforge/'
exclude 'net/minecraftforge/server/terminalconsole/'
2018-09-24 04:07:33 +00:00
exclude 'net/minecraftforge/api/' // exclude API here because it's validated in the SPI build
2018-09-21 06:50:50 +00:00
exclude 'net/minecraftforge/fml/common/versioning/ComparableVersion.java'
exclude 'net/minecraftforge/fml/common/versioning/InvalidVersionSpecificationException.java'
exclude 'net/minecraftforge/fml/common/versioning/Restriction.java'
exclude 'net/minecraftforge/fml/common/versioning/VersionRange.java'
tasks {
main {
files = files ( "$rootDir/src/main/java" )
}
test {
files = files ( "$rootDir/src/test/java" )
}
}
2018-10-12 01:54:05 +00:00
}
2018-09-25 07:29:20 +00:00
2018-12-12 04:04:23 +00:00
task userdevExtras ( type: Jar ) {
dependsOn classes
from sourceSets . userdev . output
classifier 'userdev-temp'
}
task userdevExtrasReobf ( type: TaskReobfuscateJar ) {
dependsOn userdevExtras , createMcp2Srg
input = tasks . userdevExtras . archivePath
2019-02-05 02:23:58 +00:00
classpath = project . configurations . compile
2018-12-12 04:04:23 +00:00
srg = tasks . createMcp2Srg . output
}
userdevJar {
dependsOn userdevExtrasReobf
from ( zipTree ( tasks . userdevExtrasReobf . output ) ) {
into '/inject/'
}
from ( sourceSets . userdev . output . resourcesDir ) {
into '/inject/'
}
}
applyRangeMap {
setSources sourceSets . userdev . java . srcDirs . findAll ( { f - > ( f ! = patcher . patchedSrc ) } )
}
2019-02-21 12:24:39 +00:00
tasks . eclipse . dependsOn ( 'genEclipseRuns' )
2018-09-25 07:29:20 +00:00
publishing {
publications {
mavenJava ( MavenPublication ) {
artifact universalJar
2018-11-15 20:40:30 +00:00
if ( changelog . exists ( ) ) {
artifact ( changelog ) {
classifier = 'changelog'
}
}
2018-10-01 23:59:46 +00:00
artifact installerJar
2018-09-25 07:29:20 +00:00
//TODO: installer-win
artifact makeMdk
artifact userdevJar
2018-10-12 01:54:05 +00:00
artifact sourcesJar
2019-01-01 00:48:23 +00:00
artifact launcherJar
2018-09-25 07:29:20 +00:00
pom {
name = 'forge'
description = 'Modifactions to Minecraft to enable mod developers.'
url = 'https://github.com/MinecraftForge/MinecraftForge'
scm {
url = 'https://github.com/MinecraftForge/MinecraftForge'
connection = 'scm:git:git://github.com/MinecraftForge/MinecraftForge.git'
developerConnection = 'scm:git:git@github.com:MinecraftForge/MinecraftForge.git'
}
issueManagement {
system = 'github'
url = 'https://github.com/MinecraftForge/MinecraftForge/issues'
}
licenses {
license {
name = 'LGPL 2.1'
url = 'https://github.com/MinecraftForge/MinecraftForge/blob/1.13-pre/LICENSE.txt'
distribution = 'repo'
}
}
}
}
}
repositories {
maven {
if ( project . hasProperty ( 'forgeMavenPassword' ) ) {
credentials {
username project . properties . forgeMavenUser
password project . properties . forgeMavenPassword
}
2018-11-14 00:32:55 +00:00
url 'https://files.minecraftforge.net/maven/manage/upload'
2018-09-25 07:29:20 +00:00
} else {
url 'file://' + rootProject . file ( 'repo' ) . getAbsolutePath ( )
}
}
}
}
}
def dateToIso8601 ( date ) {
def format = new SimpleDateFormat ( "yyyy-MM-dd'T'HH:mm:ssZ" )
def result = format . format ( date )
return result [ 0 . . 21 ] + ':' + result [ 22 . . - 1 ]
}
2018-09-29 03:50:01 +00:00
2018-09-25 07:29:20 +00:00
def sha1 ( file ) {
2018-09-29 03:50:01 +00:00
MessageDigest md = MessageDigest . getInstance ( 'SHA-1' )
2018-09-25 07:29:20 +00:00
file . eachByte 4096 , { bytes , size - >
2018-09-29 03:50:01 +00:00
md . update ( bytes , 0 , size )
}
return md . digest ( ) . collect { String . format "%02x" , it } . join ( )
}
def artifactTree ( project , artifact ) {
if ( ! project . ext . has ( 'tree_resolver' ) )
project . ext . tree_resolver = 1
def cfg = project . configurations . create ( 'tree_resolver_' + project . ext . tree_resolver + + )
def dep = project . dependencies . create ( artifact )
cfg . dependencies . add ( dep )
def files = cfg . resolve ( )
2018-10-01 23:59:46 +00:00
return getArtifacts ( project , cfg , true )
2018-09-29 03:50:01 +00:00
}
2018-10-01 23:59:46 +00:00
def getArtifacts ( project , config , classifiers ) {
2018-09-29 03:50:01 +00:00
def ret = [ : ]
config . resolvedConfiguration . resolvedArtifacts . each {
def art = [
group: it . moduleVersion . id . group ,
name: it . moduleVersion . id . name ,
version: it . moduleVersion . id . version ,
classifier: it . classifier ,
extension: it . extension ,
file: it . file
]
def key = art . group + ':' + art . name
def folder = "${art.group.replace('.', '/')}/${art.name}/${art.version}/"
def filename = "${art.name}-${art.version}"
if ( art . classifier ! = null )
filename + = "-${art.classifier}"
filename + = ".${art.extension}"
def path = "${folder}${filename}"
def url = "https://libraries.minecraft.net/${path}"
if ( ! checkExists ( url ) ) {
url = "https://files.minecraftforge.net/maven/${path}"
2018-10-01 23:59:46 +00:00
}
//TODO remove when Mojang launcher is updated
if ( ! classifiers & & art . classifier ! = null ) { //Mojang launcher doesn't currently support classifiers, so... move it to part of the version, and force the extension to 'jar'
art . version = "${art.version}-${art.classifier}"
art . classifier = null
art . extension = 'jar'
path = "${art.group.replace('.', '/')}/${art.name}/${art.version}/${art.name}-${art.version}.jar"
2018-09-29 03:50:01 +00:00
}
ret [ key ] = [
name: "${art.group}:${art.name}:${art.version}" + ( art . classifier = = null ? '' : ":${art.classifier}" ) + ( art . extension = = 'jar' ? '' : "@${art.extension}" ) ,
downloads: [
artifact: [
path: path ,
url: url ,
sha1: sha1 ( art . file ) ,
size: art . file . length ( )
]
]
]
}
return ret
}
def checkExists ( url ) {
def code = new URL ( url ) . openConnection ( ) . with {
requestMethod = 'HEAD'
connect ( )
responseCode
}
return code = = 200
}
def getClasspath ( project , libs , artifact ) {
def ret = [ ]
artifactTree ( project , artifact ) . each { key , lib - >
libs [ lib . name ] = lib
if ( lib . name ! = artifact )
ret . add ( lib . name )
2018-09-21 06:50:50 +00:00
}
2018-09-29 03:50:01 +00:00
return ret
2015-06-28 22:19:52 +00:00
}
2015-06-29 17:56:23 +00:00
2018-08-27 17:10:07 +00:00
//evaluationDependsOnChildren()
task setup ( ) {
dependsOn ':clean:extractMapped'
dependsOn ':forge:extractMapped' //These must be strings so that we can do lazy resolution. Else we need evaluationDependsOnChildren above
2016-11-21 00:15:15 +00:00
}
2016-03-07 02:02:44 +00:00