Created
June 13, 2019 16:14
-
-
Save Barteks2x/4365ce3ab69a99adb23420a04aae67be to your computer and use it in GitHub Desktop.
ForgeGradle3 buildscript using kotlin DSL. Note: Start with initial.build.gradle.kts and run task kotlinDslAccessorsSnapshot
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
import java.text.SimpleDateFormat | |
import java.util.* | |
buildscript { | |
repositories { | |
maven { setUrl("https://files.minecraftforge.net/maven") } | |
jcenter() | |
mavenCentral() | |
} | |
dependencies { | |
classpath("net.minecraftforge.gradle:ForgeGradle:3.+") | |
} | |
} | |
plugins { | |
eclipse | |
`maven-publish` | |
} | |
apply(plugin = "net.minecraftforge.gradle") | |
version = "1.0" | |
group = "com.yourname.modid" | |
base { | |
archivesBaseName = "modid" | |
} | |
java { | |
sourceCompatibility = JavaVersion.VERSION_1_8 | |
targetCompatibility = JavaVersion.VERSION_1_8 | |
} | |
minecraft { | |
mappings("snapshot", "20190608-1.14.2") | |
runs.create("client") { | |
workingDirectory(project.file("run")) | |
// Recommended logging data for a userdev environment | |
property("forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP") | |
// Recommended logging level for the console | |
property("forge.logging.console.level", "debug") | |
mods.create("examplemod") { | |
source(java.sourceSets["main"]) | |
} | |
} | |
runs.create("server") { | |
workingDirectory(project.file("run")) | |
// Recommended logging data for a userdev environment | |
property("forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP") | |
// Recommended logging level for the console | |
property("forge.logging.console.level", "debug") | |
mods.create("examplemod") { | |
source(java.sourceSets["main"]) | |
} | |
} | |
} | |
dependencies { | |
minecraft("net.minecraftforge:forge:1.14.2-26.0.25") | |
} | |
tasks.getByName<Jar>("jar") { | |
manifest { | |
attributes(mapOf( | |
"Specification-Title" to "examplemod", | |
"Specification-Vendor" to "examplemodsareus", | |
"Specification-Version" to "1", // We are version 1 of ourselves | |
"Implementation-Title" to project.name, | |
"Implementation-Version" to version, | |
"Implementation-Vendor" to "examplemodsareus", | |
"Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date())) | |
) | |
} | |
} | |
// Example configuration to allow publishing using the maven-publish task | |
// we define a custom artifact that is sourced from the reobfJar output task | |
// and then declare that to be published | |
// Note you'll need to add a repository here | |
val reobfFile = file("$buildDir/reobfJar/output.jar") | |
val reobfArtifact = artifacts.add("default", reobfFile) { | |
type = "jar" | |
builtBy("reobfJar") | |
} | |
publishing { | |
publications.create("mavenJava", MavenPublication::class.java) { | |
artifact(reobfArtifact) | |
} | |
repositories { | |
maven { | |
setUrl("file:///${project.projectDir}/mcmodsrepo") | |
} | |
} | |
} |
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
import java.text.SimpleDateFormat | |
import java.util.* | |
buildscript { | |
repositories { | |
maven { setUrl("https://files.minecraftforge.net/maven") } | |
jcenter() | |
mavenCentral() | |
} | |
dependencies { | |
classpath("net.minecraftforge.gradle:ForgeGradle:3.+") | |
} | |
} | |
plugins { | |
eclipse | |
`maven-publish` | |
} | |
apply(plugin = "net.minecraftforge.gradle") | |
dependencies { | |
"minecraft"("net.minecraftforge:forge:1.14.2-26.0.25") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment