Last active
November 21, 2023 09:15
-
-
Save 2xsaiko/db8fc601df89703a360bccc0395ec590 to your computer and use it in GitHub Desktop.
ForgeGradle buildscript w/ Gradle Kotlin DSL
This file contains hidden or 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
@file:Suppress("PropertyName") | |
import net.minecraftforge.gradle.user.UserBaseExtension | |
import org.gradle.jvm.tasks.Jar | |
val mod_name: String by extra | |
val mod_version: String by extra | |
val mc_version: String by extra | |
val forge_version: String by extra | |
val mappings_version: String by extra | |
val Project.minecraft: UserBaseExtension | |
get() = extensions.getByName<UserBaseExtension>("minecraft") | |
buildscript { | |
repositories { | |
jcenter() | |
maven { setUrl("http://files.minecraftforge.net/maven") } | |
} | |
dependencies { | |
classpath("net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT") | |
} | |
} | |
plugins { | |
java | |
scala | |
} | |
apply { | |
plugin("net.minecraftforge.gradle.forge") | |
} | |
version = mod_version | |
group = "therealfarfetchd.$mod_name" | |
configure<UserBaseExtension> { | |
version = "$mc_version-$forge_version" | |
runDir = "run" | |
mappings = mappings_version | |
} | |
tasks.withType<JavaCompile> { | |
sourceCompatibility = "1.8" | |
targetCompatibility = "1.8" | |
} | |
repositories { | |
} | |
dependencies { | |
} | |
tasks.withType<Jar> { | |
inputs.properties += "version" to project.version | |
inputs.properties += "mcversion" to project.minecraft.version | |
baseName = mod_name | |
filesMatching("/mcmod.info") { | |
expand(mapOf( | |
"version" to project.version, | |
"mcversion" to project.minecraft.version | |
)) | |
} | |
} | |
fun DependencyHandler.deobfCompile( | |
group: String, | |
name: String, | |
version: String? = null, | |
configuration: String? = null, | |
classifier: String? = null, | |
ext: String? = null): ExternalModuleDependency = | |
create(group, name, version, configuration, classifier, ext).apply { add("deobfCompile", this) } | |
fun DependencyHandler.deobfCompile(dependencyNotation: Any): Dependency = | |
add("deobfCompile", dependencyNotation) |
This file contains hidden or 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
org.gradle.jvmargs=-Xmx3G | |
mc_version=1.12.2 | |
forge_version=14.23.2.2623 | |
mappings_version=snapshot_20171003 | |
mod_name=mymodname | |
mod_version=1.0.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment