mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 08:06:56 +07:00
transition to Java 8: some test modules configured to use JDK 8, build scripts updated
This commit is contained in:
1
.idea/compiler.xml
generated
1
.idea/compiler.xml
generated
@@ -44,6 +44,7 @@
|
||||
<module name="jps-model-impl" target="1.6" />
|
||||
<module name="jps-model-serialization" target="1.6" />
|
||||
<module name="jps-standalone-builder" target="1.6" />
|
||||
<module name="json-tests" target="1.8"/>
|
||||
<module name="junit_rt" target="1.3" />
|
||||
<module name="maven-jps-plugin" target="1.6" />
|
||||
<module name="remote-servers-agent-rt" target="1.5" />
|
||||
|
||||
@@ -4,9 +4,11 @@ To develop IntelliJ IDEA, you can use either IntelliJ IDEA Community Edition or
|
||||
* 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**".
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/restApiDocGenerator/node_modules" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="Groovy" level="project" />
|
||||
<orderEntry type="library" exported="" name="Ant" level="project" />
|
||||
|
||||
@@ -45,9 +45,16 @@ target('run_tests': 'Run java tests') {
|
||||
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}",
|
||||
@@ -82,10 +89,9 @@ target('run_tests': 'Run java tests') {
|
||||
}
|
||||
|
||||
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')
|
||||
|
||||
@@ -14,12 +14,15 @@
|
||||
* 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
|
||||
@@ -129,13 +132,8 @@ binding.setVariable("guessHome", {
|
||||
})
|
||||
|
||||
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")
|
||||
@@ -149,6 +147,68 @@ binding.setVariable("loadProject", {
|
||||
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
|
||||
@@ -210,7 +270,7 @@ binding.setVariable("notifyArtifactBuilt", { String artifactPath ->
|
||||
})
|
||||
|
||||
def debugPort = System.getProperty("debug.port")
|
||||
def debugSuspend = System.getProperty("debug.suspend") ?: "n"
|
||||
def debugSuspend = System.getProperty("rи") ?: "n"
|
||||
if (debugSuspend == 'y') {
|
||||
println """
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="annotations" />
|
||||
<orderEntry type="module" module-name="ant" />
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/testData" type="java-test-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="testFramework" scope="TEST" />
|
||||
<orderEntry type="module" module-name="json" scope="TEST" />
|
||||
|
||||
Reference in New Issue
Block a user