build.gradle 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. plugins {
  2. id 'fabric-loom' version '1.11-SNAPSHOT'
  3. id 'maven-publish'
  4. }
  5. version = project.mod_version
  6. group = project.maven_group
  7. base {
  8. archivesName = project.archives_base_name
  9. }
  10. loom {
  11. splitEnvironmentSourceSets()
  12. mods {
  13. "tvhs_mc_server_mod" {
  14. sourceSet sourceSets.main
  15. sourceSet sourceSets.client
  16. }
  17. }
  18. }
  19. fabricApi {
  20. configureDataGeneration {
  21. client = true
  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. dependencies {
  32. // To change the versions see the gradle.properties file
  33. minecraft "com.mojang:minecraft:${project.minecraft_version}"
  34. mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
  35. modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
  36. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
  37. }
  38. processResources {
  39. inputs.property "version", project.version
  40. inputs.property "minecraft_version", project.minecraft_version
  41. inputs.property "loader_version", project.loader_version
  42. filteringCharset "UTF-8"
  43. filesMatching("fabric.mod.json") {
  44. expand "version": project.version,
  45. "minecraft_version": project.minecraft_version,
  46. "loader_version": project.loader_version
  47. }
  48. }
  49. def targetJavaVersion = 21
  50. tasks.withType(JavaCompile).configureEach {
  51. // ensure that the encoding is set to UTF-8, no matter what the system default is
  52. // this fixes some edge cases with special characters not displaying correctly
  53. // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
  54. // If Javadoc is generated, this must be specified in that task too.
  55. it.options.encoding = "UTF-8"
  56. if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
  57. it.options.release.set(targetJavaVersion)
  58. }
  59. }
  60. java {
  61. def javaVersion = JavaVersion.toVersion(targetJavaVersion)
  62. if (JavaVersion.current() < javaVersion) {
  63. toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
  64. }
  65. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  66. // if it is present.
  67. // If you remove this line, sources will not be generated.
  68. withSourcesJar()
  69. }
  70. jar {
  71. from("LICENSE") {
  72. rename { "${it}_${project.archivesBaseName}"}
  73. }
  74. }
  75. // configure the maven publication
  76. publishing {
  77. publications {
  78. create("mavenJava", MavenPublication) {
  79. artifactId = project.archives_base_name
  80. from components.java
  81. }
  82. }
  83. // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
  84. repositories {
  85. // Add repositories to publish to here.
  86. // Notice: This block does NOT have the same function as the block in the top level.
  87. // The repositories here will be used for publishing your artifact, not for
  88. // retrieving dependencies.
  89. }
  90. }