Guest User

Untitled

a guest
Apr 2nd, 2025
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. import org.apache.tools.ant.filters.ReplaceTokens
  2. import org.jetbrains.changelog.Changelog
  3. import org.jetbrains.intellij.platform.gradle.TestFrameworkType
  4.  
  5. plugins {
  6. id("java") // Java support
  7. alias(libs.plugins.kotlin) // Kotlin support
  8. alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
  9. alias(libs.plugins.changelog) // Gradle Changelog Plugin
  10. alias(libs.plugins.kotlinSerialization) // Kotlinx serialization
  11. alias(libs.plugins.gradleDetektPlugin) // Gradle Detekt Plugin
  12. alias(libs.plugins.gradleDiktatPlugin) // Gradle Diktat Plugin
  13. }
  14.  
  15. group = providers.gradleProperty("pluginGroup").get()
  16. version = providers.gradleProperty("pluginVersion").get()
  17.  
  18. // Set the JVM language level used to build the project.
  19. kotlin {
  20. jvmToolchain(17)
  21. }
  22.  
  23. // Configure project's dependencies
  24. repositories {
  25. mavenCentral()
  26. gradlePluginPortal()
  27.  
  28. // IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
  29. intellijPlatform {
  30. defaultRepositories()
  31. }
  32. }
  33.  
  34. // Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
  35. dependencies {
  36. detektPlugins(libs.detektFormatting)
  37.  
  38. implementation(libs.kotlinxSerializationJson)
  39. implementation(libs.sentry)
  40. testImplementation(libs.junit)
  41.  
  42. // IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
  43. intellijPlatform {
  44. create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))
  45.  
  46. // Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
  47. bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
  48.  
  49. // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
  50. plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
  51.  
  52. instrumentationTools()
  53. pluginVerifier()
  54. zipSigner()
  55. testFramework(TestFrameworkType.Platform)
  56. }
  57. }
  58.  
  59. // Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
  60. intellijPlatform {
  61. pluginConfiguration {
  62. version = providers.gradleProperty("pluginVersion")
  63.  
  64. val changelog = project.changelog // local variable for configuration cache compatibility
  65. // Get the latest available change notes from the changelog file
  66. changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
  67. with(changelog) {
  68. renderItem(
  69. (getOrNull(pluginVersion) ?: getUnreleased())
  70. .withHeader(false)
  71. .withEmptySections(false),
  72. Changelog.OutputType.HTML,
  73. )
  74. }
  75. }
  76.  
  77. ideaVersion {
  78. sinceBuild = providers.gradleProperty("pluginSinceBuild")
  79. untilBuild = providers.gradleProperty("pluginUntilBuild")
  80. }
  81. }
  82.  
  83. pluginVerification {
  84. freeArgs = listOf("-ip", file("ignored-problems.txt").absolutePath)
  85.  
  86. ides {
  87. recommended()
  88. }
  89. }
  90. }
  91.  
  92. // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
  93. changelog {
  94. groups.empty()
  95. repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
  96. }
  97.  
  98. // Configure detekt plugin.
  99. // Read more: https://detekt.github.io/detekt/kotlindsl.html
  100. detekt {
  101. config.setFrom("./detekt-config.yml")
  102. buildUponDefaultConfig = true
  103. }
  104.  
  105. tasks {
  106. processResources {
  107. val tokens = mapOf(
  108. "sentry_dsn" to (System.getenv("SENTRY_DSN") ?: ""),
  109. )
  110.  
  111. filesMatching("plugin_config.json") {
  112. filteringCharset = "UTF-8"
  113. filter<ReplaceTokens>("tokens" to tokens)
  114. }
  115. }
  116.  
  117. wrapper {
  118. gradleVersion = providers.gradleProperty("gradleVersion").get()
  119. }
  120.  
  121. detekt.configure {
  122. reports {
  123. html.required.set(true)
  124. xml.required.set(false)
  125. txt.required.set(false)
  126. }
  127. }
  128. }
  129.  
Add Comment
Please, Sign In to add comment