-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
im tired okay
- Loading branch information
Showing
2 changed files
with
122 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters