build.gradle.kts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
  2. import org.jetbrains.intellij.platform.gradle.TestFrameworkType
  3. fun properties(key: String) = project.findProperty(key).toString()
  4. // read local workspace file to string
  5. val localChangeNotes: String = file("${projectDir}/change-notes.html").readText(Charsets.UTF_8)
  6. val localDescription: String = file("${projectDir}/description.html").readText(Charsets.UTF_8)
  7. plugins {
  8. id("java")
  9. id("org.jetbrains.intellij.platform") version "2.7.2"
  10. id("org.jetbrains.kotlin.jvm") version "2.1.0"
  11. id("org.jetbrains.changelog") version "2.2.0"
  12. kotlin("plugin.serialization") version "2.1.0"
  13. }
  14. group = "io.xmake"
  15. repositories {
  16. maven("https://maven.aliyun.com/repository/public/")
  17. maven("https://oss.sonatype.org/content/repositories/snapshots/")
  18. mavenLocal()
  19. mavenCentral()
  20. gradlePluginPortal()
  21. intellijPlatform {
  22. defaultRepositories()
  23. }
  24. }
  25. intellijPlatform {
  26. pluginConfiguration {
  27. version = properties("pluginVersion")
  28. changeNotes = localChangeNotes
  29. description = localDescription
  30. ideaVersion {
  31. sinceBuild = properties("pluginSinceBuild")
  32. }
  33. }
  34. pluginVerification {
  35. ides {
  36. select {
  37. types = listOf(
  38. IntelliJPlatformType.CLion,
  39. )
  40. sinceBuild = properties("pluginSinceBuild")
  41. }
  42. }
  43. }
  44. }
  45. tasks {
  46. test {
  47. useJUnit()
  48. include("io/xmake/**/**")
  49. }
  50. }
  51. dependencies {
  52. implementation("org.jetbrains.kotlin:kotlin-stdlib:2.1.0")
  53. implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")
  54. testImplementation("io.mockk:mockk:1.13.12")
  55. testImplementation("junit:junit:4.13.2")
  56. intellijPlatform {
  57. clion(properties("runIdeVersion"))
  58. testFramework(TestFrameworkType.Platform)
  59. }
  60. }
  61. val Project.dependencyCachePath
  62. get(): String {
  63. val cachePath = file("${rootProject.projectDir}/deps")
  64. if (!cachePath.exists()) {
  65. cachePath.mkdirs()
  66. }
  67. return cachePath.absolutePath
  68. }