-
-
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.
- Loading branch information
1 parent
2edbbc4
commit eb4d3ed
Showing
46 changed files
with
923 additions
and
429 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
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
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
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,136 +1,32 @@ | ||
import org.jetbrains.changelog.Changelog | ||
import com.diffplug.gradle.spotless.SpotlessExtension | ||
import org.jetbrains.changelog.ChangelogPluginConstants.SEM_VER_REGEX | ||
import org.jetbrains.changelog.date | ||
import org.jetbrains.dokka.base.DokkaBase | ||
import org.jetbrains.dokka.base.DokkaBaseConfiguration | ||
import org.jetbrains.dokka.versioning.VersioningConfiguration | ||
import org.jetbrains.dokka.versioning.VersioningPlugin | ||
|
||
plugins { | ||
alias(libs.plugins.kotlin) | ||
alias(libs.plugins.loom) | ||
alias(libs.plugins.kotlin.serialization) | ||
alias(libs.plugins.spotless) | ||
alias(libs.plugins.kotlin) apply false | ||
alias(libs.plugins.loom) apply false | ||
alias(libs.plugins.kotlin.serialization) apply false | ||
alias(libs.plugins.spotless) apply false | ||
alias(libs.plugins.changelog) | ||
alias(libs.plugins.dokka) | ||
alias(libs.plugins.dokka) apply false | ||
alias(libs.plugins.dokka.javadoc) apply false | ||
alias(libs.plugins.minotaur) | ||
alias(libs.plugins.kotlinx.kover) | ||
|
||
`maven-publish` | ||
} | ||
|
||
buildscript { | ||
dependencies { | ||
classpath(libs.dokka.pluginBase) | ||
classpath(libs.dokka.pluginVersioning) | ||
} | ||
alias(libs.plugins.loader.common) apply false | ||
alias(libs.plugins.loader.dokka) apply false | ||
alias(libs.plugins.loader.runtime) apply false | ||
} | ||
|
||
group = "dev.wanderia" | ||
|
||
version = "1.2.0" | ||
version = "1.3.0" | ||
|
||
repositories { mavenCentral() } | ||
|
||
dependencies { | ||
minecraft(libs.minecraft) | ||
mappings(loom.officialMojangMappings()) | ||
modImplementation(libs.fabric.kotlin) | ||
modImplementation(libs.fabric.loader) | ||
modImplementation(fabricApi.module("fabric-networking-api-v1", libs.versions.fabricApi.get())) | ||
implementation(libs.kotlinx.serializationCore) | ||
|
||
testImplementation(libs.kotlin.test) | ||
testImplementation(libs.kotlin.test.junit5) | ||
testImplementation(libs.junit.params) | ||
} | ||
|
||
tasks { | ||
processResources { | ||
inputs.property("version", project.version) | ||
filesMatching("fabric.mod.json") { expand(mutableMapOf("version" to project.version)) } | ||
} | ||
|
||
dokkaHtml { | ||
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> { | ||
customAssets = listOf(file("artSrc/logo-icon.svg")) | ||
footerMessage = "(c) 2024 Wanderia" | ||
} | ||
|
||
val docsVersionDir = projectDir.resolve("docs/version") | ||
val docsVersion = project.version.toString() | ||
val currentDocsDir = docsVersionDir.resolve(docsVersion) | ||
outputDirectory = currentDocsDir | ||
|
||
pluginConfiguration<VersioningPlugin, VersioningConfiguration> { | ||
version = docsVersion | ||
olderVersionsDir = docsVersionDir | ||
} | ||
|
||
doLast { | ||
currentDocsDir.copyRecursively(file("docs-publishing/"), overwrite = true) | ||
currentDocsDir.resolve("older").deleteRecursively() | ||
} | ||
} | ||
|
||
val dokkaJar by | ||
registering(Jar::class) { | ||
from(dokkaHtml) | ||
dependsOn(dokkaHtml) | ||
archiveClassifier = "javadoc" | ||
} | ||
|
||
jar { from("LICENSE") { rename { "${it}_${project.base.archivesName.get()}" } } } | ||
|
||
test { useJUnitPlatform() } | ||
} | ||
|
||
val enableDCEVM: Boolean = | ||
if (System.getProperty("java.vendor") == "JetBrains s.r.o.") { | ||
println("JetBrains Runtime found, enabling Enhanced Class Redefinition (DCEVM)") | ||
true | ||
} else { | ||
false | ||
} | ||
|
||
val testmod: SourceSet by | ||
sourceSets.creating { | ||
compileClasspath += sourceSets.main.get().compileClasspath | ||
compileClasspath += sourceSets.main.get().output | ||
runtimeClasspath += sourceSets.main.get().runtimeClasspath | ||
runtimeClasspath += sourceSets.main.get().output | ||
} | ||
|
||
loom { | ||
runtimeOnlyLog4j = true | ||
runs { | ||
configureEach { | ||
if (enableDCEVM) { | ||
vmArgs("-XX:+AllowEnhancedClassRedefinition") | ||
} | ||
property("dev.wanderia.netlib.debug", "true") | ||
ideConfigGenerated(name.contains("testmod")) | ||
runDir("runs/$name") | ||
} | ||
|
||
create("testmodClient") { | ||
client() | ||
name = "Testmod Client" | ||
source(testmod) | ||
} | ||
|
||
create("testmodServer") { | ||
server() | ||
name = "Testmod Server" | ||
source(testmod) | ||
} | ||
} | ||
|
||
mods { | ||
create("wanderia-netlib") { sourceSet(sourceSets.main.get()) } | ||
|
||
create("testmod") { sourceSet(testmod) } | ||
} | ||
kover(projects.mod.common) | ||
kover(projects.mod.fabric) | ||
kover(projects.mod.neoforge) | ||
} | ||
|
||
changelog { | ||
|
@@ -146,103 +42,41 @@ changelog { | |
combinePreReleases = true | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(21) | ||
explicitApi() | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
targetCompatibility = JavaVersion.VERSION_21 | ||
sourceCompatibility = JavaVersion.VERSION_21 | ||
} | ||
|
||
modrinth { | ||
token = System.getenv("MODRINTH_TOKEN") | ||
debugMode = System.getenv("MODRINTH_DEBUG") == "1" | ||
projectId = "netlib" | ||
versionNumber = project.version.toString() | ||
versionType = | ||
with(project.version.toString()) { | ||
when { | ||
contains("alpha") -> "alpha" | ||
contains("beta") -> "beta" | ||
else -> "release" | ||
} | ||
} | ||
uploadFile.set(tasks.remapJar) | ||
additionalFiles.set(listOf(tasks.remapSourcesJar)) | ||
gameVersions = listOf(libs.versions.minecraft.get()) | ||
dependencies { | ||
required.project("fabric-api") | ||
required.project("fabric-language-kotlin") | ||
} | ||
changelog = | ||
rootProject.changelog.renderItem( | ||
rootProject.changelog.getUnreleased().withEmptySections(false).withHeader(false), | ||
Changelog.OutputType.MARKDOWN, | ||
) | ||
syncBodyFrom = rootProject.file("README.md").readText() | ||
} | ||
|
||
spotless { | ||
kotlin { | ||
ktfmt().kotlinlangStyle() | ||
licenseHeaderFile("$projectDir/HEADER") | ||
} | ||
kotlinGradle { ktfmt().kotlinlangStyle() } | ||
java { | ||
googleJavaFormat() | ||
licenseHeaderFile("$projectDir/HEADER") | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("maven") { | ||
pom { | ||
name = "netlib" | ||
description = "netlib $version - Kotlinx Serialization for custom payloads." | ||
url = "https://github.com/wanderia/netlib" | ||
licenses { | ||
license { | ||
name = "Mozilla Public License v2.0" | ||
url = "https://www.mozilla.org/en-US/MPL/2.0/" | ||
} | ||
} | ||
developers { | ||
developer { | ||
name = "Pyrrha Wills" | ||
id = "JustPyrrha" | ||
email = "[email protected]" | ||
} | ||
} | ||
scm { | ||
connection = "scm:git:git://github.com/wanderia/netlib.git" | ||
developerConnection = "scm:git:ssh://github.com:wanderia/netlib.git" | ||
url = "https://github.com/wanderia/netlib/tree/main" | ||
} | ||
subprojects { | ||
if (!project.name.endsWith("mod") && project.name != "docs") { | ||
apply(plugin = "com.diffplug.spotless") | ||
extensions.configure<SpotlessExtension> { | ||
kotlin { | ||
ktfmt().kotlinlangStyle() | ||
licenseHeaderFile("${rootProject.projectDir}/HEADER") | ||
} | ||
kotlinGradle { ktfmt().kotlinlangStyle() } | ||
java { | ||
googleJavaFormat() | ||
licenseHeaderFile("${rootProject.projectDir}/HEADER") | ||
} | ||
artifact(tasks.remapJar) | ||
artifact(tasks.remapSourcesJar) | ||
artifact(tasks["dokkaJar"]) | ||
} | ||
} | ||
|
||
repositories { | ||
val repositoryUrl = | ||
with(project.version.toString()) { | ||
when { | ||
contains("alpha") || contains("beta") -> "s3://maven.wanderia.dev/snapshots" | ||
else -> "s3://maven.wanderia.dev/releases" | ||
} | ||
} | ||
group = rootProject.group | ||
version = rootProject.version | ||
} | ||
|
||
maven(repositoryUrl) { | ||
credentials(AwsCredentials::class) { | ||
accessKey = System.getenv("AWS_ACCESS_KEY_ID") | ||
secretKey = System.getenv("AWS_SECRET_ACCESS_KEY") | ||
} | ||
} | ||
tasks { | ||
val copySubJars by registering(Copy::class) { | ||
dependsOn( | ||
":mod:common:build", | ||
":mod:fabric:build", | ||
":mod:neoforge:build", | ||
":docs:dokkaHtmlJar" | ||
) | ||
from(rootProject.subprojects.map { it.layout.buildDirectory.file("libs/").get().asFile }) | ||
into(rootProject.layout.buildDirectory.dir("libs")) | ||
} | ||
} |
Oops, something went wrong.