Guest User

Untitled

a guest
May 13th, 2026
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. pluginManagement {
  2. repositories {
  3. gradlePluginPortal()
  4. maven("https://repo.papermc.io/repository/maven-public/")
  5. }
  6. }
  7.  
  8. plugins {
  9. id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
  10. }
  11.  
  12. if (!file(".git").exists()) {
  13. val errorText = """
  14.  
  15. =====================[ ERROR ]=====================
  16. The Paper project directory is not a properly cloned Git repository.
  17.  
  18. In order to build Paper from source you must clone
  19. the Paper repository using Git, not download a code
  20. zip from GitHub.
  21.  
  22. Built Paper jars are available for download at
  23. https://papermc.io/downloads/paper
  24.  
  25. See https://github.com/PaperMC/Paper/blob/main/CONTRIBUTING.md
  26. for further information on building and modifying Paper.
  27. ===================================================
  28. """.trimIndent()
  29. error(errorText)
  30. }
  31.  
  32. rootProject.name = "paper"
  33.  
  34. for (name in listOf("paper-api", "paper-server")) {
  35. include(name)
  36. file(name).mkdirs()
  37. }
  38.  
  39. optionalInclude("test-plugin")
  40. optionalInclude("paper-generator")
  41.  
  42. fun optionalInclude(name: String, op: (ProjectDescriptor.() -> Unit)? = null) {
  43. val settingsFile = file("$name.settings.gradle.kts")
  44. if (settingsFile.exists()) {
  45. apply(from = settingsFile)
  46. findProject(":$name")?.let { op?.invoke(it) }
  47. } else {
  48. settingsFile.writeText(
  49. """
  50. // Uncomment to enable the '$name' project
  51. // include(":$name")
  52.  
  53. """.trimIndent()
  54. )
  55. }
  56. }
  57.  
  58. gradle.lifecycle.beforeProject {
  59. val mcVersion = providers.gradleProperty("mcVersion").get().trim()
  60. val paperVersionChannel = providers.gradleProperty("channel").get().trim()
  61. val paperBuildNumber = providers.environmentVariable("BUILD_NUMBER").orNull?.trim()?.toInt()
  62. val versionString = if (paperBuildNumber == null) {
  63. "$mcVersion.local-SNAPSHOT"
  64. } else {
  65. "$mcVersion.build.$paperBuildNumber-${paperVersionChannel.lowercase()}"
  66. }
  67. version = versionString
  68. }
  69.  
  70. if (providers.gradleProperty("paperBuildCacheEnabled").orNull.toBoolean()) {
  71. val buildCacheUsername = providers.gradleProperty("paperBuildCacheUsername").orElse("").get()
  72. val buildCachePassword = providers.gradleProperty("paperBuildCachePassword").orElse("").get()
  73. if (buildCacheUsername.isBlank() || buildCachePassword.isBlank()) {
  74. println("The Paper remote build cache is enabled, but no credentials were provided. Remote build cache will not be used.")
  75. } else {
  76. val buildCacheUrl = providers.gradleProperty("paperBuildCacheUrl")
  77. .orElse("https://gradle-build-cache.papermc.io/")
  78. .get()
  79. val buildCachePush = providers.gradleProperty("paperBuildCachePush").orNull?.toBoolean()
  80. ?: System.getProperty("CI").toBoolean()
  81. buildCache {
  82. remote<HttpBuildCache> {
  83. url = uri(buildCacheUrl)
  84. isPush = buildCachePush
  85. credentials {
  86. username = buildCacheUsername
  87. password = buildCachePassword
  88. }
  89. }
  90. }
  91. }
  92. }
  93.  
Advertisement
Add Comment
Please, Sign In to add comment