* Run **getPlugins.sh** / **getPlugins.bat** from the project root directory to check out additional modules.
* 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
-* Configure a JSDK named "**IDEA jdk**" (case sensitive), pointing to an installation of JDK 1.6
+* Open the project.
+* Configure a JSDK named "**IDEA jdk**" (case sensitive), pointing to an installation of JDK 1.6.
* Unless you're running on a Mac with an Apple JDK, add <JDK_HOME>/lib/tools.jar to the set of "**IDEA jdk**" jars.
+* Configure a JSDK named "**1.8**", pointing to an installation of JDK 1.8.
+* Add <JDK_18_HOME>/lib/tools.jar to the set of "**1.8**" jars.
* Use Build | Make Project to build the code.
* To run the code, use the provided shared run configuration "**IDEA**".
depends([compile])
def classpathFile = "$home/junit.classpath"
- List<String> testRuntimeClasspath = projectBuilder.moduleRuntimeClasspath(findModule("community-main"), true)
+ //todo[nik] currently runtime classpath includes path to JDKs from all modules in it so we need to manually exclude paths from JDK 1.6
+ List<String> testRuntimeClasspath = removeJdkJarFiles(projectBuilder.moduleRuntimeClasspath(findModule("community-main"), true))
+ testRuntimeClasspath << "${jdk8Home}/lib/tools.jar"
+ projectBuilder.info("Test runtime classpath=" + testRuntimeClasspath)
new File(classpathFile).text = testRuntimeClasspath.findAll({ new File((String)it).exists() }).join('\n')
+ List<String> bootstrapClasspath = removeJdkJarFiles(projectBuilder.moduleRuntimeClasspath(findModule("tests_bootstrap"), false))
+ bootstrapClasspath << "${jdk8Home}/lib/tools.jar"
+ projectBuilder.info("Bootstrap classpath=" + bootstrapClasspath)
+
testcases.each { testCase ->
List<String> jvmArgs = [
"-Dclasspath.file=${classpathFile}",
}
classpath {
- projectBuilder.moduleRuntimeClasspath(findModule("tests_bootstrap"), false).each {
+ bootstrapClasspath.each {
pathelement(location: it)
}
- pathelement(location: "${jdkHome}/lib/tools.jar")
}
test(name: 'com.intellij.tests.BootstrapTests')
* limitations under the License.
*/
-
+import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.util.io.FileUtil
import org.jetbrains.jps.gant.JpsGantTool
import org.jetbrains.jps.gant.TeamCityBuildInfoPrinter
import org.jetbrains.jps.model.java.JavaSourceRootType
+import org.jetbrains.jps.model.java.JdkVersionDetector
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
includeTool << JpsGantTool
})
binding.setVariable("loadProject", {
- requireProperty("jdkHome", guessJdk())
- def mac = isMac()
- jdk("IDEA jdk", jdkHome) {
- if (!mac) {
- classpath "$jdkHome/lib/tools.jar"
- }
- }
+ 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"))
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")
compilerOptions.ADDITIONAL_OPTIONS_STRING = compilerOptions.ADDITIONAL_OPTIONS_STRING.replace("-Xlint:unchecked", "")
})
+binding.setVariable("removeJdkJarFiles", { Collection<String> classpath ->
+ def jdkHomePaths = project.model.global.libraryCollection.getLibraries(JpsJavaSdkType.INSTANCE).collect {
+ def homeDir = new File(it.properties.homePath)
+ return SystemInfo.isMac && homeDir.name == "Home" ? homeDir.parent : homeDir.absolutePath
+ }
+ return classpath.findAll { jarPath -> jdkHomePaths.every { !FileUtil.isAncestor(it, jarPath, false) } }
+})
+
+private String setupJdkPath(String propertyName, String defaultDir, String envVarName) {
+ try {
+ this[propertyName]
+ }
+ catch (MissingPropertyException ignored) {
+ def jdk = SystemInfo.isMac ? "$defaultDir/Home" : defaultDir
+ if (new File(jdk).exists()) {
+ projectBuilder.info("$propertyName set to $jdk")
+ }
+ else {
+ jdk = System.getenv(envVarName)
+ if (jdk != null) {
+ projectBuilder.info("'$defaultDir' doesn't exist, $propertyName set to '$envVarName' environment variable: $jdk")
+ }
+ else {
+ jdk = guessJdk()
+ def version = JdkVersionDetector.instance.detectJdkVersion(jdk)
+ if (propertyName.contains("8") && !version.contains("1.8.")) {
+ projectBuilder.error("JDK 1.8 is required to compile the project, but '$propertyName' property and '$envVarName' environment variable aren't defined and default JDK $jdk ($version) cannot be used as JDK 1.8")
+ return null
+ }
+ projectBuilder.info("'$envVarName' isn't defined and '$defaultDir' doesn't exist, $propertyName set to $jdk")
+ }
+ }
+ this[propertyName] = jdk
+ return jdk
+ }
+}
+
+private void defineJdk(String jdkName, jdkHomePath) {
+ jdk(jdkName, jdkHomePath) {
+ def toolsJar = "$jdkHomePath/lib/tools.jar"
+ if (new File(toolsJar).exists()) {
+ classpath toolsJar
+ }
+ }
+
+ if (SystemInfo.isMac) {
+ //temporary workaround for Mac: resolve symlinks manually. Previously ZipFileCache used FileUtil.toCanonicalPath method which doesn't resolve symlinks.
+ def jdk = global.libraryCollection.findLibrary(jdkName, JpsJavaSdkType.INSTANCE)
+ def jdkClasspath = jdk.getFiles(JpsOrderRootType.COMPILED)
+ def urls = jdk.getRootUrls(JpsOrderRootType.COMPILED)
+ urls.each { jdk.removeUrl(it, JpsOrderRootType.COMPILED) }
+ jdkClasspath.each {
+ try {
+ jdk.addRoot(it.getCanonicalFile(), JpsOrderRootType.COMPILED)
+ }
+ catch (IOException ignored) {
+ }
+ }
+ projectBuilder.info("JDK '$jdkName' classpath: ${jdk.getFiles(JpsOrderRootType.COMPILED)}")
+ }
+}
+
binding.setVariable("prepareOutputFolder", {
def targetFolder = projectBuilder.buildIncrementally ? "$home/out/incremental-build" : out
projectBuilder.targetFolder = targetFolder
})
def debugPort = System.getProperty("debug.port")
-def debugSuspend = System.getProperty("debug.suspend") ?: "n"
+def debugSuspend = System.getProperty("rи") ?: "n"
if (debugSuspend == 'y') {
println """