2019-02-16 18:39:44 -08:00
|
|
|
import net.minecraftforge.gradle.user.UserBaseExtension
|
|
|
|
import Config.Libs.Sponge.API7 as API7
|
2019-02-17 23:32:17 -08:00
|
|
|
// Config is located in <root>/buildSrc/src/main/java/Config.kt
|
|
|
|
// It provides a bunch of constant values we use as dependency
|
|
|
|
// strings, so we don't have to duplicate a bunch of them in
|
|
|
|
// various scripts. The import as allows for shorthand.
|
2019-02-16 18:39:44 -08:00
|
|
|
|
2019-02-17 23:32:17 -08:00
|
|
|
/*
|
|
|
|
Special dependency for the buildscript to be able to use ForgeGradle 2.3-SNAPSHOT.
|
|
|
|
Needs to define the repository where FG exists, and then adds the classpath of the
|
|
|
|
plugin jar for the buildscript. It's what allows us to import UserBaseExtension
|
|
|
|
*/
|
2019-02-16 18:39:44 -08:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
jcenter()
|
|
|
|
maven(Repos.forge)
|
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
classpath(Plugins.FG2_3.classpath)
|
|
|
|
}
|
|
|
|
}
|
2019-02-17 23:32:17 -08:00
|
|
|
|
|
|
|
// Extension created to set up the minecraft block for ForgeGradle. This will be different for ForgeGradle 3>, but we don't
|
|
|
|
// use that newer version for 1.12, that will be used for 1.13+
|
2019-02-16 18:39:44 -08:00
|
|
|
val Project.minecraft: UserBaseExtension
|
|
|
|
get() = extensions.getByName<UserBaseExtension>(Plugins.FG2_3.extensionName)
|
|
|
|
|
2019-02-07 19:55:52 -08:00
|
|
|
plugins {
|
2019-02-16 18:39:44 -08:00
|
|
|
`java-library`
|
2019-02-17 23:32:17 -08:00
|
|
|
// Apply the spongegradle plugin to generate the metadata file, these cannot be import shorthanded because
|
|
|
|
// they need to be resolved at script compilation time to apply the plugin
|
2019-02-16 18:39:44 -08:00
|
|
|
id(Config.Libs.Sponge.API7.spongeGradleId) version Config.Libs.Sponge.API7.spongeGradleVersion // supplies sponge repo and plugin metadata creation tasks
|
2019-02-07 19:55:52 -08:00
|
|
|
}
|
2019-02-17 23:32:17 -08:00
|
|
|
|
|
|
|
// Apply the FG2.3 plguin the old way, because there's no valid way to do it the new plugins way.
|
2019-02-16 18:39:44 -08:00
|
|
|
apply(plugin = API7.forgeGradleId)
|
2019-02-07 19:55:52 -08:00
|
|
|
|
|
|
|
dependencies {
|
2019-02-17 23:32:17 -08:00
|
|
|
// Only SpongeAPI needed for the base plugin class, a majority will be api version dependent.
|
2019-02-16 18:39:44 -08:00
|
|
|
compileOnly(API7.api) // SpongeAPI
|
|
|
|
}
|
|
|
|
|
2019-02-17 23:32:17 -08:00
|
|
|
/*
|
|
|
|
Now this configures ForgeGradle to set up the Minecraft (NMS) dependency. To use it, one needs to run
|
|
|
|
`gradlew sDecW` either from root or `gradlew :sponge:api7:sDecW`. The process generates a Minecraft
|
|
|
|
dependency with forge sources so one can read MCP remapped code. The dependency is not included in
|
|
|
|
git.
|
|
|
|
*/
|
2019-02-16 18:39:44 -08:00
|
|
|
configure<UserBaseExtension> {
|
2019-02-17 23:32:17 -08:00
|
|
|
version = API7.minecraftVersion // The minecraft (forge) version
|
|
|
|
runDir = "run" // Where the run directory will be placed
|
|
|
|
mappings = API7.mappings // The MCP mappings version
|
2019-02-16 18:39:44 -08:00
|
|
|
}
|
|
|
|
|
2019-02-17 23:32:17 -08:00
|
|
|
/**
|
|
|
|
* Some extra information that needs to be included for plugin/mod generation that will be
|
|
|
|
* parsed by Sponge or Forge (when SpongeForge is involved, Forge loads the plugins for SpongeForge)
|
|
|
|
*/
|
2019-02-16 18:39:44 -08:00
|
|
|
tasks.withType<Jar> {
|
|
|
|
inputs.properties += "version" to project.version
|
|
|
|
inputs.properties += "mcversion" to project.minecraft.version
|
|
|
|
|
|
|
|
baseName = "mcmmo"
|
|
|
|
|
|
|
|
filesMatching("/mcmod.info") {
|
|
|
|
expand(mapOf(
|
|
|
|
"version" to project.version,
|
|
|
|
"mcversion" to project.minecraft.version
|
|
|
|
))
|
|
|
|
}
|
2019-02-07 19:55:52 -08:00
|
|
|
}
|
|
|
|
|