1
0

build.gradle 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. plugins {
  2. id 'fabric-loom' version '0.5-SNAPSHOT'
  3. id 'maven-publish'
  4. }
  5. sourceCompatibility = JavaVersion.VERSION_1_8
  6. targetCompatibility = JavaVersion.VERSION_1_8
  7. archivesBaseName = project.archives_base_name
  8. version = project.mod_version
  9. group = project.maven_group
  10. dependencies {
  11. //to change the versions see the gradle.properties file
  12. minecraft "com.mojang:minecraft:${project.minecraft_version}"
  13. mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
  14. modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
  15. // Fabric API. This is technically optional, but you probably want it anyway.
  16. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
  17. // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
  18. // You may need to force-disable transitiveness on them.
  19. }
  20. processResources {
  21. inputs.property "version", project.version
  22. from(sourceSets.main.resources.srcDirs) {
  23. include "fabric.mod.json"
  24. expand "version": project.version
  25. }
  26. from(sourceSets.main.resources.srcDirs) {
  27. exclude "fabric.mod.json"
  28. }
  29. }
  30. // ensure that the encoding is set to UTF-8, no matter what the system default is
  31. // this fixes some edge cases with special characters not displaying correctly
  32. // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
  33. tasks.withType(JavaCompile) {
  34. options.encoding = "UTF-8"
  35. }
  36. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  37. // if it is present.
  38. // If you remove this task, sources will not be generated.
  39. task sourcesJar(type: Jar, dependsOn: classes) {
  40. classifier = "sources"
  41. from sourceSets.main.allSource
  42. }
  43. jar {
  44. from "LICENSE"
  45. }
  46. // configure the maven publication
  47. publishing {
  48. publications {
  49. mavenJava(MavenPublication) {
  50. // add all the jars that should be included when publishing to maven
  51. artifact(remapJar) {
  52. builtBy remapJar
  53. }
  54. artifact(sourcesJar) {
  55. builtBy remapSourcesJar
  56. }
  57. }
  58. }
  59. // select the repositories you want to publish to
  60. repositories {
  61. // uncomment to publish to the local maven
  62. // mavenLocal()
  63. }
  64. }