Skip to content

Commit

Permalink
🐘 moment #3
Browse files Browse the repository at this point in the history
  • Loading branch information
robotgryphon committed Dec 14, 2024
1 parent b11acbf commit df32d54
Showing 1 changed file with 90 additions and 2 deletions.
92 changes: 90 additions & 2 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,110 @@
import dev.compactmachines.GanderConstants
import gradle.kotlin.dsl.accessors._53f21c2e2286c58eadab8fd2d7f5601a.*
import java.text.SimpleDateFormat
import java.util.*

var envVersion: String = System.getenv("VERSION") ?: "9.9.9"
if (envVersion.startsWith("v"))
envVersion = envVersion.trimStart('v')

plugins {
java
id("java-library")
id("idea")
id("org.jetbrains.gradle.plugin.idea-ext")
id("net.neoforged.moddev.legacyforge")
id("maven-publish")
id("gander-convention")
}

base {
archivesName = project.name
group = "dev.compactmods.gander"
version = envVersion

libsDirectory = rootProject.layout.projectDirectory.dir("libs/${project.name}")
}

idea.module {
if (!GanderConstants.IS_CI) {
isDownloadSources = true
isDownloadJavadoc = true
}

excludeDirs.addAll(
files(
".gradle",
"build",
"run"
)
)
}

java {
toolchain.vendor.set(JvmVendorSpec.JETBRAINS)
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

neoForge {
version = GanderConstants.FORGE_VERSION
// not currently usable since the AT included in legacy forge
// does not itself validate, many unused/nonexistent AT entries exist in it
// validateAccessTransformers.convention(true)

parchment {
minecraftVersion = GanderConstants.PARCHMENT_VERSION
mappingsVersion = GanderConstants.PARCHMENT_MAPPINGS
}

// apply this modules AT file if it exists
// also mark for publishing with maven publication
val atFile = file("src/main/resources/META-INF/accesstransformer.cfg")

if (atFile.exists()) {
accessTransformers {
from(atFile)
publish(atFile)
}
}
}

tasks.jar {

val gitVersion = providers.exec {
commandLine("git", "rev-parse", "HEAD")
}.standardOutput.asText.get()

manifest {
from(file("src/main/resources/META-INF/MANIFEST.MF"))

val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date())
attributes(
mapOf(
"Main-Commit" to gitVersion
)
)
}
}

dependencies {
// not included with MDG currently
// does not affect runtime or production
// safe to have at compile time with no issues
compileOnly("org.jetbrains:annotations:26.0.1")
annotationProcessor("org.spongepowered:mixin:0.8.5:processor")
}

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"

if (!GanderConstants.IS_CI) {
options.compilerArgs.addAll(arrayOf("-Xmaxerrs", "9000"))
}
}


val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/gander"
publishing {
publications.register<MavenPublication>(project.name) {
artifactId = "core"
version = envVersion
from(components.getByName("java"))
}
Expand Down

0 comments on commit df32d54

Please sign in to comment.