build.gradle 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. 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. modApi "me.shedaniel.cloth:config-2:${project.cloth_config_version}"
  16. compileOnly "org.projectlombok:lombok:${project.lombok_version}"
  17. annotationProcessor "org.projectlombok:lombok:${project.lombok_version}"
  18. }
  19. processResources {
  20. inputs.property "version", project.version
  21. from(sourceSets.main.resources.srcDirs) {
  22. include "fabric.mod.json"
  23. expand "version": project.version
  24. }
  25. from(sourceSets.main.resources.srcDirs) {
  26. exclude "fabric.mod.json"
  27. }
  28. }
  29. // ensure that the encoding is set to UTF-8, no matter what the system default is
  30. // this fixes some edge cases with special characters not displaying correctly
  31. // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
  32. tasks.withType(JavaCompile) {
  33. options.encoding = "UTF-8"
  34. }
  35. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  36. // if it is present.
  37. // If you remove this task, sources will not be generated.
  38. task sourcesJar(type: Jar, dependsOn: classes) {
  39. classifier = "sources"
  40. from sourceSets.main.allSource
  41. }
  42. jar {
  43. from "LICENSE"
  44. }
  45. // configure the maven publication
  46. publishing {
  47. publications {
  48. mavenJava(MavenPublication) {
  49. // add all the jars that should be included when publishing to maven
  50. artifact(remapJar) {
  51. builtBy remapJar
  52. }
  53. artifact(sourcesJar) {
  54. builtBy remapSourcesJar
  55. }
  56. }
  57. }
  58. // select the repositories you want to publish to
  59. repositories {
  60. // uncomment to publish to the local maven
  61. // mavenLocal()
  62. }
  63. }