Skip to content

Commit

Permalink
Switch to Kotlin Build Scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexNijjar committed Jul 10, 2023
1 parent 067b604 commit 52c0bc3
Show file tree
Hide file tree
Showing 1,023 changed files with 801 additions and 1,151 deletions.
209 changes: 0 additions & 209 deletions build.gradle

This file was deleted.

152 changes: 152 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import dev.architectury.plugin.ArchitectPluginExtension
import groovy.json.StringEscapeUtils
import net.fabricmc.loom.api.LoomGradleExtensionAPI
import net.fabricmc.loom.task.RemapJarTask

plugins {
java
id("maven-publish")
id("com.teamresourceful.resourcefulgradle") version "0.0.+"
id("dev.architectury.loom") version "1.2-SNAPSHOT" apply false
id("architectury-plugin") version "3.4-SNAPSHOT"
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
}

architectury {
val minecraftVersion: String by project
minecraft = minecraftVersion
}

subprojects {
apply(plugin = "maven-publish")
apply(plugin = "dev.architectury.loom")
apply(plugin = "architectury-plugin")
apply(plugin = "com.github.johnrengelman.shadow")

val minecraftVersion: String by project
val modLoader = project.name
val modId = rootProject.name
val isCommon = modLoader == rootProject.projects.common.name

base {
archivesName.set("$modId-$modLoader-$minecraftVersion")
}

configure<LoomGradleExtensionAPI> {
silentMojangMappingsLicense()
}

repositories {
maven(url = "https://maven.architectury.dev/")
maven(url = "https://maven.minecraftforge.net/")
maven(url = "https://maven.resourcefulbees.com/repository/maven-public/")
}

dependencies {
val resourcefulLibVersion: String by project

"minecraft"("::$minecraftVersion")

@Suppress("UnstableApiUsage")
"mappings"(project.the<LoomGradleExtensionAPI>().layered {
val parchmentVersion: String by project

officialMojangMappings()

parchment(create(group = "org.parchmentmc.data", name = "parchment-$minecraftVersion", version = parchmentVersion))
})

compileOnly(group = "com.teamresourceful", name = "yabn", version = "1.0.3")
"modApi"(group = "com.teamresourceful.resourcefullib", name = "resourcefullib-$modLoader-$minecraftVersion", version = resourcefulLibVersion)
}

java {
withSourcesJar()
}

tasks.jar {
archiveClassifier.set("dev")
}

tasks.named<RemapJarTask>("remapJar") {
archiveClassifier.set(null as String?)
}

if (!isCommon) {
configure<ArchitectPluginExtension> {
platformSetupLoomIde()
}

val shadowCommon by configurations.creating {
isCanBeConsumed = false
isCanBeResolved = true
}

tasks {
"shadowJar"(ShadowJar::class) {
archiveClassifier.set("dev-shadow")
configurations = listOf(shadowCommon)
}

"remapJar"(RemapJarTask::class) {
dependsOn("shadowJar")
inputFile.set(named<ShadowJar>("shadowJar").flatMap { it.archiveFile })
}
}
} else {
sourceSets.main.get().resources.srcDir("src/main/generated/resources")
}

publishing {
publications {
create<MavenPublication>("maven") {
artifactId = "$modId-$modLoader-$minecraftVersion"
from(components["java"])

pom {
name.set("Handcrafted $modLoader")
url.set("https://github.com/terrarium-earth/$modId")

scm {
connection.set("git:https://github.com/terrarium-earth/$modId.git")
developerConnection.set("git:https://github.com/terrarium-earth/$modId.git")
url.set("https://github.com/terrarium-earth/$modId")
}

licenses {
license {
name.set("MIT")
}
}
}
}
}
repositories {
maven {
setUrl("https://maven.resourcefulbees.com/repository/terrarium/")
credentials {
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_PASS")
}
}
}
}
}

resourcefulGradle {
templates {
register("embed") {
val minecraftVersion: String by project
val version: String by project
val changelog: String = file("changelog.md").readText(Charsets.UTF_8)

source.set(file("templates/embed.json.template"))
injectedValues.set(mapOf(
"minecraft" to minecraftVersion,
"version" to version,
"changelog" to StringEscapeUtils.escapeJava(changelog),
))
}
}
}
Empty file added changelog.md
Empty file.
2 changes: 0 additions & 2 deletions changelog.txt

This file was deleted.

20 changes: 0 additions & 20 deletions common/build.gradle

This file was deleted.

8 changes: 8 additions & 0 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
architectury {
val enabledPlatforms: String by rootProject
common(enabledPlatforms.split(","))
}

dependencies {
modCompileOnly(group = "tech.thatgravyboat", name = "commonats", version = "1.0")
}
Loading

0 comments on commit 52c0bc3

Please sign in to comment.