Created
May 5, 2018 06:48
-
-
Save FusionLord/a8f0208b6ffaa2f466f119a13c4a1620 to your computer and use it in GitHub Desktop.
MultiMod setup.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
jcenter() | |
maven { url 'http://files.minecraftforge.net/maven' } | |
} | |
dependencies { | |
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' | |
} | |
} | |
allprojects { | |
apply plugin: 'java' | |
apply plugin: 'idea' | |
apply plugin: 'net.minecraftforge.gradle.forge' | |
sourceCompatibility = '1.8' | |
targetCompatibility = '1.8' | |
compileJava { | |
sourceCompatibility = '1.8' | |
targetCompatibility = '1.8' | |
} | |
idea { | |
module { | |
inheritOutputDirs = true | |
} | |
} | |
task wrapper(type: Wrapper) { | |
gradleVersion = '4.7' | |
} | |
task jarJavaDoc(type: Jar, dependsOn: 'javaDoc') { | |
from javadoc.destinationDir | |
classifier = 'javadoc' | |
} | |
task jarDeobf(type: Jar) { | |
from sourceSets.main.output | |
classifier = 'deobf' | |
} | |
task jarSrc(type: Jar, dependsOn: 'sourceMainJava') { | |
from sourceSets.main.allSource | |
classifier = 'src' | |
} | |
artifacts { | |
archives jarSrc | |
archives jarDeobf | |
archives jarJavaDoc | |
} | |
minecraft { | |
version = "${minecraft_version}-${forge_version}" | |
runDir = '../run' | |
replace "${version}", project.version | |
mappings = forge_mappings | |
} | |
repositories { | |
mavenCentral() | |
jcenter() | |
} | |
dependencies { | |
subprojects.each { compile it } | |
} | |
processResources { | |
inputs.property 'version', project.version | |
inputs.property 'mcversion', project.minecraft.version | |
from(sourceSets.main.resources.srcDirs) { | |
include 'mcmod.info' | |
expand 'version': project.version, 'mcversion': project.minecraft.version | |
} | |
from(sourceSets.main.resources.srcDirs) { | |
exclude 'mcmod.info' | |
} | |
} | |
} | |
/** | |
* This adds any `subproject`'s Access Transformers to the `rootProject` so functionality works in debug mode. | |
*/ | |
import net.minecraftforge.gradle.user.patcherUser.forge.ForgeExtension | |
import net.minecraftforge.gradle.user.patcherUser.forge.ForgePlugin | |
task applySubATs { | |
ForgeExtension e = getPlugins().getPlugin(ForgePlugin.class).getExtension() | |
subprojects.each { p -> | |
p.sourceSets.main.resources.findAll{ f -> f.path.endsWith('_at.cfg')}.each { f -> | |
e.atSource(f) | |
} | |
} | |
} | |
afterEvaluate { | |
tasks.extractDependencyATs.finalizedBy applySubATs | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment