build.gradle 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. plugins {
  2. id 'net.fabricmc.fabric-loom-remap' version "${loom_version}"
  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. repositories {
  11. // Add repositories to retrieve artifacts from in here.
  12. // You should only use this when depending on other mods because
  13. // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
  14. // See https://docs.gradle.org/current/userguide/declaring_repositories.html
  15. // for more information about repositories.
  16. }
  17. loom {
  18. splitEnvironmentSourceSets()
  19. mods {
  20. "husj" {
  21. sourceSet sourceSets.main
  22. sourceSet sourceSets.client
  23. }
  24. }
  25. }
  26. dependencies {
  27. // To change the versions see the gradle.properties file
  28. minecraft "com.mojang:minecraft:${project.minecraft_version}"
  29. mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
  30. modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
  31. // Fabric API. This is technically optional, but you probably want it anyway.
  32. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
  33. }
  34. processResources {
  35. inputs.property "version", project.version
  36. filesMatching("fabric.mod.json") {
  37. expand "version": inputs.properties.version
  38. }
  39. }
  40. tasks.withType(JavaCompile).configureEach {
  41. it.options.release = 21
  42. }
  43. java {
  44. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  45. // if it is present.
  46. // If you remove this line, sources will not be generated.
  47. withSourcesJar()
  48. sourceCompatibility = JavaVersion.VERSION_21
  49. targetCompatibility = JavaVersion.VERSION_21
  50. }
  51. jar {
  52. inputs.property "archivesName", project.base.archivesName
  53. from("LICENSE") {
  54. rename { "${it}_${inputs.properties.archivesName}"}
  55. }
  56. }
  57. // configure the maven publication
  58. publishing {
  59. publications {
  60. create("mavenJava", MavenPublication) {
  61. artifactId = project.archives_base_name
  62. from components.java
  63. }
  64. }
  65. // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
  66. repositories {
  67. // Add repositories to publish to here.
  68. // Notice: This block does NOT have the same function as the block in the top level.
  69. // The repositories here will be used for publishing your artifact, not for
  70. // retrieving dependencies.
  71. }
  72. }