build.gradle 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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_version}")
  11. testImplementation("io.github.hakky54:logcaptor:${rootProject.logcaptor_version}")
  12. testImplementation("com.google.jimfs:jimfs:${rootProject.jimfs_version}") {
  13. exclude group: 'com.google.guava', module: 'guava'
  14. }
  15. }
  16. java {
  17. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  18. // if it is present.
  19. withSourcesJar()
  20. }
  21. jar {
  22. from "LICENSE"
  23. }
  24. shadowJar {
  25. configurations = [project.configurations.shadow]
  26. archiveClassifier = "shadow"
  27. }
  28. remapJar {
  29. dependsOn(shadowJar)
  30. input.set(shadowJar.archiveFile)
  31. }
  32. test.enabled = false
  33. task testClient(type: Test) {
  34. systemProperty "fabric.dli.env", "client"
  35. }
  36. test.dependsOn testClient
  37. task testServer(type: Test) {
  38. systemProperty "fabric.dli.env", "server"
  39. }
  40. test.dependsOn testServer
  41. tasks.withType(Test) {
  42. group = "verification"
  43. useJUnitPlatform()
  44. }
  45. javadoc {
  46. options {
  47. title = "$modName ${project.version} API"
  48. source = "8"
  49. encoding = "UTF-8"
  50. charSet = "UTF-8"
  51. memberLevel = JavadocMemberLevel.PROTECTED
  52. links = [
  53. "https://docs.oracle.com/javase/8/docs/api/"
  54. ]
  55. // Disable the crazy super-strict doclint tool in Java 8
  56. addStringOption("Xdoclint:none", "-quiet")
  57. }
  58. failOnError false
  59. }
  60. task javadocJar(type: Jar) {
  61. dependsOn javadoc
  62. from javadoc.destinationDir
  63. archiveClassifier = "javadoc"
  64. }
  65. build.dependsOn javadocJar
  66. // configure the maven publication
  67. publishing {
  68. publications {
  69. mavenJava(MavenPublication) {
  70. artifactId rootProject.name
  71. artifact(remapJar) {
  72. builtBy remapJar
  73. }
  74. artifact(sourcesJar) {
  75. builtBy remapSourcesJar
  76. }
  77. artifact javadocJar
  78. }
  79. }
  80. }