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. 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. links = [
  49. "https://docs.oracle.com/javase/8/docs/api/"
  50. ]
  51. // Disable the crazy super-strict doclint tool in Java 8
  52. addStringOption("Xdoclint:none", "-quiet")
  53. }
  54. failOnError false
  55. }
  56. task javadocJar(type: Jar) {
  57. dependsOn javadoc
  58. from javadoc.destinationDir
  59. archiveClassifier = "javadoc"
  60. }
  61. build.dependsOn javadocJar
  62. // configure the maven publication
  63. publishing {
  64. publications {
  65. mavenJava(MavenPublication) {
  66. artifactId rootProject.name
  67. artifact(remapJar) {
  68. builtBy remapJar
  69. }
  70. artifact(sourcesJar) {
  71. builtBy remapSourcesJar
  72. }
  73. artifact javadocJar
  74. }
  75. }
  76. }