FurPuro

Untitled

Oct 6th, 2024
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 5.91 KB | None | 0 0
  1. import org.jetbrains.kotlin.gradle.dsl.JvmTarget
  2. import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
  3.  
  4. plugins {
  5.     kotlin("jvm") version "2.0.20"
  6.     id("fabric-loom") version "1.7.1"
  7.     id("maven-publish")
  8. }
  9.  
  10. version = project.property("mod_version") as String
  11. group = project.property("maven_group") as String
  12.  
  13. base {
  14.     archivesName.set(project.property("archives_base_name") as String)
  15. }
  16.  
  17. val targetJavaVersion = 17
  18. java {
  19.     toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
  20.     // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  21.     // if it is present.
  22.     // If you remove this line, sources will not be generated.
  23.     withSourcesJar()
  24. }
  25.  
  26. loom {
  27.     splitEnvironmentSourceSets()
  28.  
  29.     mods {
  30.         register("mysticrealms") {
  31.             sourceSet("main")
  32.             sourceSet("client")
  33.         }
  34.     }
  35. }
  36.  
  37. repositories {
  38.     maven {
  39.         name = "0mods mavenReleases"
  40.         url = uri("https://maven.0mods.team/releases")
  41.     }
  42.     mavenCentral()
  43. }
  44.  
  45. dependencies {
  46. // To change the versions see the gradle.properties file
  47.     val imguiVersion: String by project
  48.     minecraft("com.mojang:minecraft:${project.property("minecraft_version")}")
  49.     mappings(loom.officialMojangMappings())
  50.     modImplementation("net.fabricmc:fabric-loader:${project.property("loader_version")}")
  51.     modImplementation("net.fabricmc:fabric-language-kotlin:${project.property("kotlin_loader_version")}")
  52.     modImplementation("net.fabricmc.fabric-api:fabric-api:${project.property("fabric_version")}")
  53.  
  54.     //hollow core
  55.  
  56.     minecraftRuntimeLibraries(compileOnly("team.0mods:imgui-app:$imguiVersion")) {}
  57.     minecraftRuntimeLibraries(compileOnly("team.0mods:imgui-binding:$imguiVersion")) {}
  58.     minecraftRuntimeLibraries(compileOnly("team.0mods:imgui-lwjgl3:$imguiVersion")) {}
  59.     minecraftRuntimeLibraries(compileOnly("team.0mods:imgui-binding-natives:$imguiVersion")) {}
  60.  
  61.     minecraftRuntimeLibraries("com.akuleshov7:ktoml-core-jvm:0.5.1")
  62.     minecraftRuntimeLibraries(compileOnly("team.0mods:imgui-app:$imguiVersion")) {}
  63.     minecraftRuntimeLibraries(compileOnly("team.0mods:imgui-binding:$imguiVersion")) {}
  64.     minecraftRuntimeLibraries(compileOnly("team.0mods:imgui-lwjgl3:$imguiVersion")) {}
  65.     minecraftRuntimeLibraries(compileOnly("team.0mods:imgui-binding-natives:$imguiVersion")) {}
  66.     minecraftRuntimeLibraries("effekseer.swig:Swig:1.0")
  67.     minecraftRuntimeLibraries("com.tianscar.imageio:imageio-apng:1.0.1")
  68.     minecraftRuntimeLibraries("org.joml:joml:1.10.8")
  69.  
  70.     minecraftRuntimeLibraries("org.jetbrains.kotlin:kotlin-reflect:2.0.0") { exclude("org.jetbrains.kotlin") }
  71.     minecraftRuntimeLibraries("org.jetbrains.kotlin:kotlin-scripting-jvm:2.0.0") { exclude("org.jetbrains.kotlin") }
  72.     minecraftRuntimeLibraries("org.jetbrains.kotlin:kotlin-scripting-jvm-host:2.0.0") { exclude("org.jetbrains.kotlin") }
  73.     minecraftRuntimeLibraries("org.jetbrains.kotlin:kotlin-script-runtime:2.0.0") { exclude("org.jetbrains.kotlin") }
  74.     minecraftRuntimeLibraries("org.jetbrains.kotlin:kotlin-compiler-embeddable-mcfriendly:2.0.0")  { exclude("org.jetbrains.kotlin") }
  75.     minecraftRuntimeLibraries("org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:2.0.0") { exclude("org.jetbrains.kotlin") }
  76.     minecraftRuntimeLibraries("org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:2.0.0") { exclude("org.jetbrains.kotlin") }
  77.     minecraftRuntimeLibraries("org.jetbrains.kotlin:kotlin-metadata-jvm:2.0.0") { exclude("org.jetbrains.kotlin") }
  78.     minecraftRuntimeLibraries("org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.0") { exclude("org.jetbrains.kotlin") }
  79.     minecraftRuntimeLibraries("org.jetbrains.kotlinx:kotlinx-datetime-jvm:0.4.0") { exclude("org.jetbrains.kotlin") }
  80.     minecraftRuntimeLibraries("org.jetbrains.kotlin:kotlin-scripting-common:2.0.0") { exclude("org.jetbrains.kotlin") }
  81.  
  82.     implementation("ru.hollowhorizon:HollowCore-fabric-1.19.2:2.0.9:dev")
  83. }
  84.  
  85. tasks.processResources {
  86.     inputs.property("version", project.version)
  87.     inputs.property("minecraft_version", project.property("minecraft_version"))
  88.     inputs.property("loader_version", project.property("loader_version"))
  89.     filteringCharset = "UTF-8"
  90.  
  91.     filesMatching("fabric.mod.json") {
  92.         expand(
  93.             "version" to project.version,
  94.             "minecraft_version" to project.property("minecraft_version"),
  95.             "loader_version" to project.property("loader_version"),
  96.             "kotlin_loader_version" to project.property("kotlin_loader_version")
  97.         )
  98.     }
  99. }
  100.  
  101. tasks.withType<JavaCompile>().configureEach {
  102.     // ensure that the encoding is set to UTF-8, no matter what the system default is
  103.     // this fixes some edge cases with special characters not displaying correctly
  104.     // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
  105.     // If Javadoc is generated, this must be specified in that task too.
  106.     options.encoding = "UTF-8"
  107.     options.release.set(targetJavaVersion)
  108. }
  109.  
  110. tasks.withType<KotlinCompile>().configureEach {
  111.     compilerOptions.jvmTarget.set(JvmTarget.fromTarget(targetJavaVersion.toString()))
  112. }
  113.  
  114. tasks.jar {
  115.     from("LICENSE") {
  116.         rename { "${it}_${project.base.archivesName}" }
  117.     }
  118. }
  119.  
  120. // configure the maven publication
  121. publishing {
  122.     publications {
  123.         create<MavenPublication>("mavenJava") {
  124.             artifactId = project.property("archives_base_name") as String
  125.             from(components["java"])
  126.         }
  127.     }
  128.  
  129.     // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
  130.     repositories {
  131.         // Add repositories to publish to here.
  132.         // Notice: This block does NOT have the same function as the block in the top level.
  133.         // The repositories here will be used for publishing your artifact, not for
  134.         // retrieving dependencies.
  135.     }
  136. }
  137.  
Add Comment
Please, Sign In to add comment