edited templates/fabric/build.gradle.kts.ft 
Open in IDE
RErednesto⁠ rednesto: Bump templates
Copy Copy
        
  1. import org.jetbrains.kotlin.gradle.dsl.JvmTarget
  2. import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
  3.  
  4. plugins {
  5. kotlin("jvm") version "${KOTLIN_LOADER_VERSION.toString().split("kotlin.")[1]}"
  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 = ${JAVA_VERSION}
  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. #if ($SPLIT_SOURCES)
  27. loom {
  28. splitEnvironmentSourceSets()
  29.  
  30. mods {
  31. register("${MOD_ID}") {
  32. sourceSet("main")
  33. sourceSet("client")
  34. }
  35. }
  36. }
  37. #end
  38.  
  39. repositories {
  40. // Add repositories to retrieve artifacts from in here.
  41. // You should only use this when depending on other mods because
  42. // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
  43. // See https://docs.gradle.org/current/userguide/declaring_repositories.html
  44. // for more information about repositories.
  45. }
  46.  
  47. dependencies {
  48. // To change the versions see the gradle.properties file
  49. minecraft("com.mojang:minecraft:${project.property("minecraft_version")}")
  50. #if (${VERSIONS.useOfficialMappings})
  51. mappings(loom.officialMojangMappings())
  52. #else
  53. mappings("net.fabricmc:yarn:${project.property("yarn_mappings")}:v2")
  54. #end
  55. modImplementation("net.fabricmc:fabric-loader:${project.property("loader_version")}")
  56. modImplementation("net.fabricmc:fabric-language-kotlin:${project.property("kotlin_loader_version")}")
  57.  
  58. #if (${VERSIONS.useFabricApi})
  59. // Fabric API. This is technically optional, but you probably want it anyway.
  60. modImplementation("net.fabricmc.fabric-api:fabric-api:${project.property("fabric_version")}")
  61. #end
  62. }
  63.  
  64. tasks.processResources {
  65. inputs.property("version", project.version)
  66. inputs.property("minecraft_version", project.property("minecraft_version"))
  67. inputs.property("loader_version", project.property("loader_version"))
  68. filteringCharset = "UTF-8"
  69.  
  70. filesMatching("fabric.mod.json") {
  71. expand("version" to project.version,
  72. "minecraft_version" to project.property("minecraft_version"),
  73. "loader_version" to project.property("loader_version"),
  74. "kotlin_loader_version" to project.property("kotlin_loader_version"))
  75. }
  76. }
  77.  
  78. tasks.withType<JavaCompile>().configureEach {
  79. // ensure that the encoding is set to UTF-8, no matter what the system default is
  80. // this fixes some edge cases with special characters not displaying correctly
  81. // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
  82. // If Javadoc is generated, this must be specified in that task too.
  83. options.encoding = "UTF-8"
  84. options.release.set(targetJavaVersion)
  85. }
  86.  
  87. tasks.withType<KotlinCompile>().configureEach {
  88. compilerOptions.jvmTarget.set(JvmTarget.fromTarget(targetJavaVersion.toString()))
  89. }
  90.  
  91. tasks.jar {
  92. from("LICENSE") {
  93. rename { "${it}_${project.base.archivesName}" }
  94. }
  95. }
  96.  
  97. // configure the maven publication
  98. publishing {
  99. publications {
  100. create<MavenPublication>("mavenJava") {
  101. artifactId = project.property("archives_base_name") as String
  102. from(components["java"])
  103. }
  104. }
  105.  
  106. // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
  107. repositories {
  108. // Add repositories to publish to here.
  109. // Notice: This block does NOT have the same function as the block in the top level.
  110. // The repositories here will be used for publishing your artifact, not for
  111. // retrieving dependencies.
  112. }
  113. }
        
  1. import org.jetbrains.kotlin.gradle.dsl.JvmTarget
  2. import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
  3.  
  4. plugins {
  5. kotlin("jvm") version "${KOTLIN_LOADER_VERSION.toString().split("kotlin.")[1]}"
  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 = ${JAVA_VERSION}
  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. #if ($SPLIT_SOURCES && $VERSIONS.minecraftVersion.compareTo($mcver.MC1_18) >= 0)
  27. loom {
  28. splitEnvironmentSourceSets()
  29.  
  30. mods {
  31. register("${MOD_ID}") {
  32. sourceSet("main")
  33. sourceSet("client")
  34. }
  35. }
  36. }
  37. #end
  38.  
  39. repositories {
  40. // Add repositories to retrieve artifacts from in here.
  41. // You should only use this when depending on other mods because
  42. // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
  43. // See https://docs.gradle.org/current/userguide/declaring_repositories.html
  44. // for more information about repositories.
  45. }
  46.  
  47. dependencies {
  48. // To change the versions see the gradle.properties file
  49. minecraft("com.mojang:minecraft:${project.property("minecraft_version")}")
  50. #if (${VERSIONS.useOfficialMappings})
  51. mappings(loom.officialMojangMappings())
  52. #else
  53. mappings("net.fabricmc:yarn:${project.property("yarn_mappings")}:v2")
  54. #end
  55. modImplementation("net.fabricmc:fabric-loader:${project.property("loader_version")}")
  56. modImplementation("net.fabricmc:fabric-language-kotlin:${project.property("kotlin_loader_version")}")
  57.  
  58. #if (${VERSIONS.useFabricApi})
     
  59. modImplementation("net.fabricmc.fabric-api:fabric-api:${project.property("fabric_version")}")
  60. #end
  61. }
  62.  
  63. tasks.processResources {
  64. inputs.property("version", project.version)
  65. inputs.property("minecraft_version", project.property("minecraft_version"))
  66. inputs.property("loader_version", project.property("loader_version"))
  67. filteringCharset = "UTF-8"
  68.  
  69. filesMatching("fabric.mod.json") {
  70. expand("version" to project.version,
  71. "minecraft_version" to project.property("minecraft_version"),
  72. "loader_version" to project.property("loader_version"),
  73. "kotlin_loader_version" to project.property("kotlin_loader_version"))
  74. }
  75. }
  76.  
  77. tasks.withType<JavaCompile>().configureEach {
  78. // ensure that the encoding is set to UTF-8, no matter what the system default is
  79. // this fixes some edge cases with special characters not displaying correctly
  80. // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
  81. // If Javadoc is generated, this must be specified in that task too.
  82. options.encoding = "UTF-8"
  83. options.release.set(targetJavaVersion)
  84. }
  85.  
  86. tasks.withType<KotlinCompile>().configureEach {
  87. compilerOptions.jvmTarget.set(JvmTarget.fromTarget(targetJavaVersion.toString()))
  88. }
  89.  
  90. tasks.jar {
  91. from("LICENSE") {
  92. rename { "${it}_${project.base.archivesName}" }
  93. }
  94. }
  95.  
  96. // configure the maven publication
  97. publishing {
  98. publications {
  99. create<MavenPublication>("mavenJava") {
  100. artifactId = project.property("archives_base_name") as String
  101. from(components["java"])
  102. }
  103. }
  104.  
  105. // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
  106. repositories {
  107. // Add repositories to publish to here.
  108. // Notice: This block does NOT have the same function as the block in the top level.
  109. // The repositories here will be used for publishing your artifact, not for
  110. // retrieving dependencies.
  111. }
  112. }
×

Add build comment

Cancel
×

Mute test

×

×

Server communication failure

Server is unavailable

Server stopped or communication with the server is not possible due to network failure.

Server shutdown started.

Please relogin to continue your work.

×

Run Custom Build

×

TODO

Loading related builds...
Cancel
×

Responsibility

×

Edit tags

Cancel
×

Loading...

×

Are you sure?

Cancel
×

Please type to confirm.
Cancel