build.gradle 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. plugins {
  2. id 'com.github.johnrengelman.shadow' version '6.1.0'
  3. id 'maven-publish'
  4. }
  5. dependencies {
  6. shadow("org.spongepowered:configurate-hocon:${rootProject.configurate_version}")
  7. testImplementation("org.junit.jupiter:junit-jupiter:${rootProject.junit_version}")
  8. testImplementation("org.assertj:assertj-core:${rootProject.assertj_version}")
  9. testImplementation("org.mockito:mockito-inline:${rootProject.mockito_version}")
  10. testImplementation("org.mockito:mockito-junit-jupiter:${rootProject.mockito_junit_version}")
  11. testImplementation("io.github.hakky54:logcaptor:${rootProject.logcaptor_version}")
  12. testImplementation("com.google.jimfs:jimfs:${rootProject.jimfs_version}")
  13. }
  14. java {
  15. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  16. // if it is present.
  17. withSourcesJar()
  18. }
  19. jar {
  20. from "LICENSE"
  21. }
  22. shadowJar {
  23. configurations = [project.configurations.shadow]
  24. archiveClassifier = "shadow"
  25. }
  26. remapJar {
  27. dependsOn(shadowJar)
  28. input.set(shadowJar.archiveFile)
  29. }
  30. task testClient(type: Test) {
  31. systemProperty "fabric.dli.env", "client"
  32. }
  33. test.dependsOn testClient
  34. task testServer(type: Test) {
  35. systemProperty "fabric.dli.env", "server"
  36. }
  37. test.dependsOn testServer
  38. tasks.withType(Test) {
  39. useJUnitPlatform()
  40. }
  41. javadoc {
  42. options {
  43. title = "$modName ${project.version} API"
  44. source = "8"
  45. encoding = "UTF-8"
  46. charSet = "UTF-8"
  47. memberLevel = JavadocMemberLevel.PROTECTED
  48. // Disable the crazy super-strict doclint tool in Java 8
  49. addStringOption("Xdoclint:none", "-quiet")
  50. }
  51. source = sourceSets.main.allJava
  52. failOnError false
  53. }
  54. task javadocJar(type: Jar) {
  55. dependsOn javadoc
  56. from javadoc.destinationDir
  57. archiveClassifier = "javadoc"
  58. }
  59. build.dependsOn javadocJar
  60. // configure the maven publication
  61. publishing {
  62. publications {
  63. mavenJava(MavenPublication) {
  64. artifactId rootProject.name
  65. artifact(remapJar) {
  66. builtBy remapJar
  67. }
  68. artifact(sourcesJar) {
  69. builtBy remapSourcesJar
  70. }
  71. artifact javadocJar
  72. }
  73. }
  74. }