build.gradle.kts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
  2. import Config.Libs.Sponge as Sponge
  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. plugins {
  8. `java-library` // This is already provided, but for static compilation,
  9. // we declare it here so we can use the IDE static type references
  10. }
  11. val core = Projects.core!! // because it's a var and potentially null by declaration
  12. val sponge = Projects.sponge!! // because it's a var and potentially null by declaration
  13. description = "mcMMO for Sponge"
  14. /*
  15. These dependencies are minimalized. SpongeAPI is not inherited by subprojects.
  16. Bstats-sponge is api version agnostic for the moment.
  17. */
  18. dependencies {
  19. compile(Sponge.bstats) // Bstats is used for all sponge versions
  20. compileOnly(Sponge.API7.api) // Base version for common plugin class
  21. }
  22. /* This configures ":sponge" and it's dependent projects:
  23. - ":sponge:api7"
  24. Basically sets up all projects to depend on ":core" and
  25. bstats-sponge. Bstatss-sponge should not be relocated
  26. */
  27. allprojects {
  28. dependencies {
  29. compile(Projects.core!!)
  30. }
  31. // TODO dunno if this works yet... project needs to compile.
  32. val shadowJar by tasks.getting(ShadowJar::class) { // We set this up so we relocate all sponge projects, not just ":sponge"
  33. relocate(Deps.Groups.nossr, "${Deps.Groups.nossr}.sponge") {
  34. exclude("${Deps.Groups.nossr}.core")
  35. }
  36. }
  37. }
  38. // Tells all subprojects of ":sponge" (":sponge:api7")
  39. // to depend on this project (":sponge") to inherit the dependencies, and
  40. // does NOT inherit the same configurations (anything configured outside
  41. // here does not persist to child projects).
  42. subprojects {
  43. dependencies {
  44. (compileOnly(sponge) as ModuleDependency).apply {
  45. exclude(Sponge.Exclude.group, Sponge.Exclude.module)
  46. }
  47. }
  48. }