build.gradle 2.1 KB

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