Skip to content

Commit

Permalink
script's and more
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Mar 31, 2024
1 parent 2d82d08 commit e5398b8
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 88 deletions.
78 changes: 0 additions & 78 deletions build.gradle

This file was deleted.

82 changes: 82 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import net.fabricmc.loom.api.LoomGradleExtensionAPI

plugins {
id("fabric-loom") version "1.5.+"
}

version = "mod_version"()
group = "maven_group"()
base.archivesName.set("archives_base_name"())

repositories {
maven("https://maven.quiltmc.org/repository/release") // Quilt Mappings
maven("https://maven.parchmentmc.org") // Parchment mappings
maven("https://api.modrinth.com/maven") // Create Deco
maven("https://mvn.devos.one/snapshots/") // Create, Porting Lib, Forge Tags, Milk Lib, Registrate
maven("https://mvn.devos.one/releases/") // Porting Lib Releases
maven("https://raw.githubusercontent.com/Fuzss/modresources/main/maven/") // Forge Config API Port
maven("https://maven.jamieswhiteshirt.com/libs-release") // Reach Entity Attributes
maven("https://jitpack.io/") // Fabric ASM
maven("https://maven.tterrag.com/") // Flywheel
}

dependencies {
"minecraft"("com.mojang:minecraft:${"minecraft_version"()}")

val loom = project.extensions.getByType<LoomGradleExtensionAPI>()
mappings(loom.layered {
mappings("org.quiltmc:quilt-mappings:${"minecraft_version"()}+build.${"qm_version"()}:intermediary-v2")
parchment("org.parchmentmc.data:parchment-${"minecraft_version"()}:${"parchment_version"()}@zip")
officialMojangMappings { nameSyntheticMembers = false }
})

modImplementation("net.fabricmc:fabric-loader:${"fabric_loader_version"()}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${"fabric_api_version"()}")

modImplementation("com.simibubi.create:create-fabric-${"minecraft_version"()}:${"create_version"()}")

modImplementation("maven.modrinth:create-deco:2.0.1-1.20.1-fabric")
}

tasks.processResources {
// set up properties for filling into metadata
val properties = mapOf(
"version" to version,
"fabric_loader_version" to "fabric_loader_version"(),
"fabric_api_version" to "fabric_api_version"(),
"minecraft_version" to "minecraft_version"(),
)

inputs.properties(properties)

filesMatching("fabric.mod.json") {
expand(properties)
}
}

val targetJavaVersion = 17
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release.set(targetJavaVersion)
}
}

java {
val javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
withSourcesJar()
}

tasks.jar {
from("LICENSE") {
rename { "${it}_${base.archivesName}"}
}
}

operator fun String.invoke(): String {
return rootProject.ext[this] as? String
?: throw IllegalStateException("Property $this is not defined")
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
org.gradle.jvmargs=-Xmx2G

# Mod Properties
mod_version = 0.0.1
mod_version = 0.0.2
maven_group = dev.ithundxr
archives_base_name = RailwaysTweaks

Expand Down
7 changes: 7 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

version=$(grep 'mod_version = ' "./gradle.properties" | cut -d'=' -f2 | tr -d ' ')

git tag -s -a v"$version" -m "$1"

git push origin v"$version"
9 changes: 0 additions & 9 deletions settings.gradle

This file was deleted.

6 changes: 6 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pluginManagement {
repositories {
maven("https://maven.fabricmc.net/")
gradlePluginPortal()
}
}

0 comments on commit e5398b8

Please sign in to comment.