2
0

build.gradle.kts 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. @file:Suppress("PropertyName")
  2. plugins {
  3. `kotlin-dsl`
  4. alias(libs.plugins.kotlin.multiplatform) apply false
  5. }
  6. repositories {
  7. mavenLocal()
  8. gradlePluginPortal()
  9. mavenCentral()
  10. maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
  11. maven("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental")
  12. maven("https://androidx.dev/storage/compose-compiler/repository")
  13. maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
  14. maven("https://gitlab.com/api/v4/projects/38224197/packages/maven")
  15. maven("https://oss.sonatype.org/content/repositories/snapshots")
  16. maven("https://jogamp.org/deployment/maven")
  17. maven("https://jitpack.io")
  18. maven("https://maven.mozilla.org/maven2/")
  19. maven("https://maven.pkg.github.com/tuProlog/2p-kt")
  20. maven("https://dl.bintray.com/animeshz/maven")
  21. maven("https://plugins.gradle.org/m2/")
  22. maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
  23. maven("https://dl.bintray.com/kotlin/ktor")
  24. maven("https://central.sonatype.com/repository/maven-snapshots")
  25. // google {
  26. // mavenContent {
  27. // includeGroupAndSubgroups("androidx")
  28. // includeGroupAndSubgroups("com.android")
  29. // includeGroupAndSubgroups("com.google")
  30. // }
  31. // }
  32. google()
  33. }
  34. dependencies {
  35. implementation(gradleApi())
  36. implementation(gradleKotlinDsl())
  37. compileOnly(libs.gradle)
  38. compileOnly(libs.gradle.api)
  39. compileOnly(libs.gradle.kotlin.plugin)
  40. }
  41. gradlePlugin {
  42. plugins {
  43. register("MultiPlatformPlugin") {
  44. id = "MultiPlatformPlugin"
  45. displayName = "MultiPlatformPlugin"
  46. description = "Common library plugin to handle all stuffs needed."
  47. implementationClass = "MultiPlatformPlugin"
  48. }
  49. register("AiAgentPlugin") {
  50. id = "AiAgentPlugin"
  51. displayName = "AiAgentPlugin"
  52. description = "Runs file-driven AI tasks (runAiAgent) with pluggable providers: ollama, claude-code, mistral."
  53. implementationClass = "ai.AiAgentPlugin"
  54. }
  55. }
  56. }
  57. val FOLDER_BUILD = "build"
  58. val FOLDER_DISTRIBUTION = "distribution"
  59. val PLUGIN_FILE_NAME = "plugin.zip"
  60. val TASK_GROUP = "mjdev"
  61. val TASK_BUILD_PLUGIN = "installPlugin"
  62. val PROJECT_IDE_PLUGIN = "studio-plugin"
  63. val DEPENDENCY_BUILD_SRC = ":$PROJECT_IDE_PLUGIN:$TASK_BUILD_PLUGIN"
  64. fun Task.execute(
  65. action: Action<ExecSpec>
  66. ) = project.providers.exec(action)
  67. val Task.pluginProject
  68. get() = project.rootProject.project(PROJECT_IDE_PLUGIN)
  69. val Task.pluginDistributionFile
  70. get() = "${pluginProject.path}/$FOLDER_BUILD/$FOLDER_DISTRIBUTION/$PLUGIN_FILE_NAME"
  71. tasks {
  72. // clean task enhancement
  73. clean.configure {
  74. delete(FOLDER_BUILD)
  75. }
  76. // build {
  77. // finalizedBy(TASK_BUILD_PLUGIN)
  78. // }
  79. register(TASK_BUILD_PLUGIN) {
  80. group = TASK_GROUP
  81. description = "Builds and installs the IDEA plugin."
  82. doLast {
  83. println("Installing IDEA plugin...")
  84. val pluginFile = file(pluginDistributionFile)
  85. if (pluginFile.exists()) {
  86. providers.exec {
  87. commandLine(
  88. "idea.sh",
  89. "installPlugins",
  90. pluginFile.absolutePath
  91. )
  92. }
  93. println("Plugin installed successfully.")
  94. } else {
  95. println("Plugin file not found: $pluginDistributionFile")
  96. }
  97. }
  98. }
  99. }