Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ build
# other
eclipse
run
runs

/**/mcmodsrepo/
/obfuscation/fg7/repo/
/_internal/fg7/test-repo/
/obfuscation/fg7-kotlin/repo/
/_internal/test-repo/
8 changes: 6 additions & 2 deletions _internal/fg7/build.gradle → _internal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ tasks.named('buildEnvironment') {

tasks.register('updateBuilds') {
subprojects.each { sub ->
def lines = sub.file('build.gradle').readLines()
def file = sub.file('build.gradle')
if (!file.exists()) file = sub.file('build.gradle.kts')
def lines = file.readLines()
lines = lines.collect { line ->
for (def plugin : gradle.ext.pluginVersions) {
// Yes this is hacky string match, but we just need to keep the structure sane
if (line.contains(" id '${plugin.id}' version '"))
return " id '${plugin.id}' version '${plugin.version}'"
if (line.contains(" id(\"${plugin.id}\") version \""))
return " id(\"${plugin.id}\") version \"${plugin.version}\""
return line
}
}
sub.file('build.gradle').text = lines.join('\n') + '\n' // New line at the end
file.text = lines.join('\n') + '\n' // New line at the end
}
}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
File renamed without changes.
File renamed without changes.
19 changes: 12 additions & 7 deletions _internal/fg7/settings.gradle → _internal/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
pluginManagement {
// This includes various Forge projects if their repo exists relative to the 'MDKExamples' repo root.
// This is done to make debugging those projects easier.
def root = new File("${settingsDir}/../../../").canonicalFile
def root = new File("${settingsDir}/../../").canonicalFile
gradle.ext.pluginVersions = [
[version: '7.0.0-rc.5', id: 'net.minecraftforge.gradle', paths: ['ForgeGradle', 'ForgeGradle7']],
[version: '5.0.3', id: 'net.minecraftforge.accesstransformers', paths: ['AccessTransformers/at-gradle']],
[version: '0.2.3', id: 'net.minecraftforge.jarjar', paths: ['JarJar/jarjar-gradle']],
[version: '[7.0.10,8.0)', id: 'net.minecraftforge.gradle'],
[version: '5.0.3', id: 'net.minecraftforge.accesstransformers'],
[version: '0.2.3', id: 'net.minecraftforge.jarjar'],
[version: '1.0.2', id: 'net.minecraftforge.renamer'],
]

gradle.ext.pluginVersions.each { candidate ->
Expand Down Expand Up @@ -38,15 +39,19 @@ rootProject.name = 'mdkexamples'

def children = [
[name: 'accesstransformers-only', path: 'accesstransformers-only/fg7'],
[name: 'accesstransformers-only-kotlin', path: 'accesstransformers-only/fg7-kotlin'],
[name: 'jarjar-only', path: 'jarjar-only/fg7'],
[name: 'jarjar-only-kotlin', path: 'jarjar-only/fg7-kotlin'],
[name: 'traditional-mdk', path: 'traditional-mdk/fg7'],
// TODO [MDKExamples] Add tests for Kotlin examples
//[name: 'traditional-mdk', path: 'traditional-mdk/fg7-kotlin'],
[name: 'traditional-mdk-kotlin', path: 'traditional-mdk/fg7-kotlin'],
[name: 'mixins-only', path: 'mixins-only/fg7'],
[name: 'mixins-only-kotlin', path: 'mixins-only/fg7-kotlin'],
[name: 'obfuscation', path: 'obfuscation/fg7'],
[name: 'obfuscation-kotlin', path: 'obfuscation/fg7-kotlin']
]

for (def child : children) {
include(child.name)
project(":${child.name}").projectDir = file("../../${child.path}")
project(":${child.name}").projectDir = file("../${child.path}")
}

62 changes: 62 additions & 0 deletions accesstransformers-only/fg7-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// TODO [MDKExamples] This Kotlin buildscript is still very experimental. I am very new to Kotlin
// I welcome suggestions with open arms.

plugins {
id("java")
id("idea")
id("eclipse")
id("maven-publish")
id("net.minecraftforge.gradle") version "[7.0.10,8.0)"
}

val minecraft_version: String by project
val forge_version: String by project
val mod_id: String by project

version = "1.0"
group = "net.minecraftforge"
base.archivesName = mod_id

java.toolchain.languageVersion = JavaLanguageVersion.of(21)

minecraft {
/*
* This is a magic helper flag, it will enable access transformers on any
* minecraft dependencies and look in all sourcesets for a file with
* the path: META-INF/accesstransformer.cfg
* It also enables some error messages when the file can not be found, to help users
* who are using the most default case.
*/
useDefaultAccessTransformer()
/* If you wish to support multiple access transformer files,
* or use the non-standard path, you can specify them directly like this.
* Note: Forge 1.20.11-61.0.10+ required for multiple/configurable files.
*/
//accessTransformers = files("src/main/resources/META-INF/accesstransformer.cfg")

mappings("official", "1.21.11")
runs {
configureEach {
workingDir.convention(layout.projectDirectory.dir("run"))
}
register("client")
}
}

repositories {
minecraft.mavenizer(this)
maven (fg.forgeMaven)
maven (fg.minecraftLibsMaven)
mavenCentral()
}

dependencies {
// This will automatically have the transformer applied because we used minecraft.accessTransformers
implementation (minecraft.dependency("net.minecraftforge:forge:$minecraft_version-$forge_version"))

annotationProcessor ("net.minecraftforge:eventbus-validator:7.0.1")
}

tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8" // Use the UTF-8 charset for Java compilation
}
15 changes: 15 additions & 0 deletions accesstransformers-only/fg7-kotlin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.configureondemand=true

org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true
org.gradle.configuration-cache.problems=warn

net.minecraftforge.gradle.merge-source-sets=true

## Environment Properties

minecraft_version=1.21.11
forge_version=61.1.1
mod_id=examplemod
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading