JS DCE: disable logging by default
Based on Vladislav Saifulin's PR #4031
This commit is contained in:
@@ -76,16 +76,23 @@ class K2JSDce : CLITool<K2JSDceArguments>() {
|
||||
messageCollector.report(severity, message)
|
||||
}
|
||||
|
||||
val dceResult = DeadCodeElimination.run(files, includedDeclarations, logConsumer)
|
||||
val dceResult = DeadCodeElimination.run(
|
||||
files,
|
||||
includedDeclarations,
|
||||
arguments.printReachabilityInfo,
|
||||
logConsumer
|
||||
)
|
||||
if (dceResult.status == DeadCodeEliminationStatus.FAILED) return ExitCode.COMPILATION_ERROR
|
||||
|
||||
val reachabilitySeverity = if (arguments.printReachabilityInfo) CompilerMessageSeverity.INFO else CompilerMessageSeverity.LOGGING
|
||||
messageCollector.report(reachabilitySeverity, "")
|
||||
for (node in dceResult.reachableNodes.extractReachableRoots(dceResult.context!!)) {
|
||||
printTree(
|
||||
node, { messageCollector.report(reachabilitySeverity, it) },
|
||||
printNestedMembers = false, showLocations = true
|
||||
)
|
||||
if (arguments.printReachabilityInfo) {
|
||||
val reachabilitySeverity = CompilerMessageSeverity.INFO
|
||||
messageCollector.report(reachabilitySeverity, "")
|
||||
for (node in dceResult.reachableNodes.extractReachableRoots(dceResult.context!!)) {
|
||||
printTree(
|
||||
node, { messageCollector.report(reachabilitySeverity, it) },
|
||||
printNestedMembers = false, showLocations = true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return ExitCode.OK
|
||||
|
||||
Reference in New Issue
Block a user