diff --git a/.gitignore b/.gitignore
index c7e0101d301..81527fbe025 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,6 +36,8 @@ build/
.idea/inspectionProfiles/profiles_settings.xml
.idea/.name
.idea/artifacts/dist_auto_*
+.idea/artifacts/ideaPlugin.xml
+.idea/artifacts/kotlin_plugin_jar.xml
kotlin-ultimate/
node_modules/
.rpt2_cache/
diff --git a/.idea/artifacts/ideaPlugin.xml b/.idea/artifacts/ideaPlugin.xml
deleted file mode 100644
index 7f3c100f3d2..00000000000
--- a/.idea/artifacts/ideaPlugin.xml
+++ /dev/null
@@ -1,215 +0,0 @@
-
-
- $PROJECT_DIR$/out/artifacts/ideaPlugin
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/artifacts/kotlin_plugin_jar.xml b/.idea/artifacts/kotlin_plugin_jar.xml
deleted file mode 100644
index 8ec87dd2a46..00000000000
--- a/.idea/artifacts/kotlin_plugin_jar.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
- $PROJECT_DIR$/out/artifacts/kotlin_plugin_jar
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/gradle/jps.gradle.kts b/gradle/jps.gradle.kts
index 5e09fd4a98c..2586ab83a1b 100644
--- a/gradle/jps.gradle.kts
+++ b/gradle/jps.gradle.kts
@@ -150,4 +150,99 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
}
}
}
+
+ project(":prepare:idea-plugin").afterEvaluate {
+ val embedded by configurations
+ val libraries by configurations
+ val jpsPlugin by configurations
+
+ rootProject.idea {
+ project {
+ settings {
+ ideArtifacts {
+ create("kotlin-plugin.jar") {
+ archive("kotlin-plugin.jar") {
+ directory("META-INF") {
+ file("$buildDir/tmp/jar/MANIFEST.MF")
+ }
+
+ jarFromConfiguration(embedded)
+ }
+ }
+
+ create("ideaPlugin") {
+ directory("Kotlin") {
+ directory("kotlinc") {
+ artifact("kotlinc")
+ }
+
+ directory("lib") {
+ artifact("kotlin-plugin.jar")
+
+ directoryFromConfiguration(libraries)
+
+ directory("jps") {
+ directoryFromConfiguration(jpsPlugin)
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+val jarArtifactProjects = listOf(
+ "kotlin-compiler-client-embeddable",
+ "kotlin-compiler",
+ "kotlin-daemon-client",
+ "kotlin-imports-dumper-compiler-plugin",
+ "kotlin-jps-plugin",
+ "kotlin-main-kts",
+ "kotlin-reflect"
+)
+
+fun moduleName(projectPath: String) = rootProject.name + projectPath.replace(':', '.') + ".main"
+
+fun RecursiveArtifact.jarFromConfiguration(configuration: Configuration) {
+ val resolvedArtifacts = configuration
+ .resolvedConfiguration
+ .resolvedArtifacts
+
+ resolvedArtifacts.filter { it.id.componentIdentifier is ModuleComponentIdentifier }
+ .map { it.file }
+ .forEach(::extractedDirectory)
+
+ resolvedArtifacts
+ .map { it.id.componentIdentifier }
+ .filterIsInstance()
+ .forEach {
+ moduleOutput(moduleName(it.projectPath))
+ }
+}
+
+fun RecursiveArtifact.directoryFromConfiguration(configuration: Configuration) {
+ val resolvedArtifacts = configuration
+ .resolvedConfiguration
+ .resolvedArtifacts
+
+ resolvedArtifacts.filter { it.id.componentIdentifier is ModuleComponentIdentifier }
+ .map { it.file }
+ .forEach(::file)
+
+ resolvedArtifacts
+ .map { it.id.componentIdentifier }
+ .filterIsInstance()
+ .forEach {
+ val artifactName = it.projectName + ".jar"
+ if (it.projectName in jarArtifactProjects) {
+ artifact(artifactName)
+ } else {
+ archive(artifactName) {
+ moduleOutput(moduleName(it.projectPath))
+ }
+ }
+ }
}
\ No newline at end of file