1+ plugins {
2+ id ' fabric-loom' version ' 1.10-SNAPSHOT'
3+ id ' maven-publish'
4+ // id "org.jetbrains.kotlin.jvm" version "2.1.0"
5+ }
6+
7+ def getVersionFromFile () {
8+ def versionFile = file(' ../version' )
9+ if (versionFile. exists()) {
10+ return versionFile. text. trim()
11+ } else {
12+ throw new GradleException (" Version file not found: ${ versionFile.absolutePath} " )
13+ }
14+ }
15+
16+ version = getVersionFromFile()
17+
18+ group = project. maven_group
19+
20+ base {
21+ archivesName = project. archives_base_name
22+ }
23+
24+ repositories {
25+ // Add repositories to retrieve artifacts from in here.
26+ // You should only use this when depending on other mods because
27+ // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
28+ // See https://docs.gradle.org/current/userguide/declaring_repositories.html
29+ // for more information about repositories.
30+ }
31+
32+ dependencies {
33+ // To change the versions see the gradle.properties file
34+ minecraft " com.mojang:minecraft:${ project.minecraft_version} "
35+ mappings " net.fabricmc:yarn:${ project.yarn_mappings} :v2"
36+ modImplementation " net.fabricmc:fabric-loader:${ project.loader_version} "
37+
38+ // Fabric API. This is technically optional, but you probably want it anyway.
39+ modImplementation " net.fabricmc.fabric-api:fabric-api:${ project.fabric_version} "
40+ modImplementation " net.fabricmc:fabric-language-kotlin:${ project.fabric_kotlin_version} "
41+
42+ include modImplementation(' com.squareup.okio:okio-jvm:3.6.0' )
43+ include modImplementation(' com.squareup.okhttp3:okhttp:4.12.0' )
44+ include modImplementation(' org.xerial:sqlite-jdbc:3.48.0.0' )
45+ }
46+
47+ processResources {
48+ inputs. property " version" , project. version
49+
50+ filesMatching(" fabric.mod.json" ) {
51+ expand " version" : project. version
52+ }
53+ }
54+
55+ tasks. withType(JavaCompile ). configureEach {
56+ it. options. release = 21
57+ }
58+
59+ // tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
60+ // kotlinOptions {
61+ // jvmTarget = 21
62+ // }
63+ // }
64+
65+ java {
66+ // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
67+ // if it is present.
68+ // If you remove this line, sources will not be generated.
69+ withSourcesJar()
70+
71+ sourceCompatibility = JavaVersion . VERSION_21
72+ targetCompatibility = JavaVersion . VERSION_21
73+ }
74+
75+ jar {
76+ from(" LICENSE" ) {
77+ rename { " ${ it} _${ project.base.archivesName.get()} " }
78+ }
79+ }
80+
81+ // configure the maven publication
82+ publishing {
83+ publications {
84+ create(" mavenJava" , MavenPublication ) {
85+ artifactId = project. archives_base_name
86+ from components. java
87+ }
88+ }
89+
90+ // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
91+ repositories {
92+ // Add repositories to publish to here.
93+ // Notice: This block does NOT have the same function as the block in the top level.
94+ // The repositories here will be used for publishing your artifact, not for
95+ // retrieving dependencies.
96+ }
97+ }
0 commit comments