diff options
author | HackedOS <gmachina42@gmail.com> | 2022-08-04 12:35:07 +0530 |
---|---|---|
committer | HackedOS <gmachina42@gmail.com> | 2022-08-04 12:35:07 +0530 |
commit | 17331cc7a71020d7a815bf2f31c65418a48cc7e3 (patch) | |
tree | 85d14f8fb8448a6dba5556efbffda2cc4193e664 | |
parent | ed4141ca9116798326856984c40fe355d27d7281 (diff) | |
download | COFL-17331cc7a71020d7a815bf2f31c65418a48cc7e3.tar.gz COFL-17331cc7a71020d7a815bf2f31c65418a48cc7e3.tar.bz2 COFL-17331cc7a71020d7a815bf2f31c65418a48cc7e3.zip |
Fix Gradle for the final time I hope
-rw-r--r-- | build.gradle | 107 | ||||
-rw-r--r-- | build.gradle.kts | 94 | ||||
-rw-r--r-- | gradle.properties | 2 | ||||
-rw-r--r-- | gradle/wrapper/gradle-wrapper.properties | 5 | ||||
-rw-r--r-- | settings.gradle.kts | 21 |
5 files changed, 119 insertions, 110 deletions
diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 4d0ab5c..0000000 --- a/build.gradle +++ /dev/null @@ -1,107 +0,0 @@ - -// For those who want the bleeding edge -buildscript { - repositories { - maven { - name = "jitpack" - url = "https://jitpack.io/" - } - mavenCentral() - maven { url = "https://maven.minecraftforge.net/" } - maven { url = "https://repo.spongepowered.org/maven" } - } - dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0' - classpath 'com.github.asbyth:ForgeGradle:6f53277' - } -} -apply plugin: 'java' -apply plugin: 'com.github.johnrengelman.shadow' -apply plugin: 'net.minecraftforge.gradle.forge' - - -version = "1.0" -group= "de.torui.coflmod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = "CoflMod" - -minecraft { - version = "1.8.9-11.15.1.2318-1.8.9" - runDir = "run" - - // the mappings can be changed at any time, and must be in the following format. - // snapshot_YYYYMMDD snapshot are built nightly. - // stable_# stables are built at the discretion of the MCP team. - // Use non-default mappings at your own risk. they may not allways work. - // simply re-run your setup task after changing the mappings to update your workspace. - mappings = "stable_22" - //makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. -} - -configurations { - shade - compile.extendsFrom(shade) -} -dependencies { - // you may put jars on which you depend on in ./libs - // or you may define them like so.. - //compile "some.group:artifact:version:classifier" - //compile "some.group:artifact:version" - - // real examples - //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env - //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env - - // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. - //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, - // except that these dependencies get remapped to your current MCP mappings - //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' - //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // for more info... - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html - //inJar 'javax.websocket:javax.websocket-api:1.1' - - shade 'com.neovisionaries:nv-websocket-client:2.14' - //compile 'com.neovisionaries:nv-websocket-client:2.14' - //shade 'org.java-websocket:Java-WebSocket:1.5.2' - //shade fileTree(dir: '.', include: ['Java-WebSocket-1.5.3-SNAPSHOT.jar']) - //shade fileTree(dir: '.', include: ['nv-websocket-client-2.14.jar']) -} - -sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. -compileJava { - sourceCompatibility = targetCompatibility = '1.8' -} - -processResources -{ - // this will ensure that this task is redone when the versions change. - inputs.property " version", project.version - inputs.property "mcversion", project.minecraft.version - - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version - } - - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } -} - - - -shadowJar { - version = 1.0 - configurations = [project.configurations.shade] -} - -reobf { shadowJar { mappingType = "SEARGE" } } -tasks.reobfJar.dependsOn(shadowJar) diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..f937706 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,94 @@ +plugins { + idea + java + id("gg.essential.loom") version "0.10.0.+" + id("dev.architectury.architectury-pack200") version "0.1.3" + id("com.github.johnrengelman.shadow") version "7.1.2" +} + +group = "de.torui.coflmod" +version = "1.0.0" + +// Toolchains: +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(8)) +} + +// Minecraft configuration: +loom { + launchConfigs { + "client" { + } + } + forge { + pack200Provider.set(dev.architectury.pack200.java.Pack200Adapter()) + } +} + +sourceSets.main { + output.setResourcesDir(file("$buildDir/classes/kotlin/main")) +} + +// Dependencies: + +repositories { + mavenCentral() + maven("https://repo.spongepowered.org/maven/") + // If you don't want to log in with your real minecraft account, remove this line + maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1") +} + +val shadowImpl by configurations.creating { + configurations.implementation.get().extendsFrom(this) +} + +dependencies { + minecraft("com.mojang:minecraft:1.8.9") + mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9") + forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9") + + annotationProcessor("org.spongepowered:mixin:0.8.4-SNAPSHOT") + + shadowImpl("com.neovisionaries:nv-websocket-client:2.14") + + // If you don't want to log in with your real minecraft account, remove this line + modRuntimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.0") + +} + +// Tasks: + +tasks.withType(JavaCompile::class) { + options.encoding = "UTF-8" +} + +tasks.withType(Jar::class) { + archiveBaseName.set("examplemod") + manifest.attributes.run { + this["FMLCorePluginContainsFMLMod"] = "true" + this["ForceLoadAsMod"] = "true" + } +} + + +val remapJar by tasks.named<net.fabricmc.loom.task.RemapJarTask>("remapJar") { + archiveClassifier.set("all") + from(tasks.shadowJar) + input.set(tasks.shadowJar.get().archiveFile) +} + +tasks.shadowJar { + archiveClassifier.set("all-dev") + configurations = listOf(shadowImpl) + doLast { + configurations.forEach { + println("Config: ${it.files}") + } + } + + // If you want to include other dependencies and shadow them, you can relocate them in here + fun relocate(name: String) = relocate(name, "com.examplemod.deps.$name") +} + +tasks.assemble.get().dependsOn(tasks.remapJar) + diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..0655747 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +loom.platform=forge +org.gradle.jvmargs=-Xmx2g
\ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2d6929c..7c08e4f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Sat May 07 09:37:43 IST 2022 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +zipStorePath=wrapper/dists
\ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..4448199 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,21 @@ +pluginManagement { + repositories { + mavenCentral() + gradlePluginPortal() + maven("https://oss.sonatype.org/content/repositories/snapshots") + maven("https://maven.architectury.dev/") + maven("https://maven.fabricmc.net") + maven("https://maven.minecraftforge.net/") + maven("https://repo.spongepowered.org/maven/") + maven("https://repo.sk1er.club/repository/maven-releases/") + } + resolutionStrategy { + eachPlugin { + when (requested.id.id) { + "gg.essential.loom" -> useModule("gg.essential:architectury-loom:${requested.version}") + } + } + } +} + +rootProject.name = "CoflMod"
\ No newline at end of file |