Do not attach script report if they didn't changed
This commit is contained in:
+10
-6
@@ -67,12 +67,14 @@ abstract class ScriptDependenciesLoader(
|
|||||||
protected val contentLoader = ScriptContentLoader(project)
|
protected val contentLoader = ScriptContentLoader(project)
|
||||||
protected val cache: ScriptDependenciesCache = ServiceManager.getService(project, ScriptDependenciesCache::class.java)
|
protected val cache: ScriptDependenciesCache = ServiceManager.getService(project, ScriptDependenciesCache::class.java)
|
||||||
|
|
||||||
|
private val reporter: ScriptReportSink = ServiceManager.getService(project, ScriptReportSink::class.java)
|
||||||
|
|
||||||
protected fun processResult(result: DependenciesResolver.ResolveResult) {
|
protected fun processResult(result: DependenciesResolver.ResolveResult) {
|
||||||
loaders.remove(file)
|
loaders.remove(file)
|
||||||
|
|
||||||
if (cache[file] == null) {
|
if (cache[file] == null) {
|
||||||
saveDependencies(result)
|
saveDependencies(result)
|
||||||
attachReports(result)
|
attachReportsIfChanged(result)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,14 +83,14 @@ abstract class ScriptDependenciesLoader(
|
|||||||
if (shouldShowNotification() && !ApplicationManager.getApplication().isUnitTestMode) {
|
if (shouldShowNotification() && !ApplicationManager.getApplication().isUnitTestMode) {
|
||||||
file.addScriptDependenciesNotificationPanel(result, project) {
|
file.addScriptDependenciesNotificationPanel(result, project) {
|
||||||
saveDependencies(it)
|
saveDependencies(it)
|
||||||
attachReports(it)
|
attachReportsIfChanged(it)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
saveDependencies(result)
|
saveDependencies(result)
|
||||||
attachReports(result)
|
attachReportsIfChanged(result)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
attachReports(result)
|
attachReportsIfChanged(result)
|
||||||
|
|
||||||
if (shouldShowNotification()) {
|
if (shouldShowNotification()) {
|
||||||
file.removeScriptDependenciesNotificationPanel(project)
|
file.removeScriptDependenciesNotificationPanel(project)
|
||||||
@@ -96,8 +98,10 @@ abstract class ScriptDependenciesLoader(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun attachReports(result: DependenciesResolver.ResolveResult) {
|
private fun attachReportsIfChanged(result: DependenciesResolver.ResolveResult) {
|
||||||
ServiceManager.getService(project, ScriptReportSink::class.java)?.attachReports(file, result.reports)
|
if (file.getUserData(IdeScriptReportSink.Reports) != result.reports.takeIf { it.isNotEmpty() }) {
|
||||||
|
reporter.attachReports(file, result.reports)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun saveDependencies(result: DependenciesResolver.ResolveResult) {
|
private fun saveDependencies(result: DependenciesResolver.ResolveResult) {
|
||||||
|
|||||||
Reference in New Issue
Block a user