From 56d3f90a02423cb1dc58926a4975d2b6c2da44ed Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 11 Apr 2017 15:17:16 +0300 Subject: [PATCH] Don't log content of module.xml when Logger is not initialized When Logger is not initialized it returns default logger which prints to stdout and stderr, so it can lead to different results when run CLI tests locally and on TC. --- .../jvm/compiler/CompileEnvironmentUtil.java | 2 +- .../cli/jvm/nonexistentPathInModule.out | 22 ------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CompileEnvironmentUtil.java b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CompileEnvironmentUtil.java index ca09d542ccc..d63f31eba10 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CompileEnvironmentUtil.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/CompileEnvironmentUtil.java @@ -169,7 +169,7 @@ public class CompileEnvironmentUtil { String message = "Source file or directory not found: " + sourceRootPath; File moduleFilePath = configuration.get(JVMConfigurationKeys.MODULE_XML_FILE); - if (moduleFilePath != null) { + if (moduleFilePath != null && Logger.isInitialized()) { String moduleFileContent = FileUtil.loadFile(moduleFilePath); LOG.warn(message + "\n\nmodule file path: " + moduleFilePath + diff --git a/compiler/testData/cli/jvm/nonexistentPathInModule.out b/compiler/testData/cli/jvm/nonexistentPathInModule.out index 1bb449f0e60..56f17b9ff22 100644 --- a/compiler/testData/cli/jvm/nonexistentPathInModule.out +++ b/compiler/testData/cli/jvm/nonexistentPathInModule.out @@ -1,25 +1,3 @@ -WARN: Source file or directory not found: $TESTDATA_DIR$/nonexistentFile.kt - -module file path: compiler/testData/cli/jvm/nonexistentPathInModule.xml -content: - - - - - - - -WARN: Source file or directory not found: $TESTDATA_DIR$/some/nonexistent/dir - -module file path: compiler/testData/cli/jvm/nonexistentPathInModule.xml -content: - - - - - - - error: source file or directory not found: $TESTDATA_DIR$/nonexistentFile.kt error: source file or directory not found: $TESTDATA_DIR$/some/nonexistent/dir COMPILATION_ERROR