From fd9cbccb19945e94ffd818c0a43f8efdfd32959e Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Mon, 29 Jun 2015 17:59:23 +0200 Subject: [PATCH] bundle Kotlin plugin with IDEA, use bundled runtime from plugin --- .idea/libraries/KotlinJavaRuntime.xml | 7 +++-- README.md | 1 + build.xml | 1 + build/.gitignore | 1 + build/download_kotlin.xml | 37 +++++++++++++++++++++++++++ build/gant.xml | 2 +- build/scripts/layouts.gant | 5 ++++ build/scripts/libLicenses.gant | 1 + build/scripts/utils.gant | 17 ++++++++++++ lib/.gitignore | 2 ++ 10 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 build/download_kotlin.xml create mode 100644 lib/.gitignore diff --git a/.idea/libraries/KotlinJavaRuntime.xml b/.idea/libraries/KotlinJavaRuntime.xml index e89a0a33a6bb..54188de91d6e 100644 --- a/.idea/libraries/KotlinJavaRuntime.xml +++ b/.idea/libraries/KotlinJavaRuntime.xml @@ -1,11 +1,10 @@ - + + - - - + \ No newline at end of file diff --git a/README.md b/README.md index 2ce0a9819d8f..148813f1918e 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ### Building and Running from the IDE To develop IntelliJ IDEA, you can use either IntelliJ IDEA Community Edition or IntelliJ IDEA Ultimate. To build and run the code: * Run **getPlugins.sh** / **getPlugins.bat** from the project root directory to check out additional modules. +* Install the **Kotlin plugin** from the plugin manager (version 0.12.613). Parts of IntelliJ IDEA are written in Kotlin, and you need the plugin to compile the code. * Make sure you have the **Groovy** plugin enabled. Parts of IntelliJ IDEA are written in Groovy, and you will get compilation errors if you don't have the plugin enabled. * Make sure you have the **UI Designer** plugin enabled. Most of IntelliJ IDEA's UI is built using the **UI Designer**, and the version you build will not run correctly if you don't have the plugin enabled. * Open the project. diff --git a/build.xml b/build.xml index 8e6bdbcfa226..d4cd47e2fe3a 100644 --- a/build.xml +++ b/build.xml @@ -10,6 +10,7 @@ + diff --git a/build/.gitignore b/build/.gitignore index b6e2bc7704d0..39bb4e104911 100644 --- a/build/.gitignore +++ b/build/.gitignore @@ -1,2 +1,3 @@ /kotlinc/ /jdk/ +kotlin-plugin*.zip diff --git a/build/download_kotlin.xml b/build/download_kotlin.xml new file mode 100644 index 000000000000..36e0de7f21ba --- /dev/null +++ b/build/download_kotlin.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/gant.xml b/build/gant.xml index 349c59a23129..8a7460997353 100644 --- a/build/gant.xml +++ b/build/gant.xml @@ -24,7 +24,7 @@ - + diff --git a/build/scripts/layouts.gant b/build/scripts/layouts.gant index 7d8cc30070c0..31f0f876af5d 100644 --- a/build/scripts/layouts.gant +++ b/build/scripts/layouts.gant @@ -592,6 +592,10 @@ public def layoutCommunityPlugins(String home) { } } } + + pluginDir("Kotlin") { + fileset(dir: "${home}/build/kotlinc/plugin/Kotlin") + } } } @@ -692,6 +696,7 @@ def reorder(String home, String targetDirectory) { arg(value: "${home}/lib") classpath { projectBuilder.moduleRuntimeClasspath(findModule("util"), false).each { + println(it) pathelement(location: it) } } diff --git a/build/scripts/libLicenses.gant b/build/scripts/libLicenses.gant index 942c59cf0a37..e301961d8804 100644 --- a/build/scripts/libLicenses.gant +++ b/build/scripts/libLicenses.gant @@ -295,3 +295,4 @@ jetbrainsLibrary("JPS") jetbrainsLibrary("Maven Embedder") jetbrainsLibrary("tcServiceMessages") jetbrainsLibrary("optimizedFileManager.jar") +jetbrainsLibrary("KotlinJavaRuntime") diff --git a/build/scripts/utils.gant b/build/scripts/utils.gant index 1827cd54bda6..474b7c2a7e92 100644 --- a/build/scripts/utils.gant +++ b/build/scripts/utils.gant @@ -14,6 +14,8 @@ * limitations under the License. */ + + import com.intellij.openapi.util.SystemInfo import com.intellij.openapi.util.io.FileUtil import org.jetbrains.jps.gant.JpsGantTool @@ -24,6 +26,7 @@ import org.jetbrains.jps.model.java.JpsJavaExtensionService import org.jetbrains.jps.model.java.JpsJavaSdkType import org.jetbrains.jps.model.library.JpsOrderRootType import org.jetbrains.jps.model.module.JpsModule +import org.jetbrains.jps.model.serialization.JpsModelSerializationDataService includeTool << JpsGantTool @@ -134,6 +137,15 @@ binding.setVariable("guessHome", { binding.setVariable("loadProject", { defineJdk("IDEA jdk", setupJdkPath("jdkHome", "$home/build/jdk/1.6", "JDK_16_x64")) defineJdk("1.8", setupJdkPath("jdk8Home", "$home/build/jdk/1.8", "JDK_18_x64")) + def bundledKotlinPath = "$home/build/kotlinc" + if (!new File(bundledKotlinPath, "lib/kotlin-runtime.jar").exists()) { + bundledKotlinPath = "$home/community/build/kotlinc" + } + if (!new File(bundledKotlinPath, "lib/kotlin-runtime.jar").exists()) { + projectBuilder.error("Could not find Kotlin runtime at $bundledKotlinPath/lib/kotlin-runtime.jar") + return + } + setPathVariable("KOTLIN_BUNDLED", bundledKotlinPath) projectBuilder.buildIncrementally = Boolean.parseBoolean(p("jps.build.incrementally", "false")) def dataDirName = projectBuilder.buildIncrementally ? ".jps-incremental-build" : ".jps-build-data" projectBuilder.dataStorageRoot = new File("$home/$dataDirName") @@ -209,6 +221,11 @@ private void defineJdk(String jdkName, jdkHomePath) { } } +private void setPathVariable(String name, String value) { + def pathVars = JpsModelSerializationDataService.getOrCreatePathVariablesConfiguration(global) + pathVars.addPathVariable(name, value) +} + binding.setVariable("prepareOutputFolder", { def targetFolder = projectBuilder.buildIncrementally ? "$home/out/incremental-build" : out projectBuilder.targetFolder = targetFolder diff --git a/lib/.gitignore b/lib/.gitignore new file mode 100644 index 000000000000..0ca1c5c32bae --- /dev/null +++ b/lib/.gitignore @@ -0,0 +1,2 @@ +kotlin-runtime.jar +kotlin-reflect.jar