build.gradle.kts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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.16.0"
  7. id("org.jetbrains.changelog") version "2.2.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.5")
  17. implementation("com.miglayout:miglayout-swing:11.2")
  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.30")
  21. annotationProcessor("org.projectlombok:lombok:1.18.30")
  22. testImplementation("org.projectlombok:lombok:1.18.30")
  23. testAnnotationProcessor("org.projectlombok:lombok:1.18.30")
  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")
  61. .replace("./assets/", "https://raw.githubusercontent.com/anas-elgarhy/Ayah-intellij/master/assets/")
  62. .let { markdownToHTML(it) }
  63. )
  64. // Get the latest available change notes from the changelog file
  65. changeNotes.set(provider {
  66. with(changelog) {
  67. renderItem(
  68. getOrNull(properties("pluginVersion")) ?: getLatest(),
  69. Changelog.OutputType.HTML,
  70. )
  71. }
  72. })
  73. }
  74. publishPlugin {
  75. dependsOn("patchChangelog", "patchPluginXml")
  76. token.set(System.getenv("PUBLISH_TOKEN"))
  77. // pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
  78. // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
  79. // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
  80. channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
  81. }
  82. }