build.gradle.kts 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import org.jetbrains.changelog.Changelog
  2. import org.jetbrains.changelog.markdownToHTML
  3. fun properties(key: String) = project.findProperty(key).toString()
  4. plugins {
  5. id("java")
  6. id("org.jetbrains.intellij") version "1.12.0"
  7. id("org.jetbrains.changelog") version "2.0.0"
  8. }
  9. version = properties("pluginVersion")
  10. group = properties("pluginGroup")
  11. repositories {
  12. mavenCentral()
  13. maven("https://jitpack.io")
  14. }
  15. dependencies {
  16. implementation("com.github.anas-elgarhy:alquran-cloud-api:0.4.1-v1")
  17. implementation("com.miglayout:miglayout-swing:11.0")
  18. // implementation("com.github.goxr3plus:java-stream-player:10.0.2")
  19. implementation("com.googlecode.soundlibs:jlayer:1.0.1.4")
  20. compileOnly("org.projectlombok:lombok:1.18.24")
  21. annotationProcessor("org.projectlombok:lombok:1.18.24")
  22. testImplementation("org.projectlombok:lombok:1.18.24")
  23. testAnnotationProcessor("org.projectlombok:lombok:1.18.24")
  24. }
  25. java {
  26. sourceCompatibility = JavaVersion.VERSION_17
  27. targetCompatibility = JavaVersion.VERSION_17
  28. }
  29. // Configure Gradle IntelliJ Plugin
  30. // Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
  31. intellij {
  32. pluginName.set(properties("pluginName"))
  33. version.set(properties("platformVersion"))
  34. type.set(properties("platformType"))
  35. plugins.set(listOf(/* Plugin Dependencies */))
  36. }
  37. tasks {
  38. // Set the JVM compatibility versions
  39. withType<JavaCompile> {
  40. options.encoding = "UTF-8"
  41. sourceCompatibility = "17"
  42. targetCompatibility = "17"
  43. }
  44. wrapper {
  45. gradleVersion = properties("gradleVersion")
  46. }
  47. patchPluginXml {
  48. version.set(properties("pluginVersion"))
  49. sinceBuild.set(properties("pluginSinceBuild"))
  50. untilBuild.set("")
  51. // Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
  52. pluginDescription.set(
  53. file("README.md").readText().lines().run {
  54. val start = "<!-- Plugin description -->"
  55. val end = "<!-- Plugin description end -->"
  56. if (!containsAll(listOf(start, end))) {
  57. throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
  58. }
  59. subList(indexOf(start) + 1, indexOf(end))
  60. }.joinToString("\n").let { markdownToHTML(it) }
  61. )
  62. // Get the latest available change notes from the changelog file
  63. changeNotes.set(provider {
  64. with(changelog) {
  65. renderItem(
  66. getOrNull(properties("pluginVersion")) ?: getLatest(),
  67. Changelog.OutputType.HTML,
  68. )
  69. }
  70. })
  71. }
  72. publishPlugin {
  73. dependsOn("patchChangelog")
  74. token.set(System.getenv("PUBLISH_TOKEN"))
  75. // pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
  76. // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
  77. // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
  78. channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
  79. }
  80. }