Skip to content

Commit

Permalink
update: gradle files + fabric.mod.json
Browse files Browse the repository at this point in the history
  • Loading branch information
sakurawald committed Jul 24, 2024
1 parent 28cc8ff commit 8365f2f
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 55 deletions.
85 changes: 47 additions & 38 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
/* gradle env */
plugins {
id 'fabric-loom' version '1.6.+'
id 'maven-publish'
id "com.modrinth.minotaur" version "2.+"
}

version = project.mod_version
group = project.maven_group

base {
archivesName = project.archives_base_name
id 'java'
id 'idea'
}

repositories {
Expand All @@ -21,6 +17,15 @@ repositories {
maven { url 'https://projectlombok.org/edge-releases' }
}

/* project props */
version = project.mod_version
group = project.maven_group

base {
archivesName = project.archives_base_name
}

/* fabric env */
loom {
// fix: adventure mod error in runServer()
// splitEnvironmentSourceSets()
Expand All @@ -42,52 +47,44 @@ loom {

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings_version}"
modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"

compileOnly "org.projectlombok:lombok:${project.lombok_version}"
annotationProcessor "org.projectlombok:lombok:${project.lombok_version}"
testCompileOnly "org.projectlombok:lombok:${project.lombok_version}"
testAnnotationProcessor "org.projectlombok:lombok:${project.lombok_version}"

implementation group: 'com.google.code.gson', name: 'gson', version: "${project.gson_version}"
implementation "com.google.code.gson:gson:${project.gson_version}"

modImplementation("carpet:fabric-carpet:${project.carpet_core_version}")

include(implementation 'net.luckperms:api:5.4')
include(implementation "net.luckperms:api:${project.luckperms_api_version}")

modImplementation include("net.kyori:adventure-platform-fabric:${project.adventure_platform_fabric_version}")
include(modImplementation("net.kyori:adventure-platform-fabric:${project.adventure_platform_fabric_version}"))
include(implementation "net.kyori:adventure-text-minimessage:${project.adventure_api_version}")

modImplementation include("eu.pb4:sgui:${project.sgui_version}")
include(modImplementation("eu.pb4:sgui:${project.sgui_version}"))
include(modImplementation("eu.pb4:placeholder-api:${project.placeholder_api_version}"))

implementation "me.lucko:spark-api:${project.spark_version}"
implementation "me.lucko:spark-api:${project.spark_api_version}"

include(implementation "org.apache.commons:commons-compress:${project.apache_commons_compression_version}")
include(implementation 'org.apache.commons:commons-rng-simple:1.6')
include(implementation "commons-io:commons-io:${project.apache_commons_io_version}")

include(implementation "org.quartz-scheduler:quartz:${project.quartz_version}")

include(implementation "org.reflections:reflections:${project.reflections_version}")
include(implementation "org.javassist:javassist:${project.javaassist_version}")

// implementation("com.google.guava:guava:33.2.1-jre")

testImplementation(platform('org.junit:junit-bom:5.10.2'))
testImplementation('org.junit.jupiter:junit-jupiter')
testRuntimeOnly('org.junit.platform:junit-platform-launcher')

modImplementation(include("eu.pb4:placeholder-api:${project.placeholder_api_version}"))
}

processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
testImplementation(platform("org.junit:junit-bom:${project.junit_version}"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

/* compile */
tasks.withType(JavaCompile).configureEach {
it.options.release.set(21)
}
Expand All @@ -101,12 +98,21 @@ java {
targetCompatibility = JavaVersion.VERSION_21
}

/* build */
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}

jar {
from("LICENSE") {
rename { "${it}-mc${minecraft_version}-${project.base.archivesName.get()}" }
}
}

/* publish */
publishing {
publications {
mavenJava(MavenPublication) {
Expand All @@ -115,15 +121,9 @@ publishing {
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
repositories {}
}

// modrinth
modrinth {
token = "$System.env.MODRINTH_TOKEN"
projectId = "1TowMm2v"
Expand All @@ -142,13 +142,13 @@ modrinth {
}
tasks.modrinth.dependsOn(tasks.modrinthSyncBody)

// test framework
/* test framework */
test {
useJUnitPlatform()
filter {
}
filter {}
}

/* docs generator is used to generate the `configuration files` docs. */
tasks.register('generateDocs') {
outputs.upToDateWhen { false }
test {
Expand All @@ -159,6 +159,7 @@ tasks.register('generateDocs') {
}
tasks.modrinthSyncBody.dependsOn(generateDocs)

/* mixin Registry checker is used to check the un-registered mixins, to avoid un-expected circumstance. */
tasks.register('checkMixinRegistryTest') {
outputs.upToDateWhen { false }
test {
Expand All @@ -169,6 +170,14 @@ tasks.register('checkMixinRegistryTest') {
}
tasks.compileJava.dependsOn(checkMixinRegistryTest)

/* module dependency checker is used to check whether a `module` reference another `module` directly or in-directly.
*
* Our design objective is that: a module should be standalone, and should no reference other modules.
* If two modules share the same code or the logic, then:
* 1. They should be re-organized as sub-module relation.
* 2. Or just extract the common codes into the `common` package.
*
* */
tasks.register('checkModuleDependencyTest') {
outputs.upToDateWhen { false }
test {
Expand Down
2 changes: 1 addition & 1 deletion fuji-fabric.wiki
20 changes: 11 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
org.gradle.jvmargs=-Xmx8G
org.gradle.parallel=true

# mod properties
# mod props
mod_version=1.3.2
maven_group=io.github.sakurawald
archives_base_name=fuji

# fabric deps
minecraft_version=1.21
loader_version=0.15.11
yarn_mappings=1.21+build.2
fabric_loader_version=0.15.11
yarn_mappings_version=1.21+build.2

# mod deps
fabric_api_version=0.100.1+1.21
Expand All @@ -19,13 +19,15 @@ sgui_version=1.6.0+1.21
adventure_api_version=4.17.0
adventure_platform_fabric_version=5.14.0
placeholder_api_version=2.4.1+1.21
spark_api_version=0.1-SNAPSHOT
luckperms_api_version=5.4

# common deps
spark_version=0.1-SNAPSHOT
apache_commons_compression_version=1.26.2
apache_commons_io_version=2.14.0
gson_version=2.10.1
lombok_version=1.18.30
quartz_version=2.5.0-rc1
reflections_version=0.10.2
javaassist_version=3.29.2-GA
junit_version=5.10.2
lombok_version=1.18.30
gson_version=2.10.1
quartz_version=2.5.0-rc1
apache_commons_compression_version=1.26.2
apache_commons_io_version=2.14.0
26 changes: 19 additions & 7 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,27 @@
"id": "fuji",
"version": "${version}",
"name": "Fuji",
"icon": "assets/fuji/icon.png",
"description": "A mod that provides many essential and useful modules for vanilla survival.",
"authors": [
"SakuraWald"
],
"license": "CC0-1.0",
"contact": {
"homepage": "https://github.com/SakuraWald"
"homepage": "https://github.com/SakuraWald",
"sources": "https://github.com/sakurawald/fuji-fabric/",
"issues": "https://github.com/sakurawald/fuji-fabric/issues"
},
"license": "CC0-1.0",
"icon": "assets/fuji/icon.png",
"authors": [
{
"name": "SakuraWald",
"contact": {
"email": "[email protected]"
}
}
],
"contributors": [
{
"name": "mcjunshi"
}
],
"environment": "*",
"entrypoints": {
"main": [
Expand All @@ -23,7 +35,7 @@
"fuji.mixins.json"
],
"depends": {
"fabricloader": ">=0.14.22",
"fabricloader": ">=0.15.11",
"minecraft": "~1.21",
"java": ">=17",
"fabric-api": "*"
Expand Down

0 comments on commit 8365f2f

Please sign in to comment.