Skip to content

Commit

Permalink
🦀 i fucked your father last night
Browse files Browse the repository at this point in the history
im tired okay
  • Loading branch information
asoji committed Feb 27, 2024
1 parent ad05d87 commit 8bd8c31
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 129 deletions.
248 changes: 122 additions & 126 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,192 +1,188 @@
import org.jetbrains.dokka.DokkaVersion
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.dokka.base.DokkaBaseConfiguration
import org.jetbrains.dokka.gradle.DokkaTask
import java.net.URL


buildscript {
dependencies {
classpath("org.jetbrains.dokka:dokka-base:1.9.10")
}
dependencies {
classpath("org.jetbrains.dokka:dokka-base:1.9.10")
}
}

plugins {
kotlin("jvm") version "1.9.0"
`maven-publish`
java
kotlin("jvm") version "1.9.0"
`maven-publish`
java

alias(libs.plugins.grgit)
alias(libs.plugins.fabric.loom)
alias(libs.plugins.dokka)
alias(libs.plugins.grgit)
alias(libs.plugins.fabric.loom)
alias(libs.plugins.dokka)
}

val archivesBaseName = "${project.property("archives_base_name").toString()}"
version = getModVersion()
group = project.property("maven_group")!!

repositories {
maven { url = uri("https://maven.parchmentmc.org") }
maven { url = uri("https://mvn.devos.one/snapshots") }
maven { url = uri("https://maven.parchmentmc.org") }
maven { url = uri("https://mvn.devos.one/snapshots") }
}

//All dependencies and their versions are in ./gradle/libs.versions.toml
dependencies {

minecraft(libs.minecraft)

mappings(loom.layered {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-1.20.3:2023.12.31@zip")
})
minecraft(libs.minecraft)

//Fabric
modImplementation(libs.fabric.loader)
modImplementation(libs.fabric.api)
mappings(loom.layered {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-1.20.3:2023.12.31@zip")
})

include(modImplementation("gay.asoji:fmw:1.0.0+build.8")!!)
//Fabric
modImplementation(libs.fabric.loader)
modImplementation(libs.fabric.api)

dokkaPlugin(libs.dokka.versioning)
include(modImplementation("gay.asoji:fmw:1.0.0+build.8")!!)
}

tasks.withType<DokkaTask>().configureEach {
dokkaSourceSets {
named("main") {
moduleName.set("Inner Pastels")
moduleVersion.set(version.toString())

includes.from("Module.md")

sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(URL("http://github.com/devOS-Sanity-Edition/InnerPastels/tree/main/" + "src/main/kotlin"))
remoteLineSuffix.set("#L")
}
}
}
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
dokkaSourceSets {
named("main") {
moduleName.set("Inner Pastels")
moduleVersion.set(project.version.toString())

includes.from("Module.md")

sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(URL("http://github.com/devOS-Sanity-Edition/InnerPastels/tree/main/" + "src/main/kotlin"))
remoteLineSuffix.set("#L")
}
}
}
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
// customAssets = listOf(file("my-image.png"))
// customStyleSheets = listOf(file("my-styles.css"))
footerMessage = "(c) 2024 devOS: Sanity Edition, Team Nautical, asoji"
separateInheritedMembers = true
footerMessage = "(c) 2024 devOS: Sanity Edition, Team Nautical, asoji"
separateInheritedMembers = true

// templatesDir = file("dokka/templates")
mergeImplicitExpectActualDeclarations = true
}
mergeImplicitExpectActualDeclarations = true
}
}

// Write the version to the fabric.mod.json
tasks.processResources {
inputs.property("version", project.version)
inputs.property("version", project.version)

filesMatching("fabric.mod.json") {
expand(mutableMapOf("version" to project.version))
}
filesMatching("fabric.mod.json") {
expand(mutableMapOf("version" to project.version))
}
}

tasks.withType<JavaCompile>().configureEach {
options.release.set(17)
options.release.set(17)
}

java {
withSourcesJar()
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

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

// This will attempt to publish the mod to the devOS Maven, otherwise it will build the mod locally
// This is auto run by GitHub Actions
task("buildOrPublish") {
group = "build"
var mavenUser = System.getenv().get("MAVEN_USER")
if (!mavenUser.isNullOrEmpty()) {
dependsOn(tasks.getByName("publish"))
println("prepared for publish")
} else {
dependsOn(tasks.getByName("build"))
println("prepared for build")
}
group = "build"
var mavenUser = System.getenv().get("MAVEN_USER")
if (!mavenUser.isNullOrEmpty()) {
dependsOn(tasks.getByName("publish"))
println("prepared for publish")
} else {
dependsOn(tasks.getByName("build"))
println("prepared for build")
}
}

// TODO: Uncomment for a non template mod!
publishing {
publications {
create<MavenPublication>("mavenJava") {
groupId = project.property("maven_group").toString()
artifactId = project.property("archives_base_name").toString()
version = getModVersion()

from(components.get("java"))
}
}

repositories {
maven {
url = uri("https://mvn.devos.one/${System.getenv()["PUBLISH_SUFFIX"]}/")
credentials {
username = System.getenv()["MAVEN_USER"]
password = System.getenv()["MAVEN_PASS"]
}
}
}
publications {
create<MavenPublication>("mavenJava") {
groupId = project.property("maven_group").toString()
artifactId = project.property("archives_base_name").toString()
version = getModVersion()

from(components.get("java"))
}
}

repositories {
maven {
url = uri("https://mvn.devos.one/${System.getenv()["PUBLISH_SUFFIX"]}/")
credentials {
username = System.getenv()["MAVEN_USER"]
password = System.getenv()["MAVEN_PASS"]
}
}
}
}

loom {
runs {
create("datagen") {
client()
name("Data Generation")
vmArgs(
"-Dfabric-api.datagen",
"-Dfabric-api.datagen.output-dir=${file("src/main/generated")}",
"-Dfabric-api.datagen.modid=${project.extra["archives_base_name"] as String}"
)
runDir("build/datagen")
}
}
runs {
create("datagen") {
client()
name("Data Generation")
vmArgs(
"-Dfabric-api.datagen",
"-Dfabric-api.datagen.output-dir=${file("src/main/generated")}",
"-Dfabric-api.datagen.modid=${project.extra["archives_base_name"] as String}"
)
runDir("build/datagen")
}
}
}

sourceSets {
main {
resources {
srcDirs("src/main/generated")
exclude("src/main/generated/.cache")
}
}
main {
resources {
srcDirs("src/main/generated")
exclude("src/main/generated/.cache")
}
}
}

fun getModVersion(): String {
val modVersion = project.property("mod_version")
val buildId = System.getenv("GITHUB_RUN_NUMBER")

// CI builds only
if (buildId != null) {
return "${modVersion}+build.${buildId}"
}

// If a git repo can't be found, grgit won't work, this non-null check exists so you don't run grgit stuff without a git repo
if (grgit != null) {
val head = grgit.head()
var id = head.abbreviatedId

// Flag the build if the build tree is not clean
// (aka you have uncommitted changes)
if (!grgit.status().isClean()) {
id += "-dirty"
}

// ex: 1.0.0+rev.91949fa or 1.0.0+rev.91949fa-dirty
return "${modVersion}+rev.${id}"
}

// No tracking information could be found about the build
return "${modVersion}+unknown"
val modVersion = project.property("mod_version")
val buildId = System.getenv("GITHUB_RUN_NUMBER")

// CI builds only
if (buildId != null) {
return "${modVersion}+build.${buildId}"
}

// If a git repo can't be found, grgit won't work, this non-null check exists so you don't run grgit stuff without a git repo
if (grgit != null) {
val head = grgit.head()
var id = head.abbreviatedId

// Flag the build if the build tree is not clean
// (aka you have uncommitted changes)
if (!grgit.status().isClean()) {
id += "-dirty"
}

// ex: 1.0.0+rev.91949fa or 1.0.0+rev.91949fa-dirty
return "${modVersion}+rev.${id}"
}

// No tracking information could be found about the build
return "${modVersion}+unknown"

}
3 changes: 0 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric-l
fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric-api" }
fabric_language_kotlin = { module = "net.fabricmc:fabric-language-kotlin", version.ref = "fabric_language_kotlin" }

dokka_as_java = { module = "org.jetbrains.dokka:kotlin-as-java-plugin", version.ref = "dokka" }
dokka_versioning = { module = "org.jetbrains.dokka:versioning-plugin", version.ref = "dokka" }

[plugins]
grgit = { id = "org.ajoberstar.grgit", version = "5.2.1"}
fabric_loom = { id = "fabric-loom", version = "1.5-SNAPSHOT" }
Expand Down

0 comments on commit 8bd8c31

Please sign in to comment.