From 27ac32708968ea84e1c53c84fa6e93702e62649a Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 18 Feb 2015 21:20:48 +0300 Subject: [PATCH] external build: corrected check for internal JDK, excessive logging removed --- .../compiler/server/BuildManager.java | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java index 5ffd19125a8c..9ceffac57eb4 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java @@ -901,14 +901,8 @@ public class BuildManager implements ApplicationComponent{ // now select the latest version from the sdks that are used in the project, but not older than the internal sdk version final JavaSdk javaSdkType = JavaSdk.getInstance(); - if (IS_UNIT_TEST_MODE) { - LOG.info("detecting JDK"); - } for (Sdk candidate : candidates) { final String vs = candidate.getVersionString(); - if (IS_UNIT_TEST_MODE) { - LOG.info(" candidate=" + candidate); - } if (vs != null) { final JavaSdkVersion candidateVersion = javaSdkType.getVersion(vs); if (candidateVersion != null) { @@ -931,32 +925,22 @@ public class BuildManager implements ApplicationComponent{ } final Sdk internalJdk = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk(); - if (IS_UNIT_TEST_MODE) { - LOG.info("projectJdk = " + projectJdk); - LOG.info("internalJdk = " + internalJdk); - } if (projectJdk == null || sdkVersion == null || !sdkVersion.isAtLeast(JavaSdkVersion.JDK_1_6)) { projectJdk = internalJdk; } // validate tools.jar presence final JavaSdkType projectJdkType = (JavaSdkType)projectJdk.getSdkType(); - if (projectJdk.equals(internalJdk)) { + if (FileUtil.pathsEqual(projectJdk.getHomePath(), internalJdk.getHomePath())) { // important: because internal JDK can be either JDK or JRE, // this is the most universal way to obtain tools.jar path in this particular case final JavaCompiler systemCompiler = ToolProvider.getSystemJavaCompiler(); if (systemCompiler == null) { throw new ExecutionException("No system java compiler is provided by the JRE. Make sure tools.jar is present in IntelliJ IDEA classpath."); } - if (IS_UNIT_TEST_MODE) { - LOG.info("compute compiler path by jar for " + systemCompiler.getClass()); - } compilerPath = ClasspathBootstrap.getResourcePath(systemCompiler.getClass()); } else { - if (IS_UNIT_TEST_MODE) { - LOG.info("compute compiler path from jdk " + projectJdk + ", jdk home = " + projectJdk.getHomePath()); - } compilerPath = projectJdkType.getToolsPath(projectJdk); if (compilerPath == null) { throw new ExecutionException("Cannot determine path to 'tools.jar' library for " + projectJdk.getName() + " (" + projectJdk.getHomePath() + ")"); @@ -966,15 +950,10 @@ public class BuildManager implements ApplicationComponent{ vmExecutablePath = projectJdkType.getVMExecutablePath(projectJdk); } else { - if (IS_UNIT_TEST_MODE) { - LOG.info("use forced jdk home " + forcedCompiledJdkHome); - } compilerPath = new File(forcedCompiledJdkHome, "lib/tools.jar").getAbsolutePath(); vmExecutablePath = new File(forcedCompiledJdkHome, "bin/java").getAbsolutePath(); } - if (IS_UNIT_TEST_MODE) { - LOG.info("compilerPath=" + compilerPath); - } + final CompilerWorkspaceConfiguration config = CompilerWorkspaceConfiguration.getInstance(project); final GeneralCommandLine cmdLine = new GeneralCommandLine(); cmdLine.setExePath(vmExecutablePath);