Skip to content

Commit 9d6f4d7

Browse files
Alexey AndreevAlexey Andreev
authored andcommitted
JS: don't treat library without JS metadata as error, report warning and continue instead. See KT-16158
1 parent ffca68d commit 9d6f4d7

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

compiler/cli/src/org/jetbrains/kotlin/cli/js/K2JSCompiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public void error(@NotNull String message) {
146146

147147
@Override
148148
public void warning(@NotNull String message) {
149-
messageCollector.report(CompilerMessageSeverity.WARNING, message, CompilerMessageLocation.NO_LOCATION);
149+
messageCollector.report(CompilerMessageSeverity.STRONG_WARNING, message, CompilerMessageLocation.NO_LOCATION);
150150
}
151151
})) {
152152
return COMPILATION_ERROR;
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1-
error: 'compiler/testData/integration/ant/js/simpleWithStdlibAndFolderAsAnotherLib' is not a valid Kotlin Javascript library
2-
COMPILATION_ERROR
1+
warning: 'compiler/testData/integration/ant/js/simpleWithStdlibAndFolderAsAnotherLib' is not a valid Kotlin Javascript library
2+
compiler/testData/cli/js/withLib.kt:2:8: error: unresolved reference: library
3+
import library.sample.*
4+
^
5+
compiler/testData/cli/js/withLib.kt:6:13: error: unresolved reference: pairAdd
6+
val x = pairAdd(p)
7+
^
8+
COMPILATION_ERROR

js/js.frontend/src/org/jetbrains/kotlin/js/config/LibrarySourcesConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ private boolean checkLibFilesAndReportErrors(@NotNull JsConfig.Reporter report,
146146
else {
147147
List<KotlinJavascriptMetadata> metadataList = KotlinJavascriptMetadataUtils.loadMetadata(filePath);
148148
if (metadataList.isEmpty()) {
149-
report.error("'" + path + "' is not a valid Kotlin Javascript library");
150-
return true;
149+
report.warning("'" + path + "' is not a valid Kotlin Javascript library");
150+
continue;
151151
}
152152

153153
for (KotlinJavascriptMetadata metadata : metadataList) {

0 commit comments

Comments
 (0)