build.gradle.kts 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
  2. import Config.Libs.Bukkit as Bukkit
  3. // Config is located in <root>/buildSrc/src/main/java/Config.kt
  4. // It provides a bunch of constant values we use as dependency
  5. // strings, so we don't have to duplicate a bunch of them in
  6. // various scripts. The import as allows for shorthand.
  7. val bukkit: Project = Projects.bukkit!! // Static project references
  8. val core: Project = Projects.core!! // Stored by Config.kt and created in <root>/build.gradle.kts
  9. /* This configures ":bukkit" and it's dependent projects:
  10. - ":bukkit:1_8_8"
  11. - ":bukkit:1_12"
  12. - ":bukkit:1_13"
  13. Basically sets up all projects to depend on ":core" and
  14. bstats-bukkit. Also sets up shadow to relocate bukkit related
  15. packages to limit platform interference
  16. */
  17. allprojects {
  18. dependencies {
  19. compile(core) // includes junit for tests
  20. implementation(Bukkit.bstats) // Bukkit bstats
  21. }
  22. // TODO dunno if this works yet... project needs to compile.
  23. val shadowJar by tasks.getting(ShadowJar::class) {
  24. // Relocate bstats for bukkit, as per requirement for bstats
  25. relocate(Shadow.Origin.bstatsBukkit, Shadow.Target.bstatsBukkit)
  26. // Relocate the bukkit platform classes of mcmmo so we don't
  27. // interfere with other platform classes (or core)
  28. relocate(Deps.Groups.nossr, "${Deps.Groups.nossr}.bukkit") {
  29. exclude("${Deps.Groups.nossr}.core")
  30. }
  31. }
  32. }
  33. // Tells all subprojects of ":bukkit" (":bukkit:1_8_8", ":bukkit:1_12",etc.)
  34. // to depend on this project (":bukkit") to inherit the dependencies, and
  35. // does NOT inherit the same configurations (anything configured outside
  36. // here does not persist to child projects).
  37. subprojects {
  38. dependencies {
  39. // Provide the base bukkit plugin dependency for plugin classloading.
  40. // All "versioned" implementations will be properly classloaded by the bukkit parent
  41. compileOnly(bukkit)
  42. }
  43. }
  44. plugins {
  45. `java-library` // This is already provided, but for static compilation,
  46. // we declare it here so we can use the IDE static type references
  47. }
  48. dependencies {
  49. // Temporary dependencies while things are being moved.
  50. compileOnly(Bukkit.`1_13`.spigotApi) { // Spigot API for generic usage. Based on 1.13.2
  51. isTransitive = true // We don't want the dependencies
  52. }
  53. compileOnly(Bukkit.`1_13`.api) { // Bukkit API for generic usage. Based on 1.13.2
  54. isTransitive = true // We don't want the dependencies
  55. }
  56. compileOnly(Bukkit.`1_13`.wgCore) { // WorldGuard dependency, again, for 1.13.2
  57. isTransitive = true // We don't want the dependencies
  58. exclude(group = Shadow.Exclude.sk89q)
  59. exclude(group = Shadow.Exclude.intake, module = "intake")
  60. exclude(group = Shadow.Exclude.sk89q, module = "squirrelid")
  61. exclude(group = Shadow.Exclude.flyway)
  62. exclude(group = Shadow.Exclude.khelekore)
  63. exclude(group = Shadow.Exclude.findbugs)
  64. }
  65. compileOnly(Bukkit.`1_13`.wgLegacy) {
  66. isTransitive = true // We don't want the dependencies
  67. exclude(group = Shadow.Exclude.bukkit)
  68. exclude(group = Shadow.Exclude.sk89q, module = "commandbook")
  69. exclude(group = Shadow.Exclude.bstats)
  70. }
  71. }