build.gradle 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. // Disable default test task
  31. test.enabled = false
  32. task testClient(type: Test) {
  33. systemProperty "fabric.dli.env", "client"
  34. }
  35. check.dependsOn testClient
  36. task testServer(type: Test) {
  37. systemProperty "fabric.dli.env", "server"
  38. }
  39. check.dependsOn testServer
  40. tasks.withType(Test) {
  41. useJUnitPlatform()
  42. }
  43. javadoc {
  44. options {
  45. source = "8"
  46. encoding = "UTF-8"
  47. charSet = "UTF-8"
  48. memberLevel = JavadocMemberLevel.PROTECTED
  49. // Disable the crazy super-strict doclint tool in Java 8
  50. addStringOption("Xdoclint:none", "-quiet")
  51. }
  52. source = sourceSets.main.allJava
  53. failOnError false
  54. }
  55. task javadocJar(type: Jar) {
  56. dependsOn javadoc
  57. from javadoc.destinationDir
  58. archiveClassifier = "javadoc"
  59. }
  60. build.dependsOn javadocJar
  61. // configure the maven publication
  62. publishing {
  63. publications {
  64. mavenJava(MavenPublication) {
  65. artifactId rootProject.name
  66. artifact(remapJar) {
  67. builtBy remapJar
  68. }
  69. artifact(sourcesJar) {
  70. builtBy remapSourcesJar
  71. }
  72. artifact javadocJar
  73. }
  74. }
  75. }