line separators normalized cidr/124.191 pycharm/124.193 rubymine/124.194 storm/124.189
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Sat, 8 Dec 2012 19:01:21 +0000 (20:01 +0100)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Sat, 8 Dec 2012 19:01:21 +0000 (20:01 +0100)
320 files changed:
.idea/libraries/Ant.xml
.idea/libraries/Netty.xml
.idea/libraries/Snappy_Java.xml
.idea/libraries/proxy_vole.xml
README.md
RegExpSupport/test/test/MainParseTest.java
build.txt
images/src/META-INF/ImagesPlugin.xml
java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
java/compiler/impl/src/com/intellij/compiler/options/CompilerOptionsPanel.form
java/compiler/impl/src/com/intellij/compiler/options/CompilerUIConfigurable.java
java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRunTaskProvider.java
java/compiler/openapi/src/com/intellij/compiler/CompilerWorkspaceConfiguration.java
java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java
java/java-impl/src/com/intellij/codeInsight/completion/ConstructorInsertHandler.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameCompletionContributor.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionFeatures.java
java/java-impl/src/com/intellij/codeInsight/completion/JavaStaticMemberProcessor.java
java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DefaultQuickFixProvider.java
java/java-impl/src/com/intellij/codeInsight/intention/impl/BreakStringOnLineBreaksIntentionAction.java
java/java-impl/src/com/intellij/codeInsight/navigation/JavaGotoSuperHandler.java
java/java-impl/src/com/intellij/codeInspection/defaultFileTemplateUsage/FileHeaderChecker.java
java/java-impl/src/com/intellij/codeInspection/internal/FileEqualsUsageInspection.java
java/java-impl/src/com/intellij/psi/filters/getters/JavaMembersGetter.java
java/java-impl/src/com/intellij/psi/formatter/java/AbstractJavaBlock.java
java/java-impl/src/com/intellij/psi/formatter/java/LeafBlock.java
java/java-impl/src/com/intellij/psi/formatter/java/SimpleJavaBlock.java
java/java-impl/src/com/intellij/psi/impl/JavaRegExpHost.java
java/java-impl/src/com/intellij/psi/impl/file/JavaDirectoryServiceImpl.java
java/java-impl/src/com/intellij/psi/util/CreateClassUtil.java
java/java-impl/src/com/intellij/refactoring/changeSignature/JavaMethodDescriptor.java
java/java-impl/src/com/intellij/refactoring/rename/RenameJavaMethodProcessor.java
java/java-impl/src/com/intellij/refactoring/ui/JavaComboBoxVisibilityPanel.java
java/java-impl/src/com/intellij/refactoring/ui/JavaVisibilityPanel.java
java/java-indexing-api/src/com/intellij/psi/search/searches/OverridingMethodsSearch.java
java/java-indexing-impl/src/com/intellij/psi/impl/search/JavaOverridingMethodsSearcher.java
java/java-indexing-impl/src/com/intellij/psi/impl/search/MethodSuperSearcher.java
java/java-psi-api/src/com/intellij/psi/codeStyle/JavaCodeStyleManager.java
java/java-psi-api/src/com/intellij/psi/search/searches/SuperMethodsSearch.java
java/java-psi-impl/src/com/intellij/core/CoreJavaCodeStyleManager.java
java/java-psi-impl/src/com/intellij/psi/impl/FindSuperElementsHelper.java
java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiLiteralExpressionImpl.java
java/java-tests/testData/codeInsight/completion/keywords/returnInTernary.java
java/java-tests/testData/codeInsight/completion/normalSorting/PreferLocalsToStaticsInSecondCompletion.java
java/java-tests/testData/codeInsight/completion/normalSorting/PreselectMostRelevantInTheMiddleAlpha.java
java/java-tests/testData/codeInsight/completion/normalSorting/UnderscoresDontMakeMatchMiddle.java
java/java-tests/testData/codeInsight/completion/smartType/DiamondNotCollapsedInCaseOfAnonymousClasses-out.java
java/java-tests/testData/codeInsight/completion/smartType/ExpectedReturnTypeWithSubstitution-out.java
java/java-tests/testData/codeInsight/completion/smartType/NewAnonymousFunction-out.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/breakStringOnLineBreaks/afterAll.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/breakStringOnLineBreaks/beforeAll.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/breakStringOnLineBreaks/beforeLastSlashN.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/breakStringOnLineBreaks/beforeLastSlashNSlashR.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convertColorRepresentation/after2Bytes.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convertColorRepresentation/before2Bytes.java
java/java-tests/testSrc/com/intellij/codeInsight/completion/ClassNameCompletionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/completion/CompletionSortingTestCase.java
java/java-tests/testSrc/com/intellij/codeInsight/completion/GlobalMemberNameCompletionTest.groovy
java/java-tests/testSrc/com/intellij/codeInsight/completion/HeavyNormalCompletionTest.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/BreakStringOnLineBreaksTest.java
java/testFramework/src/com/intellij/codeInsight/completion/CompletionTestCase.java
java/testFramework/src/com/intellij/codeInsight/completion/LightCompletionTestCase.java
jps/jps-builders/src/org/jetbrains/jps/javac/JavacFileManager.java
jps/jps-builders/src/org/jetbrains/jps/javac/OutputFileObject.java
jps/jps-builders/testSrc/org/jetbrains/ether/LogParser.java
license/kryo-license.txt
platform/core-api/src/com/intellij/openapi/application/AccessToken.java
platform/core-api/src/com/intellij/psi/stubs/StubSerializationHelper.java
platform/core-impl/src/com/intellij/mock/MockProject.java
platform/core-impl/src/com/intellij/openapi/application/impl/ModalityStateEx.java
platform/core-impl/src/com/intellij/openapi/editor/ex/util/SegmentArrayWithData.java
platform/core-impl/src/com/intellij/psi/impl/source/tree/CompositeElement.java
platform/funcTests/config/options/feature.usage.statistics.xml
platform/lang-api/src/com/intellij/codeInsight/completion/CompletionParameters.java
platform/lang-api/src/com/intellij/codeInsight/completion/CompletionType.java
platform/lang-api/src/com/intellij/codeInsight/completion/SkipAutopopupInStrings.java
platform/lang-api/src/com/intellij/codeInsight/intention/impl/PriorityIntentionActionWrapper.java
platform/lang-api/src/com/intellij/codeInsight/intention/impl/PriorityLocalQuickFixWrapper.java
platform/lang-api/src/com/intellij/codeInspection/QuickFix.java
platform/lang-api/src/com/intellij/execution/BeforeRunTaskProvider.java
platform/lang-api/src/com/intellij/execution/DefaultExecutionTarget.java
platform/lang-api/src/com/intellij/execution/ExecutionTarget.java
platform/lang-api/src/com/intellij/execution/ExecutionTargetListener.java
platform/lang-api/src/com/intellij/execution/ExecutionTargetManager.java
platform/lang-api/src/com/intellij/execution/ExecutionTargetProvider.java
platform/lang-api/src/com/intellij/execution/RunnerAndConfigurationSettings.java
platform/lang-api/src/com/intellij/execution/configurations/CommandLineState.java
platform/lang-api/src/com/intellij/execution/configurations/RunConfigurationBase.java
platform/lang-api/src/com/intellij/execution/configurations/TargetAwareRunProfile.java
platform/lang-api/src/com/intellij/formatting/DependentSpacingRule.java
platform/lang-api/src/com/intellij/formatting/Spacing.java
platform/lang-api/src/com/intellij/formatting/SpacingFactory.java
platform/lang-api/src/com/intellij/patterns/PsiElementPattern.java
platform/lang-impl/src/com/intellij/application/options/CodeCompletion.form
platform/lang-impl/src/com/intellij/application/options/CodeCompletionPanel.java
platform/lang-impl/src/com/intellij/application/options/OptionId.java
platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java
platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionFeatures.java
platform/lang-impl/src/com/intellij/codeInsight/completion/PrefixMatchingWeigher.java
platform/lang-impl/src/com/intellij/codeInsight/completion/actions/BaseCodeCompletionAction.java
platform/lang-impl/src/com/intellij/codeInsight/completion/actions/ClassNameCompletionAction.java
platform/lang-impl/src/com/intellij/codeInsight/completion/actions/CodeCompletionAction.java
platform/lang-impl/src/com/intellij/codeInsight/completion/actions/SmartCodeCompletionAction.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/DefaultGutterIconNavigationHandler.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/GeneralHighlightingPass.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/quickFix/FileReferenceQuickFixProvider.java
platform/lang-impl/src/com/intellij/codeInsight/editorActions/CompletionAutoPopupHandler.java
platform/lang-impl/src/com/intellij/codeInsight/intention/impl/QuickEditAction.java
platform/lang-impl/src/com/intellij/codeInsight/template/macro/BaseCompleteMacro.java
platform/lang-impl/src/com/intellij/codeInsight/template/macro/ClassNameCompleteMacro.java
platform/lang-impl/src/com/intellij/codeInsight/template/macro/CompleteMacro.java
platform/lang-impl/src/com/intellij/codeInsight/template/macro/CompleteSmartMacro.java
platform/lang-impl/src/com/intellij/codeInspection/actions/InspectionListCellRenderer.java
platform/lang-impl/src/com/intellij/execution/DefaultExecutionTargetProvider.java
platform/lang-impl/src/com/intellij/execution/ExecutionTargetManagerImpl.java
platform/lang-impl/src/com/intellij/execution/ProgramRunnerUtil.java
platform/lang-impl/src/com/intellij/execution/actions/ChooseDebugConfigurationPopupAction.java
platform/lang-impl/src/com/intellij/execution/actions/ChooseRunConfigurationPopupAction.java
platform/lang-impl/src/com/intellij/execution/actions/RunConfigurationsComboBoxAction.java
platform/lang-impl/src/com/intellij/execution/impl/RunConfigurationBeforeRunProvider.java
platform/lang-impl/src/com/intellij/execution/impl/RunnerAndConfigurationSettingsImpl.java
platform/lang-impl/src/com/intellij/execution/impl/UnknownBeforeRunTaskProvider.java
platform/lang-impl/src/com/intellij/execution/ui/layout/impl/GridCellImpl.java
platform/lang-impl/src/com/intellij/formatting/AbstractBlockAlignmentProcessor.java
platform/lang-impl/src/com/intellij/formatting/AbstractBlockWrapper.java
platform/lang-impl/src/com/intellij/formatting/AlignmentImpl.java
platform/lang-impl/src/com/intellij/formatting/BlockAlignmentProcessor.java
platform/lang-impl/src/com/intellij/formatting/BlockEx.java
platform/lang-impl/src/com/intellij/formatting/DependantSpacingImpl.java
platform/lang-impl/src/com/intellij/formatting/FormatProcessor.java
platform/lang-impl/src/com/intellij/formatting/templateLanguages/DataLanguageBlockWrapper.java
platform/lang-impl/src/com/intellij/ide/actions/CreateFileFromTemplateAction.java
platform/lang-impl/src/com/intellij/ide/favoritesTreeView/FavoritesManager.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/FileTemplateManager.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/FileTemplateUtil.java
platform/lang-impl/src/com/intellij/ide/fileTemplates/ui/CreateFromTemplateDialog.java
platform/lang-impl/src/com/intellij/ide/util/NavigationItemListCellRenderer.java
platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoFileCellRenderer.java
platform/lang-impl/src/com/intellij/lang/customFolding/GotoCustomRegionAction.java
platform/lang-impl/src/com/intellij/lang/customFolding/GotoCustomRegionDialog.form
platform/lang-impl/src/com/intellij/lang/customFolding/GotoCustomRegionDialog.java
platform/lang-impl/src/com/intellij/openapi/editor/ex/util/LayeredLexerEditorHighlighter.java
platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java
platform/lang-impl/src/com/intellij/openapi/paths/StaticPathReferenceProvider.java
platform/lang-impl/src/com/intellij/psi/formatter/common/InjectedLanguageBlockWrapper.java
platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageManagerImpl.java
platform/lang-impl/src/com/intellij/psi/stubs/SerializedStubTree.java
platform/lang-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureDialogBase.java
platform/lang-impl/src/com/intellij/refactoring/changeSignature/MethodDescriptor.java
platform/lang-impl/src/com/intellij/refactoring/ui/ComboBoxVisibilityPanel.java
platform/lang-impl/src/com/intellij/refactoring/ui/VisibilityPanelBase.java
platform/lang-impl/src/com/intellij/tools/ToolAction.java
platform/lang-impl/src/com/intellij/tools/ToolBeforeRunTask.java
platform/lang-impl/src/com/intellij/tools/ToolsPanel.java
platform/lang-impl/src/com/intellij/util/indexing/ChangeTrackingValueContainer.java
platform/lang-impl/src/com/intellij/util/indexing/UpdatableValueContainer.java
platform/lang-impl/src/com/intellij/util/indexing/ValueContainerImpl.java
platform/lang-impl/src/com/intellij/util/indexing/ValueContainerMap.java
platform/lvcs-impl/src/com/intellij/history/core/ChangeListStorageImpl.java
platform/platform-api/src/com/intellij/openapi/actionSystem/AnAction.java
platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java
platform/platform-api/src/com/intellij/openapi/editor/EditorFactory.java
platform/platform-api/src/com/intellij/openapi/ui/Messages.java
platform/platform-api/src/com/intellij/openapi/vfs/JarFileSystem.java
platform/platform-api/src/com/intellij/ui/speedSearch/ListWithFilter.java
platform/platform-api/src/com/intellij/ui/speedSearch/SpeedSearch.java
platform/platform-api/src/com/intellij/ui/table/TableView.java
platform/platform-api/src/com/intellij/util/Icons.java
platform/platform-impl/src/com/intellij/diagnostic/ITNReporter.java
platform/platform-impl/src/com/intellij/ide/ReopenProjectAction.java
platform/platform-impl/src/com/intellij/ide/actions/ShowContentAction.java
platform/platform-impl/src/com/intellij/ide/startupWizard/SelectPluginsStep.java
platform/platform-impl/src/com/intellij/ide/ui/customization/CustomActionsSchema.java
platform/platform-impl/src/com/intellij/notification/EventLogConsole.java
platform/platform-impl/src/com/intellij/openapi/editor/actions/DeleteToWordStartAction.java
platform/platform-impl/src/com/intellij/openapi/editor/actions/HungryBackspaceAction.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/FoldRegionsTree.java
platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginDownloader.java
platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java
platform/platform-impl/src/com/intellij/ui/mac/MacMainFrameDecorator.java
platform/platform-impl/src/com/intellij/util/CompressionUtil.java
platform/platform-resources-en/src/messages/DiagnosticBundle.properties
platform/platform-resources-en/src/messages/FeatureStatisticsBundle.properties
platform/platform-resources-en/src/messages/KeyMapBundle.properties
platform/platform-resources-en/src/messages/RefactoringBundle.properties
platform/platform-resources-en/src/tips/TagNameCompletion.html
platform/platform-resources/src/META-INF/LangExtensionPoints.xml
platform/platform-resources/src/componentSets/Execution.xml
platform/platform-resources/src/idea/Keymap_Default.xml
platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/softwrap/mapping/SoftWrapApplianceOnDocumentModificationTest.java
platform/projectModel-impl/src/com/intellij/core/CoreModuleManager.java
platform/projectModel-impl/src/com/intellij/core/CoreProjectLoader.java
platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ContentFolderBaseImpl.java
platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexImpl.java
platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryInfo.java
platform/testFramework/src/com/intellij/mock/MockExecutionTargetManager.java
platform/testFramework/src/com/intellij/testFramework/TestLoggerFactory.java
platform/util-rt/src/com/intellij/openapi/util/Comparing.java
platform/util/src/com/intellij/execution/process/UnixProcessManager.java
platform/util/src/com/intellij/util/io/PagedFileStorage.java
platform/util/src/com/intellij/util/text/CharArrayUtil.java
platform/vcs-api/src/com/intellij/openapi/vcs/ui/SearchFieldAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/update/CommonIntegrateFileOrDirectoryAction.java
platform/vcs-impl/src/com/intellij/openapi/vcs/update/CommonUpdateFileOrDirectoryAction.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ResumeAction.java
plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/BadExceptionDeclaredInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/errorhandling/TooBroadThrowsInspection.java
plugins/InspectionGadgets/src/inspectionDescriptions/BadExceptionDeclared.html
plugins/InspectionGadgets/src/inspectionDescriptions/TooBroadThrows.html
plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/pointless_boolean_expression_ignore_cont_const/PointlessBooleanExpression.java
plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/pointless_boolean_expression_ignore_cont_const/expected.xml
plugins/InspectionGadgets/testsrc/com/siyeh/ig/controlflow/PointlessBooleanExpressionInspectionTest.java
plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectLanguageAction.java
plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/UnInjectLanguageAction.java
plugins/IntentionPowerPak/src/com/siyeh/ipp/constant/ConstantSubexpressionIntention.java
plugins/IntentionPowerPak/src/com/siyeh/ipp/constant/ConstantSubexpressionPredicate.java
plugins/IntentionPowerPak/src/com/siyeh/ipp/psiutils/ExpressionUtils.java
plugins/android-designer/src/META-INF/plugin.xml
plugins/android-designer/src/com/intellij/android/designer/AndroidDesignerBundle.java
plugins/android-designer/src/com/intellij/android/designer/model/AndroidWrapInProvider.java
plugins/android-designer/src/com/intellij/android/designer/model/RadFragment.java
plugins/android-designer/src/com/intellij/android/designer/model/RadViewLayout.java
plugins/android/src/org/jetbrains/android/AndroidFileTemplateProvider.java
plugins/android/src/org/jetbrains/android/actions/CreateResourceFileAction.java
plugins/android/src/org/jetbrains/android/actions/CreateXmlResourceDialog.java
plugins/ant/src/com/intellij/lang/ant/config/impl/AntBeforeRunTaskProvider.java
plugins/git4idea/src/git4idea/history/wholeTree/BasePopupAction.java
plugins/git4idea/src/git4idea/history/wholeTree/Commit.java
plugins/git4idea/src/git4idea/history/wholeTree/CommitI.java
plugins/git4idea/src/git4idea/history/wholeTree/GitLogFilters.java
plugins/git4idea/src/git4idea/history/wholeTree/GitLogShowOnlyStarredCommitsAction.java
plugins/git4idea/src/git4idea/history/wholeTree/GroupHeaderCommitDecorator.java
plugins/git4idea/src/git4idea/history/wholeTree/GroupHeaderDatePseudoCommit.java
plugins/git4idea/src/git4idea/history/wholeTree/LoadController.java
plugins/git4idea/src/git4idea/history/wholeTree/Mediator.java
plugins/git4idea/src/git4idea/history/wholeTree/MediatorImpl.java
plugins/git4idea/src/git4idea/history/wholeTree/MultipleRepositoryCommitDecorator.java
plugins/git4idea/src/git4idea/history/wholeTree/RootsHolder.java
plugins/git4idea/src/git4idea/history/wholeTree/WireNumberCommitDecoration.java
plugins/groovy/resources/inspectionDescriptions/GrReassignedInClosureLocalVar.html
plugins/groovy/src/org/jetbrains/plugins/groovy/actions/GroovyTemplatesFactory.java
plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GrKeywordAndDeclarationHighlightFactory.java
plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GrKeywordAndDeclarationHighlighter.java
plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GrReferenceHighlighterFactory.java
plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GrReassignedLocalVarsChecker.java
plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/confusing/GrReassignedInClosureLocalVarInspection.java
plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/untypedUnresolvedAccess/GrUnresolvedAccessInspection.java
plugins/groovy/src/org/jetbrains/plugins/groovy/codeInspection/untypedUnresolvedAccess/GroovyUntypedAccessInspection.java
plugins/groovy/src/org/jetbrains/plugins/groovy/findUsages/GrHighlightExitPointHandler.java
plugins/groovy/src/org/jetbrains/plugins/groovy/findUsages/GrHighlightHandlerFactory.java
plugins/groovy/src/org/jetbrains/plugins/groovy/intentions/style/AddReturnTypeFix.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionContributor.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/GrTypeConverter.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrVariableImpl.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrLightField.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/GrScriptField.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/types/GrStringTypeConverter.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/ClosureParameterEnhancer.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/GrClassImplUtil.java
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/GroovyCommonClassNames.java
plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extract/method/GroovyExtractMethodDialog.java
plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/ui/GroovyComboboxVisibilityPanel.java
plugins/groovy/test/org/jetbrains/plugins/groovy/LightGroovyTestCase.groovy
plugins/groovy/test/org/jetbrains/plugins/groovy/completion/ReferenceCompletionTest.java
plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GppFunctionalTest.groovy
plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyStressPerformanceTest.groovy
plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveMethodTest.groovy
plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolvePropertyTest.groovy
plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/introduce/field/GrIntroduceFieldTest.groovy
plugins/java-i18n/testData/inspection/stringWithMistakes/idea50496.java
plugins/java-i18n/testSrc/com/intellij/spellchecker/inspection/ClassNameWithMistakesInspectionTest.java
plugins/java-i18n/testSrc/com/intellij/spellchecker/inspection/DocCommentWithMistakesInspectionTest.java
plugins/java-i18n/testSrc/com/intellij/spellchecker/inspection/FieldNameWithMistakesInspectionTest.java
plugins/java-i18n/testSrc/com/intellij/spellchecker/inspection/JavaSpellcheckerInspectionTestCase.java
plugins/java-i18n/testSrc/com/intellij/spellchecker/inspection/LiteralExpressionTokenizerTest.java
plugins/java-i18n/testSrc/com/intellij/spellchecker/inspection/LocalVariableWithMistakesInspectionTest.java
plugins/java-i18n/testSrc/com/intellij/spellchecker/inspection/MethodNameWithMistakesInspectionTest.java
plugins/java-i18n/testSrc/com/intellij/spellchecker/inspection/StringWithMistakesInspectionTest.java
plugins/junit/src/com/intellij/execution/junit/JUnitConfiguration.java
plugins/junit/src/com/intellij/execution/junit/TestClass.java
plugins/junit/src/com/intellij/execution/junit/TestDirectory.java
plugins/junit/src/com/intellij/execution/junit/TestMethod.java
plugins/junit/src/com/intellij/execution/junit/TestMethods.java
plugins/junit/src/com/intellij/execution/junit/TestPackage.java
plugins/junit/src/com/intellij/execution/junit/TestsPattern.java
plugins/maven/maven3-server-impl/lib/maven3/bin/m2.conf
plugins/maven/maven3-server-impl/lib/maven3/bin/mvn.bat
plugins/maven/maven3-server-impl/lib/maven3/bin/mvnDebug.bat
plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenBaseModifiableModelsProvider.java
plugins/maven/src/main/java/org/jetbrains/idea/maven/tasks/MavenBeforeRunTasksProvider.java
plugins/properties/src/com/intellij/lang/properties/PropertiesCompletionContributor.java
plugins/properties/src/com/intellij/lang/properties/PropertiesDocumentationProvider.java
plugins/spellchecker/src/com/intellij/spellchecker/tokenizer/TokenConsumer.java
plugins/spellchecker/src/com/intellij/spellchecker/tokenizer/XmlTextTokenizer.java
plugins/svn4idea/src/org/jetbrains/idea/svn/RepeatSvnActionThroughBusy.java
plugins/svn4idea/testSource/org/jetbrains/idea/SvnTestCase.java
plugins/svn4idea/testSource/org/jetbrains/idea/svn/Svn17TestCase.java
plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestDirtyScopeStateTest.java
plugins/tasks/tasks-core/src/com/intellij/tasks/pivotal/PivotalTrackerRepository.java
plugins/ui-designer/ui-designer-new/src/META-INF/plugin.xml
plugins/ui-designer/ui-designer-new/src/com/intellij/designer/DesignerBundle.java
plugins/ui-designer/ui-designer-new/src/com/intellij/designer/actions/DesignerActionPanel.java
plugins/ui-designer/ui-designer-new/src/com/intellij/designer/actions/WrapInAction.java
plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadLayout.java
plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/WrapInProvider.java
plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/util/XsltCodeInsightUtil.java
resources-en/src/fileTemplates/default.html
resources-en/src/fileTemplates/includes/File Header.java.html
resources-en/src/fileTemplates/includes/default.html
resources-en/src/intentionDescriptions/BreakStringOnLineBreaksIntentionAction/description.html
resources-en/src/messages/CompletionBundle.properties
resources-en/src/tips/CompletionImportStatic.html
resources/src/ProductivityFeaturesRegistry.xml
xml/dom-impl/src/com/intellij/util/xml/ElementPresentationManagerImpl.java
xml/dom-openapi/src/com/intellij/util/xml/JavaNameStrategy.java
xml/impl/src/com/intellij/application/options/HtmlCodeStyleMainPanel.java
xml/impl/src/com/intellij/application/options/HtmlCodeStyleSettingsProvider.java
xml/impl/src/com/intellij/application/options/HtmlLanguageCodeStyleSettings.java
xml/impl/src/com/intellij/codeInsight/completion/XmlCompletionContributor.java
xml/impl/src/com/intellij/psi/impl/source/xml/XmlTextImpl.java

index 433bd3b5e5f0550d4013266d5948a97f27215e58..fca1abd1e774d5ef798cf896de5794e21cc88ed1 100644 (file)
@@ -1,29 +1,29 @@
-<component name="libraryTable">\r
-  <library name="Ant">\r
-    <CLASSES>\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-commons-net.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-jmf.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-apache-resolver.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-jai.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-apache-bsf.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-commons-logging.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-junit.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-jsch.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-apache-bcel.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-netrexx.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-apache-oro.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-antlr.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-jdepend.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-launcher.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-apache-regexp.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-apache-log4j.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-swing.jar!/" />\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-javamail.jar!/" />\r
-    </CLASSES>\r
-    <JAVADOC />\r
-    <SOURCES>\r
-      <root url="jar://$PROJECT_DIR$/lib/ant/src/bundled_ant_src.zip!/bundled_ant_src/main" />\r
-    </SOURCES>\r
-  </library>\r
+<component name="libraryTable">
+  <library name="Ant">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-commons-net.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-jmf.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-apache-resolver.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-jai.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-apache-bsf.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-commons-logging.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-junit.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-jsch.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-apache-bcel.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-netrexx.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-apache-oro.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-antlr.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-jdepend.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-launcher.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-apache-regexp.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-apache-log4j.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-swing.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-javamail.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$PROJECT_DIR$/lib/ant/src/bundled_ant_src.zip!/bundled_ant_src/main" />
+    </SOURCES>
+  </library>
 </component>
\ No newline at end of file
index ffb479f53fd40158d608124d58e265ecf8788933..5a8873386c4934e0dae3b88c24975997d8172318 100644 (file)
@@ -1,11 +1,11 @@
-<component name="libraryTable">\r
-  <library name="Netty">\r
-    <CLASSES>\r
-      <root url="jar://$PROJECT_DIR$/lib/netty-3.5.10.Final.jar!/" />\r
-    </CLASSES>\r
-    <JAVADOC />\r
-    <SOURCES>\r
-      <root url="jar://$PROJECT_DIR$/lib/src/netty-3.5.10.Final-sources.jar!/" />\r
-    </SOURCES>\r
-  </library>\r
+<component name="libraryTable">
+  <library name="Netty">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/netty-3.5.10.Final.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES>
+      <root url="jar://$PROJECT_DIR$/lib/src/netty-3.5.10.Final-sources.jar!/" />
+    </SOURCES>
+  </library>
 </component>
\ No newline at end of file
index 79efa842173cbdbcb3996163fd686b8e8109b0b0..0b6f63913b863c085766de70b7d47552947b7b1c 100644 (file)
@@ -1,14 +1,14 @@
-<component name="libraryTable">\r
-  <library name="Snappy-Java">\r
-    <CLASSES>\r
-      <root url="jar://$PROJECT_DIR$/lib/snappy-java-1.0.4.1.jar!/" />\r
-    </CLASSES>\r
-    <JAVADOC>\r
-      <root url="jar://$PROJECT_DIR$/lib/src/snappy-java-1.0.4.1-src.zip!/snappy-java-1.0.4.1/wiki/apidocs" />\r
-    </JAVADOC>\r
-    <SOURCES>\r
-      <root url="jar://$PROJECT_DIR$/lib/src/snappy-java-1.0.4.1-src.zip!/snappy-java-1.0.4.1/src/main/resources" />\r
-      <root url="jar://$PROJECT_DIR$/lib/src/snappy-java-1.0.4.1-src.zip!/snappy-java-1.0.4.1/src/main/java" />\r
-    </SOURCES>\r
-  </library>\r
+<component name="libraryTable">
+  <library name="Snappy-Java">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/snappy-java-1.0.4.1.jar!/" />
+    </CLASSES>
+    <JAVADOC>
+      <root url="jar://$PROJECT_DIR$/lib/src/snappy-java-1.0.4.1-src.zip!/snappy-java-1.0.4.1/wiki/apidocs" />
+    </JAVADOC>
+    <SOURCES>
+      <root url="jar://$PROJECT_DIR$/lib/src/snappy-java-1.0.4.1-src.zip!/snappy-java-1.0.4.1/src/main/resources" />
+      <root url="jar://$PROJECT_DIR$/lib/src/snappy-java-1.0.4.1-src.zip!/snappy-java-1.0.4.1/src/main/java" />
+    </SOURCES>
+  </library>
 </component>
\ No newline at end of file
index e59c52e5eb6e15077db1a79088114687d6975397..74a709c8cf82bc5ef12ae9a214191a037b3b375c 100644 (file)
@@ -1,9 +1,9 @@
-<component name="libraryTable">\r
-  <library name="proxy-vole">\r
-    <CLASSES>\r
-      <root url="jar://$PROJECT_DIR$/lib/proxy-vole_20120920.jar!/" />\r
-    </CLASSES>\r
-    <JAVADOC />\r
-    <SOURCES />\r
-  </library>\r
+<component name="libraryTable">
+  <library name="proxy-vole">
+    <CLASSES>
+      <root url="jar://$PROJECT_DIR$/lib/proxy-vole_20120920.jar!/" />
+    </CLASSES>
+    <JAVADOC />
+    <SOURCES />
+  </library>
 </component>
\ No newline at end of file
index 3e09124325e9fe6fd5d773c73e5fe19d46b2f209..a8a5f3459c58289a11b3cf659588b371ef6e7d8a 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,20 +1,20 @@
-# IntelliJ IDEA Community Edition\r
-\r
-This is the official GitHub mirror of the [IntelliJ IDEA Community Edition](http://www.jetbrains.com/idea/) source code.\r
-\r
-## Building\r
-\r
-To develop IntelliJ IDEA, you can use either IntelliJ IDEA Community Edition or IntelliJ IDEA Ultimate. To build and run the code:\r
-\r
-* Make sure you have the Groovy plugin enabled. Parts of IntelliJ IDEA are written in Groovy, and you will get compilation errors if you don't have the plugin enabled.\r
-* Make sure you have the UI Designer plugin enabled. Most of IntelliJ IDEA's UI is built using the UI Designer, and the version you build will not run correctly if you don't have the plugin enabled.\r
-* Open the directory with the source code as a directory-based project\r
-* Configure a JSDK named "IDEA jdk", pointing to an installation of JDK 1.6\r
-* On Windows or Linux, add lib\tools.jar from the JDK installation directory to the classpath of IDEA jdk\r
-* Use Build | Make Project to build the code\r
-* To run the code, use the provided shared run configuration "IDEA".\r
-\r
-## Contributing\r
-\r
-Pull requests are welcome. Please make sure that you follow the [IntelliJ Coding Guidelines](http://www.jetbrains.org/display/IJOS/IntelliJ+Coding+Guidelines).\r
-Note that you'll need to submit a [Contributor Agreement](http://www.jetbrains.org/display/IJOS/Contributor+Agreement) before we can accept your pull request.\r
+# IntelliJ IDEA Community Edition
+
+This is the official GitHub mirror of the [IntelliJ IDEA Community Edition](http://www.jetbrains.com/idea/) source code.
+
+## Building
+
+To develop IntelliJ IDEA, you can use either IntelliJ IDEA Community Edition or IntelliJ IDEA Ultimate. To build and run the code:
+
+* Make sure you have the Groovy plugin enabled. Parts of IntelliJ IDEA are written in Groovy, and you will get compilation errors if you don't have the plugin enabled.
+* Make sure you have the UI Designer plugin enabled. Most of IntelliJ IDEA's UI is built using the UI Designer, and the version you build will not run correctly if you don't have the plugin enabled.
+* Open the directory with the source code as a directory-based project
+* Configure a JSDK named "IDEA jdk", pointing to an installation of JDK 1.6
+* On Windows or Linux, add lib\tools.jar from the JDK installation directory to the classpath of IDEA jdk
+* Use Build | Make Project to build the code
+* To run the code, use the provided shared run configuration "IDEA".
+
+## Contributing
+
+Pull requests are welcome. Please make sure that you follow the [IntelliJ Coding Guidelines](http://www.jetbrains.org/display/IJOS/IntelliJ+Coding+Guidelines).
+Note that you'll need to submit a [Contributor Agreement](http://www.jetbrains.org/display/IJOS/Contributor+Agreement) before we can accept your pull request.
index 0c41b1e37653fe159f99b269d53889ed09615714..8f46144f67672a7e443e8b3be395ac49c82ac1a9 100644 (file)
-/*\r
- * Copyright 2006 Sascha Weinreuter\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package test;\r
-\r
-import org.intellij.lang.regexp.RegExpFileType;\r
-import org.jdom.Document;\r
-import org.jdom.Element;\r
-import org.jdom.input.SAXBuilder;\r
-import org.jdom.xpath.XPath;\r
-\r
-import java.io.*;\r
-import java.util.LinkedHashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.regex.Pattern;\r
-import java.util.regex.PatternSyntaxException;\r
-\r
-public class MainParseTest extends BaseParseTestcase {\r
-\r
-  private ByteArrayOutputStream myOut;\r
-\r
-  enum Result {\r
-    OK, ERR\r
-  }\r
-\r
-  static class Test {\r
-    String pattern;\r
-    boolean showWarnings = true;\r
-    boolean showInfo = false;\r
-    Result expectedResult;\r
-\r
-    Test(String pattern, Result result, boolean warn, boolean info) {\r
-      this.pattern = pattern;\r
-      expectedResult = result;\r
-      showWarnings = warn;\r
-      showInfo = info;\r
-    }\r
-  }\r
-\r
-  private final Map<String, Test> myMap = new LinkedHashMap<String, Test>();\r
-\r
-  @Override\r
-  protected void setUp() throws Exception {\r
-    final Document document = new SAXBuilder().build(new File(getTestDataRoot(), "/RETest.xml"));\r
-    final List<Element> list = XPath.selectNodes(document.getRootElement(), "//test");\r
-\r
-    int i = 0;\r
-    for (Element element : list) {\r
-      final String name;\r
-      final Element parent = (Element)element.getParent();\r
-      final String s = parent.getName();\r
-      final String t = parent.getAttribute("id") == null ? "" : parent.getAttribute("id").getValue() + "-";\r
-      if (!"tests".equals(s)) {\r
-        name = s + "/test-" + t + ++i + ".regexp";\r
-      }\r
-      else {\r
-        name = "test-" + t + ++i + ".regexp";\r
-      }\r
-      final Result result = Result.valueOf((String)XPath.selectSingleNode(element, "string(expected)"));\r
-      final boolean warn = !"false".equals(element.getAttributeValue("warning"));\r
-      final boolean info = "true".equals(element.getAttributeValue("info"));\r
-\r
-      final String pattern = (String)XPath.selectSingleNode(element, "string(pattern)");\r
-      myMap.put(name, new Test(pattern, result, warn, info));\r
-      if (!"false".equals(element.getAttributeValue("verify"))) {\r
-        try {\r
-          Pattern.compile(pattern);\r
-          if (result == Result.ERR) {\r
-            System.out.println("Incorrect FAIL value for " + pattern);\r
-          }\r
-        }\r
-        catch (PatternSyntaxException e) {\r
-          if (result == Result.OK) {\r
-            System.out.println("Incorrect OK value for " + pattern);\r
-          }\r
-        }\r
-      }\r
-    }\r
-\r
-    super.setUp();\r
-\r
-    myOut = new ByteArrayOutputStream();\r
-    System.setErr(new PrintStream(myOut));\r
-  }\r
-\r
-  @Override\r
-  protected String getTestDataPath() {\r
-    return super.getTestDataPath() + "/gen/";\r
-  }\r
-\r
-  public void testSimple() throws Exception {\r
-    doTest("simple/");\r
-  }\r
-\r
-  public void testQuantifiers() throws Exception {\r
-    doTest("quantifiers/");\r
-  }\r
-\r
-  public void testGroups() throws Exception {\r
-    doTest("groups/");\r
-  }\r
-\r
-  public void testCharclasses() throws Exception {\r
-    doTest("charclasses/");\r
-  }\r
-\r
-  public void testEscapes() throws Exception {\r
-    doTest("escapes/");\r
-  }\r
-\r
-  public void testAnchors() throws Exception {\r
-    doTest("anchors/");\r
-  }\r
-\r
-  public void testNamedchars() throws Exception {\r
-    doTest("namedchars/");\r
-  }\r
-\r
-  public void testBackrefs() throws Exception {\r
-    doTest("backrefs/");\r
-  }\r
-\r
-  public void testComplex() throws Exception {\r
-    doTest("complex/");\r
-  }\r
-\r
-  public void testIncomplete() throws Exception {\r
-    doTest("incomplete/");\r
-  }\r
-\r
-  public void testRealLife() throws Exception {\r
-    doTest("real-life/");\r
-  }\r
-\r
-  public void testRegressions() throws Exception {\r
-    doTest("regressions/");\r
-  }\r
-\r
-  public void testBugs() throws Exception {\r
-    doTest("bug/");\r
-  }\r
-\r
-  public void testFromXML() throws Exception {\r
-    doTest(null);\r
-  }\r
-\r
-  private void doTest(String prefix) throws IOException {\r
-    int n = 0;\r
-    int failed = 0;\r
-    for (String name : myMap.keySet()) {\r
-      if (prefix == null && name.contains("/")) {\r
-        continue;\r
-      }\r
-      if (prefix != null && !name.startsWith(prefix)) {\r
-        continue;\r
-      }\r
-      System.out.print("filename = " + name);\r
-      n++;\r
-\r
-      final MainParseTest.Test test = myMap.get(name);\r
-      try {\r
-        myFixture.configureByText(RegExpFileType.INSTANCE, test.pattern);\r
-        myFixture.testHighlighting(test.showWarnings, true, test.showInfo);\r
-\r
-        if (test.expectedResult == Result.ERR) {\r
-          System.out.println("  FAILED. Expression incorrectly parsed OK: " + test.pattern);\r
-          failed++;\r
-        }\r
-        else {\r
-          System.out.println("  OK");\r
-        }\r
-      }\r
-      catch (Throwable e) {\r
-        if (test.expectedResult == Result.ERR) {\r
-          System.out.println("  OK");\r
-        }\r
-        else {\r
-          e.printStackTrace();\r
-          System.out.println("  FAILED. Expression = " + test.pattern);\r
-          if (myOut.size() > 0) {\r
-            String line;\r
-            final BufferedReader reader = new BufferedReader(new StringReader(myOut.toString()));\r
-            do {\r
-              line = reader.readLine();\r
-            }\r
-            while (line != null && (line.trim().length() == 0 || line.trim().equals("ERROR:")));\r
-            if (line != null) {\r
-              if (line.matches(".*java.lang.Error: junit.framework.AssertionFailedError:.*")) {\r
-                System.out.println("ERROR: " + line.replace("java.lang.Error: junit.framework.AssertionFailedError:", ""));\r
-              }\r
-            }\r
-            else {\r
-              System.out.println("ERROR: " + myOut.toString());\r
-            }\r
-          }\r
-          failed++;\r
-        }\r
-      }\r
-      myOut.reset();\r
-    }\r
-\r
-    System.out.println("");\r
-    System.out.println(n + " Tests executed, " + failed + " failed");\r
-\r
-    assertFalse(failed > 0);\r
-  }\r
-}\r
+/*
+ * Copyright 2006 Sascha Weinreuter
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package test;
+
+import org.intellij.lang.regexp.RegExpFileType;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.input.SAXBuilder;
+import org.jdom.xpath.XPath;
+
+import java.io.*;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+public class MainParseTest extends BaseParseTestcase {
+
+  private ByteArrayOutputStream myOut;
+
+  enum Result {
+    OK, ERR
+  }
+
+  static class Test {
+    String pattern;
+    boolean showWarnings = true;
+    boolean showInfo = false;
+    Result expectedResult;
+
+    Test(String pattern, Result result, boolean warn, boolean info) {
+      this.pattern = pattern;
+      expectedResult = result;
+      showWarnings = warn;
+      showInfo = info;
+    }
+  }
+
+  private final Map<String, Test> myMap = new LinkedHashMap<String, Test>();
+
+  @Override
+  protected void setUp() throws Exception {
+    final Document document = new SAXBuilder().build(new File(getTestDataRoot(), "/RETest.xml"));
+    final List<Element> list = XPath.selectNodes(document.getRootElement(), "//test");
+
+    int i = 0;
+    for (Element element : list) {
+      final String name;
+      final Element parent = (Element)element.getParent();
+      final String s = parent.getName();
+      final String t = parent.getAttribute("id") == null ? "" : parent.getAttribute("id").getValue() + "-";
+      if (!"tests".equals(s)) {
+        name = s + "/test-" + t + ++i + ".regexp";
+      }
+      else {
+        name = "test-" + t + ++i + ".regexp";
+      }
+      final Result result = Result.valueOf((String)XPath.selectSingleNode(element, "string(expected)"));
+      final boolean warn = !"false".equals(element.getAttributeValue("warning"));
+      final boolean info = "true".equals(element.getAttributeValue("info"));
+
+      final String pattern = (String)XPath.selectSingleNode(element, "string(pattern)");
+      myMap.put(name, new Test(pattern, result, warn, info));
+      if (!"false".equals(element.getAttributeValue("verify"))) {
+        try {
+          Pattern.compile(pattern);
+          if (result == Result.ERR) {
+            System.out.println("Incorrect FAIL value for " + pattern);
+          }
+        }
+        catch (PatternSyntaxException e) {
+          if (result == Result.OK) {
+            System.out.println("Incorrect OK value for " + pattern);
+          }
+        }
+      }
+    }
+
+    super.setUp();
+
+    myOut = new ByteArrayOutputStream();
+    System.setErr(new PrintStream(myOut));
+  }
+
+  @Override
+  protected String getTestDataPath() {
+    return super.getTestDataPath() + "/gen/";
+  }
+
+  public void testSimple() throws Exception {
+    doTest("simple/");
+  }
+
+  public void testQuantifiers() throws Exception {
+    doTest("quantifiers/");
+  }
+
+  public void testGroups() throws Exception {
+    doTest("groups/");
+  }
+
+  public void testCharclasses() throws Exception {
+    doTest("charclasses/");
+  }
+
+  public void testEscapes() throws Exception {
+    doTest("escapes/");
+  }
+
+  public void testAnchors() throws Exception {
+    doTest("anchors/");
+  }
+
+  public void testNamedchars() throws Exception {
+    doTest("namedchars/");
+  }
+
+  public void testBackrefs() throws Exception {
+    doTest("backrefs/");
+  }
+
+  public void testComplex() throws Exception {
+    doTest("complex/");
+  }
+
+  public void testIncomplete() throws Exception {
+    doTest("incomplete/");
+  }
+
+  public void testRealLife() throws Exception {
+    doTest("real-life/");
+  }
+
+  public void testRegressions() throws Exception {
+    doTest("regressions/");
+  }
+
+  public void testBugs() throws Exception {
+    doTest("bug/");
+  }
+
+  public void testFromXML() throws Exception {
+    doTest(null);
+  }
+
+  private void doTest(String prefix) throws IOException {
+    int n = 0;
+    int failed = 0;
+    for (String name : myMap.keySet()) {
+      if (prefix == null && name.contains("/")) {
+        continue;
+      }
+      if (prefix != null && !name.startsWith(prefix)) {
+        continue;
+      }
+      System.out.print("filename = " + name);
+      n++;
+
+      final MainParseTest.Test test = myMap.get(name);
+      try {
+        myFixture.configureByText(RegExpFileType.INSTANCE, test.pattern);
+        myFixture.testHighlighting(test.showWarnings, true, test.showInfo);
+
+        if (test.expectedResult == Result.ERR) {
+          System.out.println("  FAILED. Expression incorrectly parsed OK: " + test.pattern);
+          failed++;
+        }
+        else {
+          System.out.println("  OK");
+        }
+      }
+      catch (Throwable e) {
+        if (test.expectedResult == Result.ERR) {
+          System.out.println("  OK");
+        }
+        else {
+          e.printStackTrace();
+          System.out.println("  FAILED. Expression = " + test.pattern);
+          if (myOut.size() > 0) {
+            String line;
+            final BufferedReader reader = new BufferedReader(new StringReader(myOut.toString()));
+            do {
+              line = reader.readLine();
+            }
+            while (line != null && (line.trim().length() == 0 || line.trim().equals("ERROR:")));
+            if (line != null) {
+              if (line.matches(".*java.lang.Error: junit.framework.AssertionFailedError:.*")) {
+                System.out.println("ERROR: " + line.replace("java.lang.Error: junit.framework.AssertionFailedError:", ""));
+              }
+            }
+            else {
+              System.out.println("ERROR: " + myOut.toString());
+            }
+          }
+          failed++;
+        }
+      }
+      myOut.reset();
+    }
+
+    System.out.println("");
+    System.out.println(n + " Tests executed, " + failed + " failed");
+
+    assertFalse(failed > 0);
+  }
+}
index a52161f1f68b7fb80d7ee3868ca6b1541c87ee1f..47a4c6d057815f2e1c66e26b0be7dc2572e03cea 100644 (file)
--- a/build.txt
+++ b/build.txt
@@ -1 +1 @@
-124.SNAPSHOT\r
+124.SNAPSHOT
index 0621d51b6e16fff0648d11b362d879c81c83f657..b420cdba30766d445da768c1ed76a90570a0d64a 100644 (file)
-<idea-plugin version="2">\r
-\r
-  <vendor>JetBrains</vendor>\r
-\r
-  <extensions defaultExtensionNs="com.intellij">\r
-    <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>\r
-    <applicationConfigurable instance="org.intellij.images.options.impl.OptionsConfigurabe" id="Images" displayName="Images"/>\r
-    <fileEditorProvider implementation="org.intellij.images.editor.impl.ImageFileEditorProvider"/>\r
-    <selectInTarget implementation="org.intellij.images.thumbnail.impl.ThumbnailSelectInTarget"/>\r
-    <applicationService serviceInterface="org.intellij.images.options.OptionsManager"\r
-                        serviceImplementation="org.intellij.images.options.impl.OptionsManagerImpl"/>\r
-    <projectService serviceInterface="org.intellij.images.thumbnail.ThumbnailManager"\r
-                    serviceImplementation="org.intellij.images.thumbnail.impl.ThumbnailManagerImpl"/>\r
-    <fileTypeFactory implementation="org.intellij.images.fileTypes.impl.ImageFileTypeManagerImpl" />\r
-    <fileBasedIndex implementation="org.intellij.images.index.ImageInfoIndex"/>\r
-    <fileLookupInfoProvider implementation="org.intellij.images.completion.ImageLookupInfoProvider"/>\r
-    <documentationProvider implementation="org.intellij.images.fileTypes.ImageDocumentationProvider"/>\r
-  </extensions>\r
-\r
-  <application-components>\r
-    <component>\r
-      <interface-class>org.intellij.images.fileTypes.ImageFileTypeManager</interface-class>\r
-      <implementation-class>org.intellij.images.fileTypes.impl.ImageFileTypeManagerImpl</implementation-class>\r
-    </component>\r
-  </application-components>\r
-\r
-  <actions>\r
-    <action id="images.color.picker" class="org.intellij.images.actions.ColorPickerForImageAction" text="Show Color Picker">\r
-      <add-to-group anchor="after" group-id="ProjectViewPopupMenu" relative-to-action="EditSource"/>\r
-    </action>\r
-    <action class="org.intellij.images.actions.EditExternallyAction"\r
-            id="Images.EditExternaly"\r
-            icon="ImagesIcons.EditExternaly"\r
-            text="Open Image in External Editor">\r
-      <keyboard-shortcut first-keystroke="control alt F4" keymap="$default"/>\r
-      <add-to-group anchor="after" group-id="ProjectViewPopupMenu" relative-to-action="EditSource"/>\r
-    </action>\r
-    <action class="org.intellij.images.actions.ShowThumbnailsAction"\r
-            id="Images.ShowThumbnails" text="Show Image Thumbnails">\r
-      <keyboard-shortcut first-keystroke="shift control T" keymap="$default"/>\r
-      <add-to-group anchor="after" group-id="ProjectViewPopupMenu" relative-to-action="AddToFavorites"/>\r
-      <add-to-group anchor="after" group-id="NavbarPopupMenu" relative-to-action="AddToFavorites"/>\r
-    </action>\r
-    <action class="org.intellij.images.actions.ToggleTransparencyChessboardAction"\r
-            id="Images.ToggleTransparencyChessboard"\r
-            icon="ImagesIcons.ToggleTransparencyChessboard"\r
-            text="Show Chessboard"\r
-            description="Show a chessboard on transparent image parts">\r
-    </action>\r
-    <group id="Images.EditorToolbar">\r
-      <reference id="Images.ToggleTransparencyChessboard"/>\r
-      <action class="org.intellij.images.editor.actions.ToggleGridAction"\r
-              id="Images.Editor.ToggleGrid"\r
-              icon="ImagesIcons.ToggleGrid"\r
-              text="Show Grid">\r
-        <keyboard-shortcut first-keystroke="control QUOTE" keymap="$default"/>\r
-      </action>\r
-      <separator/>\r
-      <action class="org.intellij.images.editor.actions.ZoomInAction"\r
-              id="Images.Editor.ZoomIn"\r
-              icon="AllIcons.Graph.ZoomIn"\r
-              text="Zoom In"\r
-              use-shortcut-of="ExpandAll" />\r
-      <action class="org.intellij.images.editor.actions.ZoomOutAction"\r
-              id="Images.Editor.ZoomOut"\r
-              icon="AllIcons.Graph.ZoomOut"\r
-              text="Zoom Out"\r
-              use-shortcut-of="CollapseAll"/>\r
-      <action class="org.intellij.images.editor.actions.ActualSizeAction"\r
-              id="Images.Editor.ActualSize"\r
-              icon="AllIcons.Graph.ActualZoom"\r
-              text="Zoom to Actual Size">\r
-        <keyboard-shortcut first-keystroke="control DIVIDE" keymap="$default"/>\r
-        <keyboard-shortcut first-keystroke="control SLASH" keymap="$default"/>\r
-      </action>\r
-    </group>\r
-    <group id="Images.EditorPopupMenu">\r
-      <reference id="CutCopyPasteGroup"/>\r
-      <separator/>\r
-      <reference id="FindUsages"/>\r
-      <reference id="RefactoringMenu"/>\r
-      <separator/>\r
-      <reference id="Images.EditorToolbar"/>\r
-      <separator/>\r
-      <reference id="CloseEditor"/>\r
-      <separator/>\r
-      <reference id="AddToFavorites"/>\r
-      <separator/>\r
-      <reference id="VersionControlsGroup"/>\r
-      <separator/>\r
-      <reference id="images.color.picker" />\r
-      <reference id="Images.EditExternaly"/>\r
-      <reference id="ExternalToolsGroup"/>\r
-    </group>\r
-    <group id="Images.ThumbnailsToolbar">\r
-      <action class="org.intellij.images.thumbnail.actions.UpFolderAction"\r
-              id="Images.Thumbnails.UpFolder"\r
-              text="Parent Folder"\r
-              description="Show image thumbnails from the containing folder"\r
-              icon="AllIcons.Nodes.UpFolder">\r
-        <keyboard-shortcut first-keystroke="BACK_SPACE" keymap="$default"/>\r
-      </action>\r
-      <action class="org.intellij.images.thumbnail.actions.ToggleRecursiveAction"\r
-              id="Images.Thumbnails.ToggleRecursive"\r
-              text="Recursive"\r
-              description="Toggle whether to show the images from subfolders recursively"\r
-              icon="AllIcons.ObjectBrowser.FlattenPackages">\r
-        <keyboard-shortcut first-keystroke="control MULTIPLY" keymap="$default"/>\r
-      </action>\r
-      <separator/>\r
-      <reference id="Images.ToggleTransparencyChessboard"/>\r
-      <separator/>\r
-      <action class="org.intellij.images.thumbnail.actions.HideThumbnailsAction"\r
-              id="Images.Thumbnails.Hide"\r
-              text="Hide"\r
-              description="Hide image thumbnails"\r
-              icon="AllIcons.Actions.Cancel" use-shortcut-of="CloseContent"/>\r
-    </group>\r
-    <group id="Images.ThumbnailsPopupMenu">\r
-      <reference id="CutCopyPasteGroup"/>\r
-      <reference id="EditSource"/>\r
-      <action class="org.intellij.images.thumbnail.actions.EnterAction"\r
-              id="Images.Thumbnails.EnterAction">\r
-        <keyboard-shortcut first-keystroke="ENTER" keymap="$default"/>\r
-      </action>\r
-      <separator/>\r
-      <reference id="Images.ThumbnailsToolbar"/>\r
-      <separator/>\r
-      <reference id="FindUsages"/>\r
-      <reference id="RefactoringMenu"/>\r
-      <separator/>\r
-      <reference id="AddToFavorites"/>\r
-      <separator/>\r
-      <reference id="$Delete"/>\r
-      <separator/>\r
-      <reference id="VersionControlsGroup"/>\r
-      <reference id="CompareTwoFiles"/>\r
-      <separator/>\r
-      <reference id="Images.EditExternaly"/>\r
-      <reference id="ExternalToolsGroup"/>\r
-    </group>\r
-  </actions>\r
-</idea-plugin>\r
+<idea-plugin version="2">
+
+  <vendor>JetBrains</vendor>
+
+  <extensions defaultExtensionNs="com.intellij">
+    <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
+    <applicationConfigurable instance="org.intellij.images.options.impl.OptionsConfigurabe" id="Images" displayName="Images"/>
+    <fileEditorProvider implementation="org.intellij.images.editor.impl.ImageFileEditorProvider"/>
+    <selectInTarget implementation="org.intellij.images.thumbnail.impl.ThumbnailSelectInTarget"/>
+    <applicationService serviceInterface="org.intellij.images.options.OptionsManager"
+                        serviceImplementation="org.intellij.images.options.impl.OptionsManagerImpl"/>
+    <projectService serviceInterface="org.intellij.images.thumbnail.ThumbnailManager"
+                    serviceImplementation="org.intellij.images.thumbnail.impl.ThumbnailManagerImpl"/>
+    <fileTypeFactory implementation="org.intellij.images.fileTypes.impl.ImageFileTypeManagerImpl" />
+    <fileBasedIndex implementation="org.intellij.images.index.ImageInfoIndex"/>
+    <fileLookupInfoProvider implementation="org.intellij.images.completion.ImageLookupInfoProvider"/>
+    <documentationProvider implementation="org.intellij.images.fileTypes.ImageDocumentationProvider"/>
+  </extensions>
+
+  <application-components>
+    <component>
+      <interface-class>org.intellij.images.fileTypes.ImageFileTypeManager</interface-class>
+      <implementation-class>org.intellij.images.fileTypes.impl.ImageFileTypeManagerImpl</implementation-class>
+    </component>
+  </application-components>
+
+  <actions>
+    <action id="images.color.picker" class="org.intellij.images.actions.ColorPickerForImageAction" text="Show Color Picker">
+      <add-to-group anchor="after" group-id="ProjectViewPopupMenu" relative-to-action="EditSource"/>
+    </action>
+    <action class="org.intellij.images.actions.EditExternallyAction"
+            id="Images.EditExternaly"
+            icon="ImagesIcons.EditExternaly"
+            text="Open Image in External Editor">
+      <keyboard-shortcut first-keystroke="control alt F4" keymap="$default"/>
+      <add-to-group anchor="after" group-id="ProjectViewPopupMenu" relative-to-action="EditSource"/>
+    </action>
+    <action class="org.intellij.images.actions.ShowThumbnailsAction"
+            id="Images.ShowThumbnails" text="Show Image Thumbnails">
+      <keyboard-shortcut first-keystroke="shift control T" keymap="$default"/>
+      <add-to-group anchor="after" group-id="ProjectViewPopupMenu" relative-to-action="AddToFavorites"/>
+      <add-to-group anchor="after" group-id="NavbarPopupMenu" relative-to-action="AddToFavorites"/>
+    </action>
+    <action class="org.intellij.images.actions.ToggleTransparencyChessboardAction"
+            id="Images.ToggleTransparencyChessboard"
+            icon="ImagesIcons.ToggleTransparencyChessboard"
+            text="Show Chessboard"
+            description="Show a chessboard on transparent image parts">
+    </action>
+    <group id="Images.EditorToolbar">
+      <reference id="Images.ToggleTransparencyChessboard"/>
+      <action class="org.intellij.images.editor.actions.ToggleGridAction"
+              id="Images.Editor.ToggleGrid"
+              icon="ImagesIcons.ToggleGrid"
+              text="Show Grid">
+        <keyboard-shortcut first-keystroke="control QUOTE" keymap="$default"/>
+      </action>
+      <separator/>
+      <action class="org.intellij.images.editor.actions.ZoomInAction"
+              id="Images.Editor.ZoomIn"
+              icon="AllIcons.Graph.ZoomIn"
+              text="Zoom In"
+              use-shortcut-of="ExpandAll" />
+      <action class="org.intellij.images.editor.actions.ZoomOutAction"
+              id="Images.Editor.ZoomOut"
+              icon="AllIcons.Graph.ZoomOut"
+              text="Zoom Out"
+              use-shortcut-of="CollapseAll"/>
+      <action class="org.intellij.images.editor.actions.ActualSizeAction"
+              id="Images.Editor.ActualSize"
+              icon="AllIcons.Graph.ActualZoom"
+              text="Zoom to Actual Size">
+        <keyboard-shortcut first-keystroke="control DIVIDE" keymap="$default"/>
+        <keyboard-shortcut first-keystroke="control SLASH" keymap="$default"/>
+      </action>
+    </group>
+    <group id="Images.EditorPopupMenu">
+      <reference id="CutCopyPasteGroup"/>
+      <separator/>
+      <reference id="FindUsages"/>
+      <reference id="RefactoringMenu"/>
+      <separator/>
+      <reference id="Images.EditorToolbar"/>
+      <separator/>
+      <reference id="CloseEditor"/>
+      <separator/>
+      <reference id="AddToFavorites"/>
+      <separator/>
+      <reference id="VersionControlsGroup"/>
+      <separator/>
+      <reference id="images.color.picker" />
+      <reference id="Images.EditExternaly"/>
+      <reference id="ExternalToolsGroup"/>
+    </group>
+    <group id="Images.ThumbnailsToolbar">
+      <action class="org.intellij.images.thumbnail.actions.UpFolderAction"
+              id="Images.Thumbnails.UpFolder"
+              text="Parent Folder"
+              description="Show image thumbnails from the containing folder"
+              icon="AllIcons.Nodes.UpFolder">
+        <keyboard-shortcut first-keystroke="BACK_SPACE" keymap="$default"/>
+      </action>
+      <action class="org.intellij.images.thumbnail.actions.ToggleRecursiveAction"
+              id="Images.Thumbnails.ToggleRecursive"
+              text="Recursive"
+              description="Toggle whether to show the images from subfolders recursively"
+              icon="AllIcons.ObjectBrowser.FlattenPackages">
+        <keyboard-shortcut first-keystroke="control MULTIPLY" keymap="$default"/>
+      </action>
+      <separator/>
+      <reference id="Images.ToggleTransparencyChessboard"/>
+      <separator/>
+      <action class="org.intellij.images.thumbnail.actions.HideThumbnailsAction"
+              id="Images.Thumbnails.Hide"
+              text="Hide"
+              description="Hide image thumbnails"
+              icon="AllIcons.Actions.Cancel" use-shortcut-of="CloseContent"/>
+    </group>
+    <group id="Images.ThumbnailsPopupMenu">
+      <reference id="CutCopyPasteGroup"/>
+      <reference id="EditSource"/>
+      <action class="org.intellij.images.thumbnail.actions.EnterAction"
+              id="Images.Thumbnails.EnterAction">
+        <keyboard-shortcut first-keystroke="ENTER" keymap="$default"/>
+      </action>
+      <separator/>
+      <reference id="Images.ThumbnailsToolbar"/>
+      <separator/>
+      <reference id="FindUsages"/>
+      <reference id="RefactoringMenu"/>
+      <separator/>
+      <reference id="AddToFavorites"/>
+      <separator/>
+      <reference id="$Delete"/>
+      <separator/>
+      <reference id="VersionControlsGroup"/>
+      <reference id="CompareTwoFiles"/>
+      <separator/>
+      <reference id="Images.EditExternaly"/>
+      <reference id="ExternalToolsGroup"/>
+    </group>
+  </actions>
+</idea-plugin>
index 3b3b18b956653f167c3381cccd38a6d95ac75233..0ab10734a505da1e3fdf1c1e496d5c51214ae495 100644 (file)
-/*\r
- * Copyright 2000-2012 JetBrains s.r.o.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/**\r
- * @author: Eugene Zhuravlev\r
- * Date: Jan 17, 2003\r
- * Time: 1:42:26 PM\r
- */\r
-package com.intellij.compiler.impl;\r
-\r
-import com.intellij.CommonBundle;\r
-import com.intellij.compiler.*;\r
-import com.intellij.compiler.make.CacheCorruptedException;\r
-import com.intellij.compiler.make.CacheUtils;\r
-import com.intellij.compiler.make.ChangedConstantsDependencyProcessor;\r
-import com.intellij.compiler.make.DependencyCache;\r
-import com.intellij.compiler.progress.CompilerTask;\r
-import com.intellij.compiler.server.BuildManager;\r
-import com.intellij.compiler.server.CustomBuilderMessageHandler;\r
-import com.intellij.compiler.server.DefaultMessageHandler;\r
-import com.intellij.diagnostic.IdeErrorsDialog;\r
-import com.intellij.diagnostic.PluginException;\r
-import com.intellij.openapi.application.*;\r
-import com.intellij.openapi.compiler.*;\r
-import com.intellij.openapi.compiler.Compiler;\r
-import com.intellij.openapi.compiler.ex.CompileContextEx;\r
-import com.intellij.openapi.compiler.ex.CompilerPathsEx;\r
-import com.intellij.openapi.compiler.generic.GenericCompiler;\r
-import com.intellij.openapi.diagnostic.Logger;\r
-import com.intellij.openapi.extensions.Extensions;\r
-import com.intellij.openapi.extensions.PluginId;\r
-import com.intellij.openapi.fileEditor.FileDocumentManager;\r
-import com.intellij.openapi.fileTypes.FileType;\r
-import com.intellij.openapi.module.LanguageLevelUtil;\r
-import com.intellij.openapi.module.Module;\r
-import com.intellij.openapi.module.ModuleManager;\r
-import com.intellij.openapi.progress.ProcessCanceledException;\r
-import com.intellij.openapi.progress.ProgressIndicator;\r
-import com.intellij.openapi.progress.ProgressManager;\r
-import com.intellij.openapi.project.DumbService;\r
-import com.intellij.openapi.project.Project;\r
-import com.intellij.openapi.project.ProjectBundle;\r
-import com.intellij.openapi.projectRoots.Sdk;\r
-import com.intellij.openapi.roots.*;\r
-import com.intellij.openapi.roots.ex.ProjectRootManagerEx;\r
-import com.intellij.openapi.roots.ui.configuration.CommonContentEntriesEditor;\r
-import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;\r
-import com.intellij.openapi.ui.MessageType;\r
-import com.intellij.openapi.ui.Messages;\r
-import com.intellij.openapi.util.*;\r
-import com.intellij.openapi.util.io.FileUtil;\r
-import com.intellij.openapi.util.registry.Registry;\r
-import com.intellij.openapi.vfs.*;\r
-import com.intellij.openapi.vfs.newvfs.ManagingFS;\r
-import com.intellij.openapi.vfs.newvfs.RefreshQueue;\r
-import com.intellij.openapi.wm.StatusBar;\r
-import com.intellij.openapi.wm.ToolWindowId;\r
-import com.intellij.openapi.wm.ToolWindowManager;\r
-import com.intellij.openapi.wm.WindowManager;\r
-import com.intellij.packaging.artifacts.Artifact;\r
-import com.intellij.packaging.artifacts.ArtifactManager;\r
-import com.intellij.packaging.impl.artifacts.ArtifactImpl;\r
-import com.intellij.packaging.impl.artifacts.ArtifactUtil;\r
-import com.intellij.packaging.impl.compiler.ArtifactCompileScope;\r
-import com.intellij.packaging.impl.compiler.ArtifactCompilerUtil;\r
-import com.intellij.pom.java.LanguageLevel;\r
-import com.intellij.psi.PsiDocumentManager;\r
-import com.intellij.util.Chunk;\r
-import com.intellij.util.Function;\r
-import com.intellij.util.StringBuilderSpinAllocator;\r
-import com.intellij.util.ThrowableRunnable;\r
-import com.intellij.util.concurrency.Semaphore;\r
-import com.intellij.util.containers.ContainerUtil;\r
-import com.intellij.util.containers.HashMap;\r
-import com.intellij.util.containers.MultiMap;\r
-import com.intellij.util.containers.OrderedSet;\r
-import com.intellij.util.messages.MessageBus;\r
-import gnu.trove.TIntHashSet;\r
-import org.jetbrains.annotations.NonNls;\r
-import org.jetbrains.annotations.NotNull;\r
-import org.jetbrains.annotations.Nullable;\r
-import org.jetbrains.annotations.TestOnly;\r
-import org.jetbrains.jps.api.CmdlineProtoUtil;\r
-import org.jetbrains.jps.api.CmdlineRemoteProto;\r
-import org.jetbrains.jps.api.RequestFuture;\r
-import org.jetbrains.jps.incremental.Utils;\r
-\r
-import javax.swing.*;\r
-import java.io.*;\r
-import java.util.*;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-import static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope;\r
-\r
-public class CompileDriver {\r
-\r
-  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.CompileDriver");\r
-  // to be used in tests only for debug output\r
-  public static volatile boolean ourDebugMode = false;\r
-\r
-  private final Project myProject;\r
-  private final Map<Pair<IntermediateOutputCompiler, Module>, Pair<VirtualFile, VirtualFile>> myGenerationCompilerModuleToOutputDirMap; // [IntermediateOutputCompiler, Module] -> [ProductionSources, TestSources]\r
-  private final String myCachesDirectoryPath;\r
-  private boolean myShouldClearOutputDirectory;\r
-\r
-  private final Map<Module, String> myModuleOutputPaths = new HashMap<Module, String>();\r
-  private final Map<Module, String> myModuleTestOutputPaths = new HashMap<Module, String>();\r
-\r
-  @NonNls private static final String VERSION_FILE_NAME = "version.dat";\r
-  @NonNls private static final String LOCK_FILE_NAME = "in_progress.dat";\r
-\r
-  private static final boolean GENERATE_CLASSPATH_INDEX = "true".equals(System.getProperty("generate.classpath.index"));\r
-  private static final String PROP_PERFORM_INITIAL_REFRESH = "compiler.perform.outputs.refresh.on.start";\r
-  private static final Key<Boolean> REFRESH_DONE_KEY = Key.create("_compiler.initial.refresh.done_");\r
-\r
-  private static final FileProcessingCompilerAdapterFactory FILE_PROCESSING_COMPILER_ADAPTER_FACTORY = new FileProcessingCompilerAdapterFactory() {\r
-    public FileProcessingCompilerAdapter create(CompileContext context, FileProcessingCompiler compiler) {\r
-      return new FileProcessingCompilerAdapter(context, compiler);\r
-    }\r
-  };\r
-  private static final FileProcessingCompilerAdapterFactory FILE_PACKAGING_COMPILER_ADAPTER_FACTORY = new FileProcessingCompilerAdapterFactory() {\r
-    public FileProcessingCompilerAdapter create(CompileContext context, FileProcessingCompiler compiler) {\r
-      return new PackagingCompilerAdapter(context, (PackagingCompiler)compiler);\r
-    }\r
-  };\r
-  private CompilerFilter myCompilerFilter = CompilerFilter.ALL;\r
-  private static final CompilerFilter SOURCE_PROCESSING_ONLY = new CompilerFilter() {\r
-    public boolean acceptCompiler(Compiler compiler) {\r
-      return compiler instanceof SourceProcessingCompiler;\r
-    }\r
-  };\r
-  private static final CompilerFilter ALL_EXCEPT_SOURCE_PROCESSING = new CompilerFilter() {\r
-    public boolean acceptCompiler(Compiler compiler) {\r
-      return !SOURCE_PROCESSING_ONLY.acceptCompiler(compiler);\r
-    }\r
-  };\r
-\r
-  private Set<File> myAllOutputDirectories;\r
-  private static final long ONE_MINUTE_MS = 60L /*sec*/ * 1000L /*millisec*/;\r
-\r
-  public CompileDriver(Project project) {\r
-    myProject = project;\r
-    myCachesDirectoryPath = CompilerPaths.getCacheStoreDirectory(myProject).getPath().replace('/', File.separatorChar);\r
-    myShouldClearOutputDirectory = CompilerWorkspaceConfiguration.getInstance(myProject).CLEAR_OUTPUT_DIRECTORY;\r
-\r
-    myGenerationCompilerModuleToOutputDirMap = new HashMap<Pair<IntermediateOutputCompiler, Module>, Pair<VirtualFile, VirtualFile>>();\r
-\r
-    if (!useOutOfProcessBuild()) {\r
-      final LocalFileSystem lfs = LocalFileSystem.getInstance();\r
-      final IntermediateOutputCompiler[] generatingCompilers = CompilerManager.getInstance(myProject).getCompilers(IntermediateOutputCompiler.class, myCompilerFilter);\r
-      final Module[] allModules = ModuleManager.getInstance(myProject).getModules();\r
-      final CompilerConfiguration config = CompilerConfiguration.getInstance(project);\r
-      for (Module module : allModules) {\r
-        for (IntermediateOutputCompiler compiler : generatingCompilers) {\r
-          final VirtualFile productionOutput = lookupVFile(lfs, CompilerPaths.getGenerationOutputPath(compiler, module, false));\r
-          final VirtualFile testOutput = lookupVFile(lfs, CompilerPaths.getGenerationOutputPath(compiler, module, true));\r
-          final Pair<IntermediateOutputCompiler, Module> pair = new Pair<IntermediateOutputCompiler, Module>(compiler, module);\r
-          final Pair<VirtualFile, VirtualFile> outputs = new Pair<VirtualFile, VirtualFile>(productionOutput, testOutput);\r
-          myGenerationCompilerModuleToOutputDirMap.put(pair, outputs);\r
-        }\r
-        if (config.getAnnotationProcessingConfiguration(module).isEnabled()) {\r
-          final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);\r
-          if (path != null) {\r
-            lookupVFile(lfs, path);  // ensure the file is created and added to VFS\r
-          }\r
-        }\r
-      }\r
-    }\r
-  }\r
-\r
-  public void setCompilerFilter(CompilerFilter compilerFilter) {\r
-    myCompilerFilter = compilerFilter == null? CompilerFilter.ALL : compilerFilter;\r
-  }\r
-\r
-  public void rebuild(CompileStatusNotification callback) {\r
-    final CompileScope compileScope;\r
-    ProjectCompileScope projectScope = new ProjectCompileScope(myProject);\r
-    if (useOutOfProcessBuild()) {\r
-      compileScope = projectScope;\r
-    }\r
-    else {\r
-      CompileScope scopeWithArtifacts = ArtifactCompileScope.createScopeWithArtifacts(projectScope, ArtifactUtil.getArtifactWithOutputPaths(myProject), false);\r
-      compileScope = addAdditionalRoots(scopeWithArtifacts, ALL_EXCEPT_SOURCE_PROCESSING);\r
-    }\r
-    doRebuild(callback, null, true, compileScope);\r
-  }\r
-\r
-  public void make(CompileScope scope, CompileStatusNotification callback) {\r
-    if (!useOutOfProcessBuild()) {\r
-      scope = addAdditionalRoots(scope, ALL_EXCEPT_SOURCE_PROCESSING);\r
-    }\r
-    if (validateCompilerConfiguration(scope, false)) {\r
-      startup(scope, false, false, callback, null, true);\r
-    }\r
-    else {\r
-      callback.finished(true, 0, 0, DummyCompileContext.getInstance());\r
-    }\r
-  }\r
-\r
-  public boolean isUpToDate(CompileScope scope) {\r
-    if (LOG.isDebugEnabled()) {\r
-      LOG.debug("isUpToDate operation started");\r
-    }\r
-    if (!useOutOfProcessBuild()) {\r
-      scope = addAdditionalRoots(scope, ALL_EXCEPT_SOURCE_PROCESSING);\r
-    }\r
-\r
-    final CompilerTask task = new CompilerTask(myProject, "Classes up-to-date check", true, false);\r
-    final DependencyCache cache = useOutOfProcessBuild()? null : createDependencyCache();\r
-    final CompileContextImpl compileContext = new CompileContextImpl(myProject, task, scope, cache, true, false);\r
-\r
-    if (!useOutOfProcessBuild()) {\r
-      checkCachesVersion(compileContext, ManagingFS.getInstance().getCreationTimestamp());\r
-      if (compileContext.isRebuildRequested()) {\r
-        if (LOG.isDebugEnabled()) {\r
-          LOG.debug("Rebuild requested, up-to-date=false");\r
-        }\r
-        return false;\r
-      }\r
-\r
-      for (Map.Entry<Pair<IntermediateOutputCompiler, Module>, Pair<VirtualFile, VirtualFile>> entry : myGenerationCompilerModuleToOutputDirMap.entrySet()) {\r
-        final Pair<VirtualFile, VirtualFile> outputs = entry.getValue();\r
-        final Pair<IntermediateOutputCompiler, Module> key = entry.getKey();\r
-        final Module module = key.getSecond();\r
-        compileContext.assignModule(outputs.getFirst(), module, false, key.getFirst());\r
-        compileContext.assignModule(outputs.getSecond(), module, true, key.getFirst());\r
-      }\r
-    }\r
-\r
-    final Ref<ExitStatus> result = new Ref<ExitStatus>();\r
-\r
-    final Runnable compileWork;\r
-    if (useOutOfProcessBuild()) {\r
-      compileWork = new Runnable() {\r
-        public void run() {\r
-          final ProgressIndicator indicator = compileContext.getProgressIndicator();\r
-          if (indicator.isCanceled() || myProject.isDisposed()) {\r
-            return;\r
-          }\r
-          try {\r
-            final Collection<String> paths = CompileScopeUtil.fetchFiles(compileContext);\r
-            List<TargetTypeBuildScope> scopes = new ArrayList<TargetTypeBuildScope>();\r
-            if (paths.isEmpty()) {\r
-              if (!compileContext.isRebuild() && !CompileScopeUtil.allProjectModulesAffected(compileContext)) {\r
-                CompileScopeUtil.addScopesForModules(Arrays.asList(compileContext.getCompileScope().getAffectedModules()), scopes);\r
-              }\r
-              else {\r
-                scopes.addAll(CmdlineProtoUtil.createAllModulesScopes());\r
-              }\r
-              for (BuildTargetScopeProvider provider : BuildTargetScopeProvider.EP_NAME.getExtensions()) {\r
-                scopes = CompileScopeUtil.mergeScopes(scopes, provider.getBuildTargetScopes(compileContext.getCompileScope(), myCompilerFilter, myProject));\r
-              }\r
-            }\r
-            final RequestFuture future = compileInExternalProcess(compileContext, scopes, paths, true);\r
-            if (future != null) {\r
-              while (!future.waitFor(200L , TimeUnit.MILLISECONDS)) {\r
-                if (indicator.isCanceled()) {\r
-                  future.cancel(false);\r
-                }\r
-              }\r
-            }\r
-          }\r
-          catch (Throwable e) {\r
-            LOG.error(e);\r
-          }\r
-          finally {\r
-            result.set(COMPILE_SERVER_BUILD_STATUS.get(compileContext));\r
-            CompilerCacheManager.getInstance(myProject).flushCaches();\r
-          }\r
-        }\r
-      };\r
-    }\r
-    else {\r
-      compileWork = new Runnable() {\r
-        public void run() {\r
-          try {\r
-            myAllOutputDirectories = getAllOutputDirectories(compileContext);\r
-            // need this for updating zip archives experiment, uncomment if the feature is turned on\r
-            //myOutputFinder = new OutputPathFinder(myAllOutputDirectories);\r
-            result.set(doCompile(compileContext, false, false, true));\r
-          }\r
-          finally {\r
-            CompilerCacheManager.getInstance(myProject).flushCaches();\r
-          }\r
-        }\r
-      };\r
-    }\r
-    task.start(compileWork, null);\r
-\r
-    if (LOG.isDebugEnabled()) {\r
-      LOG.debug("isUpToDate operation finished");\r
-    }\r
-\r
-    return ExitStatus.UP_TO_DATE.equals(result.get());\r
-  }\r
-\r
-  private DependencyCache createDependencyCache() {\r
-    return new DependencyCache(myCachesDirectoryPath + File.separator + ".dependency-info");\r
-  }\r
-\r
-  public void compile(CompileScope scope, CompileStatusNotification callback, boolean clearingOutputDirsPossible) {\r
-    myShouldClearOutputDirectory &= clearingOutputDirsPossible;\r
-    if (containsFileIndexScopes(scope)) {\r
-      scope = addAdditionalRoots(scope, ALL_EXCEPT_SOURCE_PROCESSING);\r
-    }\r
-    if (validateCompilerConfiguration(scope, false)) {\r
-      startup(scope, false, true, callback, null, true);\r
-    }\r
-    else {\r
-      callback.finished(true, 0, 0, DummyCompileContext.getInstance());\r
-    }\r
-  }\r
-\r
-  private static boolean containsFileIndexScopes(CompileScope scope) {\r
-    if (scope instanceof CompositeScope) {\r
-      for (CompileScope childScope : ((CompositeScope)scope).getScopes()) {\r
-        if (containsFileIndexScopes(childScope)) {\r
-          return true;\r
-        }\r
-      }\r
-    }\r
-    return scope instanceof FileIndexCompileScope;\r
-  }\r
-\r
-  private static class CompileStatus {\r
-    final int CACHE_FORMAT_VERSION;\r
-    final boolean COMPILATION_IN_PROGRESS;\r
-    final long VFS_CREATION_STAMP;\r
-\r
-    private CompileStatus(int cacheVersion, boolean isCompilationInProgress, long vfsStamp) {\r
-      CACHE_FORMAT_VERSION = cacheVersion;\r
-      COMPILATION_IN_PROGRESS = isCompilationInProgress;\r
-      VFS_CREATION_STAMP = vfsStamp;\r
-    }\r
-  }\r
-\r
-  private CompileStatus readStatus() {\r
-    final boolean isInProgress = getLockFile().exists();\r
-    int version = -1;\r
-    long vfsStamp = -1L;\r
-    try {\r
-      final File versionFile = new File(myCachesDirectoryPath, VERSION_FILE_NAME);\r
-      DataInputStream in = new DataInputStream(new FileInputStream(versionFile));\r
-      try {\r
-        version = in.readInt();\r
-        try {\r
-          vfsStamp = in.readLong();\r
-        }\r
-        catch (IOException ignored) {\r
-        }\r
-      }\r
-      finally {\r
-        in.close();\r
-      }\r
-    }\r
-    catch (FileNotFoundException e) {\r
-      // ignore\r
-    }\r
-    catch (IOException e) {\r
-      LOG.info(e);  // may happen in case of IDEA crashed and the file is not written properly\r
-      return null;\r
-    }\r
-    return new CompileStatus(version, isInProgress, vfsStamp);\r
-  }\r
-\r
-  private void writeStatus(CompileStatus status, CompileContext context) {\r
-    final File statusFile = new File(myCachesDirectoryPath, VERSION_FILE_NAME);\r
-\r
-    final File lockFile = getLockFile();\r
-    try {\r
-      FileUtil.createIfDoesntExist(statusFile);\r
-      DataOutputStream out = new DataOutputStream(new FileOutputStream(statusFile));\r
-      try {\r
-        out.writeInt(status.CACHE_FORMAT_VERSION);\r
-        out.writeLong(status.VFS_CREATION_STAMP);\r
-      }\r
-      finally {\r
-        out.close();\r
-      }\r
-      if (status.COMPILATION_IN_PROGRESS) {\r
-        FileUtil.createIfDoesntExist(lockFile);\r
-      }\r
-      else {\r
-        deleteFile(lockFile);\r
-      }\r
-    }\r
-    catch (IOException e) {\r
-      context.addMessage(CompilerMessageCategory.ERROR, CompilerBundle.message("compiler.error.exception", e.getMessage()), null, -1, -1);\r
-    }\r
-  }\r
-\r
-  private File getLockFile() {\r
-    return new File(CompilerPaths.getCompilerSystemDirectory(myProject), LOCK_FILE_NAME);\r
-  }\r
-\r
-  private void doRebuild(CompileStatusNotification callback,\r
-                         CompilerMessage message,\r
-                         final boolean checkCachesVersion,\r
-                         final CompileScope compileScope) {\r
-    if (validateCompilerConfiguration(compileScope, !useOutOfProcessBuild())) {\r
-      startup(compileScope, true, false, callback, message, checkCachesVersion);\r
-    }\r
-    else {\r
-      callback.finished(true, 0, 0, DummyCompileContext.getInstance());\r
-    }\r
-  }\r
-\r
-  private CompileScope addAdditionalRoots(CompileScope originalScope, final CompilerFilter filter) {\r
-    CompileScope scope = attachIntermediateOutputDirectories(originalScope, filter);\r
-\r
-    final AdditionalCompileScopeProvider[] scopeProviders = Extensions.getExtensions(AdditionalCompileScopeProvider.EXTENSION_POINT_NAME);\r
-    CompileScope baseScope = scope;\r
-    for (AdditionalCompileScopeProvider scopeProvider : scopeProviders) {\r
-      final CompileScope additionalScope = scopeProvider.getAdditionalScope(baseScope, filter, myProject);\r
-      if (additionalScope != null) {\r
-        scope = new CompositeScope(scope, additionalScope);\r
-      }\r
-    }\r
-    return scope;\r
-  }\r
-\r
-  private CompileScope attachIntermediateOutputDirectories(CompileScope originalScope, CompilerFilter filter) {\r
-    CompileScope scope = originalScope;\r
-    final Set<Module> affected = new HashSet<Module>(Arrays.asList(originalScope.getAffectedModules()));\r
-    for (Map.Entry<Pair<IntermediateOutputCompiler, Module>, Pair<VirtualFile, VirtualFile>> entry : myGenerationCompilerModuleToOutputDirMap.entrySet()) {\r
-      final Module module = entry.getKey().getSecond();\r
-      if (affected.contains(module) && filter.acceptCompiler(entry.getKey().getFirst())) {\r
-        final Pair<VirtualFile, VirtualFile> outputs = entry.getValue();\r
-        scope = new CompositeScope(scope, new FileSetCompileScope(Arrays.asList(outputs.getFirst(), outputs.getSecond()), new Module[]{module}));\r
-      }\r
-    }\r
-    return scope;\r
-  }\r
-\r
-  private void attachAnnotationProcessorsOutputDirectories(CompileContextEx context) {\r
-    final LocalFileSystem lfs = LocalFileSystem.getInstance();\r
-    final CompilerConfiguration config = CompilerConfiguration.getInstance(myProject);\r
-    final Set<Module> affected = new HashSet<Module>(Arrays.asList(context.getCompileScope().getAffectedModules()));\r
-    for (Module module : affected) {\r
-      if (!config.getAnnotationProcessingConfiguration(module).isEnabled()) {\r
-        continue;\r
-      }\r
-      final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);\r
-      if (path == null) {\r
-        continue;\r
-      }\r
-      final VirtualFile vFile = lfs.findFileByPath(path);\r
-      if (vFile == null) {\r
-        continue;\r
-      }\r
-      if (ModuleRootManager.getInstance(module).getFileIndex().isInSourceContent(vFile)) {\r
-        // no need to add, is already marked as source\r
-        continue;\r
-      }\r
-      context.addScope(new FileSetCompileScope(Collections.singletonList(vFile), new Module[]{module}));\r
-      context.assignModule(vFile, module, false, null);\r
-    }\r
-  }\r
-\r
-  @Nullable\r
-  private RequestFuture compileInExternalProcess(final @NotNull CompileContextImpl compileContext,\r
-                                                 @NotNull List<TargetTypeBuildScope> scopes,\r
-                                                 final @NotNull Collection<String> paths,\r
-                                                 final boolean onlyCheckUpToDate)\r
-    throws Exception {\r
-    final CompileScope scope = compileContext.getCompileScope();\r
-    // need to pass scope's user data to server\r
-    final Map<String, String> builderParams;\r
-    if (onlyCheckUpToDate) {\r
-      builderParams = Collections.emptyMap();\r
-    }\r
-    else {\r
-      final Map<Key, Object> exported = scope.exportUserData();\r
-      if (!exported.isEmpty()) {\r
-        builderParams = new HashMap<String, String>();\r
-        for (Map.Entry<Key, Object> entry : exported.entrySet()) {\r
-          final String _key = entry.getKey().toString();\r
-          final String _value = entry.getValue().toString();\r
-          builderParams.put(_key, _value);\r
-        }\r
-      }\r
-      else {\r
-        builderParams = Collections.emptyMap();\r
-      }\r
-    }\r
-\r
-    final MessageBus messageBus = myProject.getMessageBus();\r
-\r
-    final BuildManager buildManager = BuildManager.getInstance();\r
-    buildManager.cancelAutoMakeTasks(myProject);\r
-    return buildManager.scheduleBuild(myProject, compileContext.isRebuild(), compileContext.isMake(), onlyCheckUpToDate, scopes, paths, builderParams, new DefaultMessageHandler(myProject) {\r
-\r
-      @Override\r
-      public void buildStarted(UUID sessionId) {\r
-      }\r
-\r
-      @Override\r
-      public void sessionTerminated(final UUID sessionId) {\r
-        if (compileContext.shouldUpdateProblemsView()) {\r
-          final ProblemsView view = ProblemsViewImpl.SERVICE.getInstance(myProject);\r
-          view.clearProgress();\r
-          view.clearOldMessages(compileContext.getCompileScope(), compileContext.getSessionId());\r
-        }\r
-      }\r
-\r
-      @Override\r
-      public void handleFailure(UUID sessionId, CmdlineRemoteProto.Message.Failure failure) {\r
-        compileContext.addMessage(CompilerMessageCategory.ERROR, failure.getDescription(), null, -1, -1);\r
-        final String trace = failure.getStacktrace();\r
-        if (trace != null) {\r
-          LOG.info(trace);\r
-          System.out.println(trace);\r
-        }\r
-        compileContext.putUserData(COMPILE_SERVER_BUILD_STATUS, ExitStatus.ERRORS);\r
-      }\r
-\r
-      @Override\r
-      protected void handleCompileMessage(UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage.CompileMessage message) {\r
-        final CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind kind = message.getKind();\r
-        //System.out.println(compilerMessage.getText());\r
-        final String messageText = message.getText();\r
-        if (kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.PROGRESS) {\r
-          final ProgressIndicator indicator = compileContext.getProgressIndicator();\r
-          indicator.setText(messageText);\r
-          if (message.hasDone()) {\r
-            indicator.setFraction(message.getDone());\r
-          }\r
-        }\r
-        else {\r
-          final CompilerMessageCategory category = kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.ERROR ? CompilerMessageCategory.ERROR\r
-            : kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.WARNING ? CompilerMessageCategory.WARNING : CompilerMessageCategory.INFORMATION;\r
-\r
-          String sourceFilePath = message.hasSourceFilePath() ? message.getSourceFilePath() : null;\r
-          if (sourceFilePath != null) {\r
-            sourceFilePath = FileUtil.toSystemIndependentName(sourceFilePath);\r
-          }\r
-          final long line = message.hasLine() ? message.getLine() : -1;\r
-          final long column = message.hasColumn() ? message.getColumn() : -1;\r
-          final String srcUrl = sourceFilePath != null ? VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, sourceFilePath) : null;\r
-          compileContext.addMessage(category, messageText, srcUrl, (int)line, (int)column);\r
-        }\r
-      }\r
-\r
-      @Override\r
-      protected void handleBuildEvent(UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage.BuildEvent event) {\r
-        final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type eventType = event.getEventType();\r
-        switch (eventType) {\r
-          case FILES_GENERATED:\r
-            final List<CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile> generated = event.getGeneratedFilesList();\r
-            final CompilationStatusListener publisher = messageBus.syncPublisher(CompilerTopics.COMPILATION_STATUS);\r
-            for (CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile generatedFile : generated) {\r
-              final String root = FileUtil.toSystemIndependentName(generatedFile.getOutputRoot());\r
-              final String relativePath = FileUtil.toSystemIndependentName(generatedFile.getRelativePath());\r
-              publisher.fileGenerated(root, relativePath);\r
-            }\r
-            break;\r
-          case BUILD_COMPLETED:\r
-            ExitStatus status = ExitStatus.SUCCESS;\r
-            if (event.hasCompletionStatus()) {\r
-              final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status completionStatus = event.getCompletionStatus();\r
-              switch (completionStatus) {\r
-                case CANCELED:\r
-                  status = ExitStatus.CANCELLED;\r
-                  break;\r
-                case ERRORS:\r
-                  status = ExitStatus.ERRORS;\r
-                  break;\r
-                case SUCCESS:\r
-                  status = ExitStatus.SUCCESS;\r
-                  break;\r
-                case UP_TO_DATE:\r
-                  status = ExitStatus.UP_TO_DATE;\r
-                  break;\r
-              }\r
-            }\r
-            compileContext.putUserDataIfAbsent(COMPILE_SERVER_BUILD_STATUS, status);\r
-            break;\r
-          case CUSTOM_BUILDER_MESSAGE:\r
-            if (event.hasCustomBuilderMessage()) {\r
-              CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.CustomBuilderMessage message = event.getCustomBuilderMessage();\r
-              messageBus.syncPublisher(CustomBuilderMessageHandler.TOPIC).messageReceived(message.getBuilderId(), message.getMessageType(),\r
-                                                                                          message.getMessageText());\r
-            }\r
-            break;\r
-        }\r
-      }\r
-    });\r
-  }\r
-\r
-\r
-  private static final Key<ExitStatus> COMPILE_SERVER_BUILD_STATUS = Key.create("COMPILE_SERVER_BUILD_STATUS");\r
-\r
-  private void startup(final CompileScope scope,\r
-                       final boolean isRebuild,\r
-                       final boolean forceCompile,\r
-                       final CompileStatusNotification callback,\r
-                       final CompilerMessage message,\r
-                       final boolean checkCachesVersion) {\r
-    ApplicationManager.getApplication().assertIsDispatchThread();\r
-\r
-    final boolean useExtProcessBuild = useOutOfProcessBuild();\r
-\r
-    final String contentName =\r
-      forceCompile ? CompilerBundle.message("compiler.content.name.compile") : CompilerBundle.message("compiler.content.name.make");\r
-    final CompilerTask compileTask = new CompilerTask(myProject, contentName, ApplicationManager.getApplication().isUnitTestMode(), true);\r
-\r
-    StatusBar.Info.set("", myProject, "Compiler");\r
-    if (useExtProcessBuild) {\r
-      // ensure the project model seen by build process is up-to-date\r
-      myProject.save();\r
-    }\r
-    PsiDocumentManager.getInstance(myProject).commitAllDocuments();\r
-    FileDocumentManager.getInstance().saveAllDocuments();\r
-\r
-    final DependencyCache dependencyCache = useExtProcessBuild ? null: createDependencyCache();\r
-    final CompileContextImpl compileContext =\r
-      new CompileContextImpl(myProject, compileTask, scope, dependencyCache, !isRebuild && !forceCompile, isRebuild);\r
-\r
-    if (!useExtProcessBuild) {\r
-      for (Map.Entry<Pair<IntermediateOutputCompiler, Module>, Pair<VirtualFile, VirtualFile>> entry : myGenerationCompilerModuleToOutputDirMap.entrySet()) {\r
-        final Pair<VirtualFile, VirtualFile> outputs = entry.getValue();\r
-        final Pair<IntermediateOutputCompiler, Module> key = entry.getKey();\r
-        final Module module = key.getSecond();\r
-        compileContext.assignModule(outputs.getFirst(), module, false, key.getFirst());\r
-        compileContext.assignModule(outputs.getSecond(), module, true, key.getFirst());\r
-      }\r
-      attachAnnotationProcessorsOutputDirectories(compileContext);\r
-    }\r
-\r
-    final Runnable compileWork;\r
-    if (useExtProcessBuild) {\r
-      compileWork = new Runnable() {\r
-        public void run() {\r
-          final ProgressIndicator indicator = compileContext.getProgressIndicator();\r
-          if (indicator.isCanceled() || myProject.isDisposed()) {\r
-            if (callback != null) {\r
-              callback.finished(true, 0, 0, compileContext);\r
-            }\r
-            return;\r
-          }\r
-          try {\r
-            LOG.info("COMPILATION STARTED (BUILD PROCESS)");\r
-            if (message != null) {\r
-              compileContext.addMessage(message);\r
-            }\r
-            if (!executeCompileTasks(compileContext, true)) {\r
-              COMPILE_SERVER_BUILD_STATUS.set(compileContext, ExitStatus.CANCELLED);\r
-              return;\r
-            }\r
-\r
-            final Collection<String> paths = CompileScopeUtil.fetchFiles(compileContext);\r
-            List<TargetTypeBuildScope> scopes = new ArrayList<TargetTypeBuildScope>();\r
-            if (paths.isEmpty()) {\r
-              if (!isRebuild && !CompileScopeUtil.allProjectModulesAffected(compileContext)) {\r
-                CompileScopeUtil.addScopesForModules(Arrays.asList(compileContext.getCompileScope().getAffectedModules()), scopes);\r
-              }\r
-              else {\r
-                scopes.addAll(CmdlineProtoUtil.createAllModulesScopes());\r
-              }\r
-              for (BuildTargetScopeProvider provider : BuildTargetScopeProvider.EP_NAME.getExtensions()) {\r
-                scopes = CompileScopeUtil.mergeScopes(scopes, provider.getBuildTargetScopes(scope, myCompilerFilter, myProject));\r
-              }\r
-            }\r
-            final RequestFuture future = compileInExternalProcess(compileContext, scopes, paths, false);\r
-            if (future != null) {\r
-              while (!future.waitFor(200L , TimeUnit.MILLISECONDS)) {\r
-                if (indicator.isCanceled()) {\r
-                  future.cancel(false);\r
-                }\r
-              }\r
-              if (!executeCompileTasks(compileContext, false)) {\r
-                COMPILE_SERVER_BUILD_STATUS.set(compileContext, ExitStatus.CANCELLED);\r
-                return;\r
-              }\r
-            }\r
-          }\r
-          catch (Throwable e) {\r
-            LOG.error(e); // todo\r
-          }\r
-          finally {\r
-            CompilerCacheManager.getInstance(myProject).flushCaches();\r
-\r
-            final long duration = notifyCompilationCompleted(compileContext, callback, COMPILE_SERVER_BUILD_STATUS.get(compileContext));\r
-            CompilerUtil.logDuration(\r
-              "\tCOMPILATION FINISHED (BUILD PROCESS); Errors: " +\r
-              compileContext.getMessageCount(CompilerMessageCategory.ERROR) +\r
-              "; warnings: " +\r
-              compileContext.getMessageCount(CompilerMessageCategory.WARNING),\r
-              duration\r
-            );\r
-\r
-            // refresh on output roots is required in order for the order enumerator to see all roots via VFS\r
-            final Set<File> outputs = new HashSet<File>();\r
-            for (final String path : CompilerPathsEx.getOutputPaths(ModuleManager.getInstance(myProject).getModules())) {\r
-              outputs.add(new File(path));\r
-            }\r
-            if (!outputs.isEmpty()) {\r
-              LocalFileSystem.getInstance().refreshIoFiles(outputs, true, false, null);\r
-            }\r
-          }\r
-        }\r
-      };\r
-    }\r
-    else {\r
-      compileWork = new Runnable() {\r
-        public void run() {\r
-          if (compileContext.getProgressIndicator().isCanceled()) {\r
-            if (callback != null) {\r
-              callback.finished(true, 0, 0, compileContext);\r
-            }\r
-            return;\r
-          }\r
-          try {\r
-            if (myProject.isDisposed()) {\r
-              return;\r
-            }\r
-            LOG.info("COMPILATION STARTED");\r
-            if (message != null) {\r
-              compileContext.addMessage(message);\r
-            }\r
-            TranslatingCompilerFilesMonitor.getInstance().ensureInitializationCompleted(myProject, compileContext.getProgressIndicator());\r
-            doCompile(compileContext, isRebuild, forceCompile, callback, checkCachesVersion);\r
-          }\r
-          finally {\r
-            FileUtil.delete(CompilerPaths.getRebuildMarkerFile(myProject));\r
-          }\r
-        }\r
-      };\r
-    }\r
-\r
-    compileTask.start(compileWork, new Runnable() {\r
-      public void run() {\r
-        if (isRebuild) {\r
-          final int rv = Messages.showOkCancelDialog(\r
-              myProject, "You are about to rebuild the whole project.\nRun 'Make Project' instead?", "Confirm Project Rebuild",\r
-              "Make", "Rebuild", Messages.getQuestionIcon()\r
-          );\r
-          if (rv == 0 /*yes, please, do run make*/) {\r
-            startup(scope, false, false, callback, null, checkCachesVersion);\r
-            return;\r
-          }\r
-        }\r
-        startup(scope, isRebuild, forceCompile, callback, message, checkCachesVersion);\r
-      }\r
-    });\r
-  }\r
-\r
-  @Nullable @TestOnly\r
-  public static ExitStatus getExternalBuildExitStatus(CompileContext context) {\r
-    return context.getUserData(COMPILE_SERVER_BUILD_STATUS);\r
-  }\r
-\r
-  private void doCompile(final CompileContextImpl compileContext,\r
-                         final boolean isRebuild,\r
-                         final boolean forceCompile,\r
-                         final CompileStatusNotification callback,\r
-                         final boolean checkCachesVersion) {\r
-    ExitStatus status = ExitStatus.ERRORS;\r
-    boolean wereExceptions = false;\r
-    final long vfsTimestamp = (ManagingFS.getInstance()).getCreationTimestamp();\r
-    try {\r
-      if (checkCachesVersion) {\r
-        checkCachesVersion(compileContext, vfsTimestamp);\r
-        if (compileContext.isRebuildRequested()) {\r
-          return;\r
-        }\r
-      }\r
-      writeStatus(new CompileStatus(CompilerConfigurationImpl.DEPENDENCY_FORMAT_VERSION, true, vfsTimestamp), compileContext);\r
-      if (compileContext.getMessageCount(CompilerMessageCategory.ERROR) > 0) {\r
-        return;\r
-      }\r
-\r
-      myAllOutputDirectories = getAllOutputDirectories(compileContext);\r
-      status = doCompile(compileContext, isRebuild, forceCompile, false);\r
-    }\r
-    catch (Throwable ex) {\r
-      if (ApplicationManager.getApplication().isUnitTestMode()) {\r
-        throw new RuntimeException(ex);\r
-      }\r
-      wereExceptions = true;\r
-      final PluginId pluginId = IdeErrorsDialog.findPluginId(ex);\r
-\r
-      final StringBuilder message = new StringBuilder();\r
-      message.append("Internal error");\r
-      if (pluginId != null) {\r
-        message.append(" (Plugin: ").append(pluginId).append(")");\r
-      }\r
-      message.append(": ").append(ex.getMessage());\r
-      compileContext.addMessage(CompilerMessageCategory.ERROR, message.toString(), null, -1, -1);\r
-      \r
-      if (pluginId != null) {\r
-        throw new PluginException(ex, pluginId);\r
-      }\r
-      throw new RuntimeException(ex);\r
-    }\r
-    finally {\r
-      dropDependencyCache(compileContext);\r
-      CompilerCacheManager.getInstance(myProject).flushCaches();\r
-      if (compileContext.isRebuildRequested()) {\r
-        ApplicationManager.getApplication().invokeLater(new Runnable() {\r
-          public void run() {\r
-            final CompilerMessageImpl msg = new CompilerMessageImpl(myProject, CompilerMessageCategory.INFORMATION, compileContext.getRebuildReason());\r
-            doRebuild(callback, msg, false, compileContext.getCompileScope());\r
-          }\r
-        }, ModalityState.NON_MODAL);\r
-      }\r
-      else {\r
-        if (!myProject.isDisposed()) {\r
-          writeStatus(new CompileStatus(CompilerConfigurationImpl.DEPENDENCY_FORMAT_VERSION, wereExceptions, vfsTimestamp), compileContext);\r
-        }\r
-        final long duration = notifyCompilationCompleted(compileContext, callback, status);\r
-        CompilerUtil.logDuration(\r
-          "\tCOMPILATION FINISHED; Errors: " +\r
-          compileContext.getMessageCount(CompilerMessageCategory.ERROR) +\r
-          "; warnings: " +\r
-          compileContext.getMessageCount(CompilerMessageCategory.WARNING),\r
-          duration\r
-        );\r
-      }\r
-    }\r
-  }\r
-\r
-  /** @noinspection SSBasedInspection*/\r
-  private long notifyCompilationCompleted(final CompileContextImpl compileContext, final CompileStatusNotification callback, final ExitStatus _status) {\r
-    final long duration = System.currentTimeMillis() - compileContext.getStartCompilationStamp();\r
-    SwingUtilities.invokeLater(new Runnable() {\r
-      public void run() {\r
-        int errorCount = 0;\r
-        int warningCount = 0;\r
-        try {\r
-          errorCount = compileContext.getMessageCount(CompilerMessageCategory.ERROR);\r
-          warningCount = compileContext.getMessageCount(CompilerMessageCategory.WARNING);\r
-          if (!myProject.isDisposed()) {\r
-            final String statusMessage = createStatusMessage(_status, warningCount, errorCount, duration);\r
-            final MessageType messageType = errorCount > 0 ? MessageType.ERROR : warningCount > 0 ? MessageType.WARNING : MessageType.INFO;\r
-            if (duration > ONE_MINUTE_MS) {\r
-              ToolWindowManager.getInstance(myProject).notifyByBalloon(ToolWindowId.MESSAGES_WINDOW, messageType, statusMessage);\r
-            }\r
-            CompilerManager.NOTIFICATION_GROUP.createNotification(statusMessage, messageType).notify(myProject);\r
-            if (_status != ExitStatus.UP_TO_DATE && compileContext.getMessageCount(null) > 0) {\r
-              compileContext.addMessage(CompilerMessageCategory.INFORMATION, statusMessage, null, -1, -1);\r
-            }\r
-          }\r
-        }\r
-        finally {\r
-          if (callback != null) {\r
-            callback.finished(_status == ExitStatus.CANCELLED, errorCount, warningCount, compileContext);\r
-          }\r
-        }\r
-      }\r
-    });\r
-    return duration;\r
-  }\r
-\r
-  private void checkCachesVersion(final CompileContextImpl compileContext, final long currentVFSTimestamp) {\r
-    if (CompilerPaths.getRebuildMarkerFile(compileContext.getProject()).exists()) {\r
-      compileContext.requestRebuildNextTime("Compiler caches are out of date, project rebuild is required");\r
-      return;\r
-    }\r
-    final CompileStatus compileStatus = readStatus();\r
-    if (compileStatus == null) {\r
-      compileContext.requestRebuildNextTime(CompilerBundle.message("error.compiler.caches.corrupted"));\r
-    }\r
-    else if (compileStatus.CACHE_FORMAT_VERSION != -1 &&\r
-             compileStatus.CACHE_FORMAT_VERSION != CompilerConfigurationImpl.DEPENDENCY_FORMAT_VERSION) {\r
-      compileContext.requestRebuildNextTime(CompilerBundle.message("error.caches.old.format"));\r
-    }\r
-    else if (compileStatus.COMPILATION_IN_PROGRESS) {\r
-      compileContext.requestRebuildNextTime(CompilerBundle.message("error.previous.compilation.failed"));\r
-    }\r
-    else if (compileStatus.VFS_CREATION_STAMP >= 0L){\r
-      if (currentVFSTimestamp != compileStatus.VFS_CREATION_STAMP) {\r
-        compileContext.requestRebuildNextTime(CompilerBundle.message("error.vfs.was.rebuilt"));\r
-      }\r
-    }\r
-  }\r
-\r
-  private static String createStatusMessage(final ExitStatus status, final int warningCount, final int errorCount, long duration) {\r
-    String message;\r
-    if (status == ExitStatus.CANCELLED) {\r
-      message = CompilerBundle.message("status.compilation.aborted");\r
-    }\r
-    else if (status == ExitStatus.UP_TO_DATE) {\r
-      message = CompilerBundle.message("status.all.up.to.date");\r
-    }\r
-    else  {\r
-      if (status == ExitStatus.SUCCESS) {\r
-        message = warningCount > 0\r
-               ? CompilerBundle.message("status.compilation.completed.successfully.with.warnings", warningCount)\r
-               : CompilerBundle.message("status.compilation.completed.successfully");\r
-      }\r
-      else {\r
-        message = CompilerBundle.message("status.compilation.completed.successfully.with.warnings.and.errors", errorCount, warningCount);\r
-      }\r
-      message = message + " in " + Utils.formatDuration(duration);\r
-    }\r
-    return message;\r
-  }\r
-\r
-  private ExitStatus doCompile(final CompileContextEx context, boolean isRebuild, final boolean forceCompile, final boolean onlyCheckStatus) {\r
-    try {\r
-      if (isRebuild) {\r
-        deleteAll(context);\r
-      }\r
-      else if (forceCompile) {\r
-        if (myShouldClearOutputDirectory) {\r
-          clearAffectedOutputPathsIfPossible(context);\r
-        }\r
-      }\r
-      if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {\r
-        if (LOG.isDebugEnabled()) {\r
-          logErrorMessages(context);\r
-        }\r
-        return ExitStatus.ERRORS;\r
-      }\r
-\r
-      if (!onlyCheckStatus) {\r
-          if (!executeCompileTasks(context, true)) {\r
-            if (LOG.isDebugEnabled()) {\r
-              LOG.debug("Compilation cancelled");\r
-            }\r
-            return ExitStatus.CANCELLED;\r
-          }\r
-        }\r
-\r
-      if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {\r
-        if (LOG.isDebugEnabled()) {\r
-          logErrorMessages(context);\r
-        }\r
-        return ExitStatus.ERRORS;\r
-      }\r
-\r
-      boolean needRecalcOutputDirs = false;\r
-      if (Registry.is(PROP_PERFORM_INITIAL_REFRESH) || !Boolean.valueOf(REFRESH_DONE_KEY.get(myProject, Boolean.FALSE))) {\r
-        REFRESH_DONE_KEY.set(myProject, Boolean.TRUE);\r
-        final long refreshStart = System.currentTimeMillis();\r
-\r
-        //need this to make sure the VFS is built\r
-        final List<VirtualFile> outputsToRefresh = new ArrayList<VirtualFile>();\r
-\r
-        final VirtualFile[] all = context.getAllOutputDirectories();\r
-\r
-        final ProgressIndicator progressIndicator = context.getProgressIndicator();\r
-\r
-        //final int totalCount = all.length + myGenerationCompilerModuleToOutputDirMap.size() * 2;\r
-        progressIndicator.pushState();\r
-        progressIndicator.setText("Inspecting output directories...");\r
-        try {\r
-          for (VirtualFile output : all) {\r
-            if (output.isValid()) {\r
-              walkChildren(output, context);\r
-            }\r
-            else {\r
-              needRecalcOutputDirs = true;\r
-              final File file = new File(output.getPath());\r
-              if (!file.exists()) {\r
-                final boolean created = file.mkdirs();\r
-                if (!created) {\r
-                  context.addMessage(CompilerMessageCategory.ERROR, "Failed to create output directory " + file.getPath(), null, 0, 0);\r
-                  return ExitStatus.ERRORS;\r
-                }\r
-              }\r
-              output = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);\r
-              if (output == null) {\r
-                context.addMessage(CompilerMessageCategory.ERROR, "Failed to locate output directory " + file.getPath(), null, 0, 0);\r
-                return ExitStatus.ERRORS;\r
-              }\r
-            }\r
-            outputsToRefresh.add(output);\r
-          }\r
-          for (Pair<IntermediateOutputCompiler, Module> pair : myGenerationCompilerModuleToOutputDirMap.keySet()) {\r
-            final Pair<VirtualFile, VirtualFile> generated = myGenerationCompilerModuleToOutputDirMap.get(pair);\r
-            walkChildren(generated.getFirst(), context);\r
-            outputsToRefresh.add(generated.getFirst());\r
-            walkChildren(generated.getSecond(), context);\r
-            outputsToRefresh.add(generated.getSecond());\r
-          }\r
-\r
-          RefreshQueue.getInstance().refresh(false, true, null, outputsToRefresh);\r
-          if (progressIndicator.isCanceled()) {\r
-            return ExitStatus.CANCELLED;\r
-          }\r
-        }\r
-        finally {\r
-          progressIndicator.popState();\r
-        }\r
-\r
-        final long initialRefreshTime = System.currentTimeMillis() - refreshStart;\r
-        CompilerUtil.logDuration("Initial VFS refresh", initialRefreshTime);\r
-      }\r
-\r
-      //DumbService.getInstance(myProject).waitForSmartMode();\r
-      final Semaphore semaphore = new Semaphore();\r
-      semaphore.down();\r
-      DumbService.getInstance(myProject).runWhenSmart(new Runnable() {\r
-        public void run() {\r
-          semaphore.up();\r
-        }\r
-      });\r
-      while (!semaphore.waitFor(500)) {\r
-        if (context.getProgressIndicator().isCanceled()) {\r
-          return ExitStatus.CANCELLED;\r
-        }\r
-      }\r
-\r
-      if (needRecalcOutputDirs) {\r
-        context.recalculateOutputDirs();\r
-      }\r
-\r
-      boolean didSomething = false;\r
-\r
-      final CompilerManager compilerManager = CompilerManager.getInstance(myProject);\r
-      GenericCompilerRunner runner = new GenericCompilerRunner(context, isRebuild, onlyCheckStatus,\r
-                                                               compilerManager.getCompilers(GenericCompiler.class, myCompilerFilter));\r
-      try {\r
-        didSomething |= generateSources(compilerManager, context, forceCompile, onlyCheckStatus);\r
-\r
-        didSomething |= invokeFileProcessingCompilers(compilerManager, context, SourceInstrumentingCompiler.class,\r
-                                                      FILE_PROCESSING_COMPILER_ADAPTER_FACTORY, forceCompile, true, onlyCheckStatus);\r
-\r
-        didSomething |= invokeFileProcessingCompilers(compilerManager, context, SourceProcessingCompiler.class,\r
-                                                      FILE_PROCESSING_COMPILER_ADAPTER_FACTORY, forceCompile, true, onlyCheckStatus);\r
-\r
-        final CompileScope intermediateSources = attachIntermediateOutputDirectories(new CompositeScope(CompileScope.EMPTY_ARRAY) {\r
-          @NotNull\r
-          public Module[] getAffectedModules() {\r
-            return context.getCompileScope().getAffectedModules();\r
-          }\r
-        }, SOURCE_PROCESSING_ONLY);\r
-        context.addScope(intermediateSources);\r
-\r
-        didSomething |= translate(context, compilerManager, forceCompile, isRebuild, onlyCheckStatus);\r
-\r
-        didSomething |= invokeFileProcessingCompilers(compilerManager, context, ClassInstrumentingCompiler.class,\r
-                                                      FILE_PROCESSING_COMPILER_ADAPTER_FACTORY, isRebuild, false, onlyCheckStatus);\r
-        didSomething |= runner.invokeCompilers(GenericCompiler.CompileOrderPlace.CLASS_INSTRUMENTING);\r
-\r
-        // explicitly passing forceCompile = false because in scopes that is narrower than ProjectScope it is impossible\r
-        // to understand whether the class to be processed is in scope or not. Otherwise compiler may process its items even if\r
-        // there were changes in completely independent files.\r
-        didSomething |= invokeFileProcessingCompilers(compilerManager, context, ClassPostProcessingCompiler.class,\r
-                                                      FILE_PROCESSING_COMPILER_ADAPTER_FACTORY, isRebuild, false, onlyCheckStatus);\r
-        didSomething |= runner.invokeCompilers(GenericCompiler.CompileOrderPlace.CLASS_POST_PROCESSING);\r
-\r
-        didSomething |= invokeFileProcessingCompilers(compilerManager, context, PackagingCompiler.class,\r
-                                                      FILE_PACKAGING_COMPILER_ADAPTER_FACTORY,\r
-                                                      isRebuild, false, onlyCheckStatus);\r
-        didSomething |= runner.invokeCompilers(GenericCompiler.CompileOrderPlace.PACKAGING);\r
-\r
-        didSomething |= invokeFileProcessingCompilers(compilerManager, context, Validator.class, FILE_PROCESSING_COMPILER_ADAPTER_FACTORY,\r
-                                                      forceCompile, true, onlyCheckStatus);\r
-        didSomething |= runner.invokeCompilers(GenericCompiler.CompileOrderPlace.VALIDATING);\r
-      }\r
-      catch (ExitException e) {\r
-        if (LOG.isDebugEnabled()) {\r
-          LOG.debug(e);\r
-          logErrorMessages(context);\r
-        }\r
-        return e.getExitStatus();\r
-      }\r
-      finally {\r
-        // drop in case it has not been dropped yet.\r
-        dropDependencyCache(context);\r
-        final VirtualFile[] allOutputDirs = context.getAllOutputDirectories();\r
-\r
-        if (didSomething && GENERATE_CLASSPATH_INDEX) {\r
-          CompilerUtil.runInContext(context, "Generating classpath index...", new ThrowableRunnable<RuntimeException>(){\r
-            public void run() {\r
-              int count = 0;\r
-              for (VirtualFile file : allOutputDirs) {\r
-                context.getProgressIndicator().setFraction((double)++count / allOutputDirs.length);\r
-                createClasspathIndex(file);\r
-              }\r
-            }\r
-          });\r
-        }\r
-\r
-      }\r
-\r
-      if (!onlyCheckStatus) {\r
-          if (!executeCompileTasks(context, false)) {\r
-            return ExitStatus.CANCELLED;\r
-          }\r
-          final int constantSearchesCount = ChangedConstantsDependencyProcessor.getConstantSearchesCount(context);\r
-          LOG.debug("Constants searches: " + constantSearchesCount);\r
-        }\r
-\r
-      if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {\r
-        if (LOG.isDebugEnabled()) {\r
-          logErrorMessages(context);\r
-        }\r
-        return ExitStatus.ERRORS;\r
-      }\r
-      if (!didSomething) {\r
-        return ExitStatus.UP_TO_DATE;\r
-      }\r
-      return ExitStatus.SUCCESS;\r
-    }\r
-    catch (ProcessCanceledException e) {\r
-      return ExitStatus.CANCELLED;\r
-    }\r
-  }\r
-\r
-  private void clearAffectedOutputPathsIfPossible(final CompileContextEx context) {\r
-    final List<File> scopeOutputs = new ReadAction<List<File>>() {\r
-      protected void run(final Result<List<File>> result) {\r
-        final MultiMap<File, Module> outputToModulesMap = new MultiMap<File, Module>();\r
-        for (Module module : ModuleManager.getInstance(myProject).getModules()) {\r
-          final CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module);\r
-          if (compilerModuleExtension == null) {\r
-            continue;\r
-          }\r
-          final String outputPathUrl = compilerModuleExtension.getCompilerOutputUrl();\r
-          if (outputPathUrl != null) {\r
-            final String path = VirtualFileManager.extractPath(outputPathUrl);\r
-            outputToModulesMap.putValue(new File(path), module);\r
-          }\r
-\r
-          final String outputPathForTestsUrl = compilerModuleExtension.getCompilerOutputUrlForTests();\r
-          if (outputPathForTestsUrl != null) {\r
-            final String path = VirtualFileManager.extractPath(outputPathForTestsUrl);\r
-            outputToModulesMap.putValue(new File(path), module);\r
-          }\r
-        }\r
-        final Set<Module> affectedModules = new HashSet<Module>(Arrays.asList(context.getCompileScope().getAffectedModules()));\r
-        List<File> scopeOutputs = new ArrayList<File>(affectedModules.size() * 2);\r
-        for (File output : outputToModulesMap.keySet()) {\r
-          if (affectedModules.containsAll(outputToModulesMap.get(output))) {\r
-            scopeOutputs.add(output);\r
-          }\r
-        }\r
-\r
-        final Set<Artifact> artifactsToBuild = ArtifactCompileScope.getArtifactsToBuild(myProject, context.getCompileScope(), true);\r
-        for (Artifact artifact : artifactsToBuild) {\r
-          final String outputFilePath = ((ArtifactImpl)artifact).getOutputDirectoryPathToCleanOnRebuild();\r
-          if (outputFilePath != null) {\r
-            scopeOutputs.add(new File(FileUtil.toSystemDependentName(outputFilePath)));\r
-          }\r
-        }\r
-        result.setResult(scopeOutputs);\r
-      }\r
-    }.execute().getResultObject();\r
-    if (scopeOutputs.size() > 0) {\r
-      CompilerUtil.runInContext(context, CompilerBundle.message("progress.clearing.output"), new ThrowableRunnable<RuntimeException>() {\r
-        public void run() {\r
-          CompilerUtil.clearOutputDirectories(scopeOutputs);\r
-        }\r
-      });\r
-    }\r
-  }\r
-\r
-  private static void logErrorMessages(final CompileContext context) {\r
-    final CompilerMessage[] errors = context.getMessages(CompilerMessageCategory.ERROR);\r
-    if (errors.length > 0) {\r
-      LOG.debug("Errors reported: ");\r
-      for (CompilerMessage error : errors) {\r
-        LOG.debug("\t" + error.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  private static void walkChildren(VirtualFile from, final CompileContext context) {\r
-    VfsUtilCore.visitChildrenRecursively(from, new VirtualFileVisitor() {\r
-      @Override\r
-      public boolean visitFile(@NotNull VirtualFile file) {\r
-        if (file.isDirectory()) {\r
-          context.getProgressIndicator().checkCanceled();\r
-          context.getProgressIndicator().setText2(file.getPresentableUrl());\r
-        }\r
-        return true;\r
-      }\r
-    });\r
-  }\r
-\r
-  private static void createClasspathIndex(final VirtualFile file) {\r
-    try {\r
-      BufferedWriter writer = new BufferedWriter(new FileWriter(new File(VfsUtilCore.virtualToIoFile(file), "classpath.index")));\r
-      try {\r
-        writeIndex(writer, file, file);\r
-      }\r
-      finally {\r
-        writer.close();\r
-      }\r
-    }\r
-    catch (IOException e) {\r
-      // Ignore. Failed to create optional classpath index\r
-    }\r
-  }\r
-\r
-  private static void writeIndex(final BufferedWriter writer, final VirtualFile root, final VirtualFile file) throws IOException {\r
-    VfsUtilCore.visitChildrenRecursively(file, new VirtualFileVisitor() {\r
-      @Override\r
-      public boolean visitFile(@NotNull VirtualFile file) {\r
-        try {\r
-          writer.write(VfsUtilCore.getRelativePath(file, root, '/'));\r
-          writer.write('\n');\r
-          return true;\r
-        }\r
-        catch (IOException e) {\r
-          throw new VisitorException(e);\r
-        }\r
-      }\r
-    }, IOException.class);\r
-  }\r
-\r
-  private static void dropDependencyCache(final CompileContextEx context) {\r
-    CompilerUtil.runInContext(context, CompilerBundle.message("progress.saving.caches"), new ThrowableRunnable<RuntimeException>(){\r
-      public void run() {\r
-        context.getDependencyCache().resetState();\r
-      }\r
-    });\r
-  }\r
-\r
-  private boolean generateSources(final CompilerManager compilerManager,\r
-                                  CompileContextEx context,\r
-                                  final boolean forceCompile,\r
-                                  final boolean onlyCheckStatus) throws ExitException {\r
-    boolean didSomething = false;\r
-\r
-    final SourceGeneratingCompiler[] sourceGenerators = compilerManager.getCompilers(SourceGeneratingCompiler.class, myCompilerFilter);\r
-    for (final SourceGeneratingCompiler sourceGenerator : sourceGenerators) {\r
-      if (context.getProgressIndicator().isCanceled()) {\r
-        throw new ExitException(ExitStatus.CANCELLED);\r
-      }\r
-\r
-      final boolean generatedSomething = generateOutput(context, sourceGenerator, forceCompile, onlyCheckStatus);\r
-\r
-      if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {\r
-        throw new ExitException(ExitStatus.ERRORS);\r
-      }\r
-      didSomething |= generatedSomething;\r
-    }\r
-    return didSomething;\r
-  }\r
-\r
-  private boolean translate(final CompileContextEx context,\r
-                            final CompilerManager compilerManager,\r
-                            final boolean forceCompile,\r
-                            boolean isRebuild,\r
-                            final boolean onlyCheckStatus) throws ExitException {\r
-\r
-    boolean didSomething = false;\r
-\r
-    final TranslatingCompiler[] translators = compilerManager.getCompilers(TranslatingCompiler.class, myCompilerFilter);\r
-\r
-\r
-    final List<Chunk<Module>> sortedChunks = Collections.unmodifiableList(ApplicationManager.getApplication().runReadAction(new Computable<List<Chunk<Module>>>() {\r
-      public List<Chunk<Module>> compute() {\r
-        final ModuleManager moduleManager = ModuleManager.getInstance(myProject);\r
-        return ModuleCompilerUtil.getSortedModuleChunks(myProject, Arrays.asList(moduleManager.getModules()));\r
-      }\r
-    }));\r
-\r
-    final DumbService dumbService = DumbService.getInstance(myProject);\r
-    try {\r
-      final Set<Module> processedModules = new HashSet<Module>();\r
-      VirtualFile[] snapshot = null;\r
-      final Map<Chunk<Module>, Collection<VirtualFile>> chunkMap = new HashMap<Chunk<Module>, Collection<VirtualFile>>();\r
-      int total = 0;\r
-      int processed = 0;\r
-      for (final Chunk<Module> currentChunk : sortedChunks) {\r
-        final TranslatorsOutputSink sink = new TranslatorsOutputSink(context, translators);\r
-        final Set<FileType> generatedTypes = new HashSet<FileType>();\r
-        Collection<VirtualFile> chunkFiles = chunkMap.get(currentChunk);\r
-        final Set<VirtualFile> filesToRecompile = new HashSet<VirtualFile>();\r
-        final Set<VirtualFile> allDependent = new HashSet<VirtualFile>();\r
-        try {\r
-          int round = 0;\r
-          boolean compiledSomethingForThisChunk = false;\r
-          Collection<VirtualFile> dependentFiles = Collections.emptyList();\r
-          final Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>> dependencyFilter = new DependentClassesCumulativeFilter();\r
-          \r
-          do {\r
-            for (int currentCompiler = 0, translatorsLength = translators.length; currentCompiler < translatorsLength; currentCompiler++) {\r
-              sink.setCurrentCompilerIndex(currentCompiler);\r
-              final TranslatingCompiler compiler = translators[currentCompiler];\r
-              if (context.getProgressIndicator().isCanceled()) {\r
-                throw new ExitException(ExitStatus.CANCELLED);\r
-              }\r
-\r
-              dumbService.waitForSmartMode();\r
-\r
-              if (snapshot == null || ContainerUtil.intersects(generatedTypes, compilerManager.getRegisteredInputTypes(compiler))) {\r
-                // rescan snapshot if previously generated files may influence the input of this compiler\r
-                final Set<VirtualFile> prevSnapshot = round > 0 && snapshot != null? new HashSet<VirtualFile>(Arrays.asList(snapshot)) : Collections.<VirtualFile>emptySet();\r
-                snapshot = ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile[]>() {\r
-                  public VirtualFile[] compute() {\r
-                    return context.getCompileScope().getFiles(null, true);\r
-                  }\r
-                });\r
-                recalculateChunkToFilesMap(context, sortedChunks, snapshot, chunkMap);\r
-                if (round == 0) {\r
-                  chunkFiles = chunkMap.get(currentChunk);\r
-                }\r
-                else {\r
-                  final Set<VirtualFile> newFiles = new HashSet<VirtualFile>(chunkMap.get(currentChunk));\r
-                  newFiles.removeAll(prevSnapshot);\r
-                  newFiles.removeAll(chunkFiles);\r
-                  if (!newFiles.isEmpty()) {\r
-                    final ArrayList<VirtualFile> merged = new ArrayList<VirtualFile>(chunkFiles.size() + newFiles.size());\r
-                    merged.addAll(chunkFiles);\r
-                    merged.addAll(newFiles);\r
-                    chunkFiles = merged;\r
-                  }\r
-                }\r
-                total = snapshot.length * translatorsLength;\r
-              }\r
-\r
-              final CompileContextEx _context;\r
-              if (compiler instanceof IntermediateOutputCompiler) {\r
-                // wrap compile context so that output goes into intermediate directories\r
-                final IntermediateOutputCompiler _compiler = (IntermediateOutputCompiler)compiler;\r
-                _context = new CompileContextExProxy(context) {\r
-                  public VirtualFile getModuleOutputDirectory(final Module module) {\r
-                    return getGenerationOutputDir(_compiler, module, false);\r
-                  }\r
-  \r
-                  public VirtualFile getModuleOutputDirectoryForTests(final Module module) {\r
-                    return getGenerationOutputDir(_compiler, module, true);\r
-                  }\r
-                };\r
-              }\r
-              else {\r
-                _context = context;\r
-              }\r
-              final boolean compiledSomething =\r
-                compileSources(_context, currentChunk, compiler, chunkFiles, round == 0? forceCompile : true, isRebuild, onlyCheckStatus, sink);\r
-  \r
-              processed += chunkFiles.size();\r
-              _context.getProgressIndicator().setFraction(((double)processed) / total);\r
-  \r
-              if (compiledSomething) {\r
-                generatedTypes.addAll(compilerManager.getRegisteredOutputTypes(compiler));\r
-              }\r
-  \r
-              didSomething |= compiledSomething;\r
-              compiledSomethingForThisChunk |= didSomething;\r
-\r
-              if (_context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {\r
-                break; // break the loop over compilers\r
-              }\r
-            }\r
-\r
-            final boolean hasUnprocessedTraverseRoots = context.getDependencyCache().hasUnprocessedTraverseRoots();\r
-            if (!isRebuild && (compiledSomethingForThisChunk || hasUnprocessedTraverseRoots)) {\r
-              final Set<VirtualFile> compiledWithErrors = CacheUtils.getFilesCompiledWithErrors(context);\r
-              filesToRecompile.removeAll(sink.getCompiledSources());\r
-              filesToRecompile.addAll(compiledWithErrors);\r
-\r
-              dependentFiles = CacheUtils.findDependentFiles(context, compiledWithErrors, dependencyFilter);\r
-              if (!processedModules.isEmpty()) {\r
-                for (Iterator<VirtualFile> it = dependentFiles.iterator(); it.hasNext();) {\r
-                  final VirtualFile next = it.next();\r
-                  final Module module = context.getModuleByFile(next);\r
-                  if (module != null && processedModules.contains(module)) {\r
-                    it.remove();\r
-                  }\r
-                }\r
-              }\r
-              \r
-              if (ourDebugMode) {\r
-                if (!dependentFiles.isEmpty()) {\r
-                  for (VirtualFile dependentFile : dependentFiles) {\r
-                    System.out.println("FOUND TO RECOMPILE: " + dependentFile.getPresentableUrl());\r
-                  }\r
-                }\r
-                else {\r
-                  System.out.println("NO FILES TO RECOMPILE");\r
-                }\r
-              }\r
-\r
-              if (!dependentFiles.isEmpty()) {\r
-                filesToRecompile.addAll(dependentFiles);\r
-                allDependent.addAll(dependentFiles);\r
-                if (context.getProgressIndicator().isCanceled() || context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {\r
-                  break;\r
-                }\r
-                final List<VirtualFile> filesInScope = getFilesInScope(context, currentChunk, dependentFiles);\r
-                if (filesInScope.isEmpty()) {\r
-                  break;\r
-                }\r
-                context.getDependencyCache().clearTraverseRoots();\r
-                chunkFiles = filesInScope;\r
-                total += chunkFiles.size() * translators.length;\r
-              }\r
-              \r
-              didSomething |= (hasUnprocessedTraverseRoots != context.getDependencyCache().hasUnprocessedTraverseRoots());\r
-            }\r
-\r
-            round++;\r
-          }\r
-          while (!dependentFiles.isEmpty() && context.getMessageCount(CompilerMessageCategory.ERROR) == 0);\r
-\r
-          if (CompilerConfiguration.MAKE_ENABLED) {\r
-            if (!context.getProgressIndicator().isCanceled()) {\r
-              // when cancelled pretend nothing was compiled and next compile will compile everything from the scratch\r
-              final ProgressIndicator indicator = context.getProgressIndicator();\r
-              final DependencyCache cache = context.getDependencyCache();\r
-\r
-              indicator.pushState();\r
-              indicator.setText(CompilerBundle.message("progress.updating.caches"));\r
-              indicator.setText2("");\r
-\r
-              cache.update();\r
-\r
-              indicator.setText(CompilerBundle.message("progress.saving.caches"));\r
-              cache.resetState();\r
-              processedModules.addAll(currentChunk.getNodes());\r
-              indicator.popState();\r
-            }\r
-          }\r
-\r
-          if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {\r
-            throw new ExitException(ExitStatus.ERRORS);\r
-          }\r
-\r
-        }\r
-        catch (CacheCorruptedException e) {\r
-          LOG.info(e);\r
-          context.requestRebuildNextTime(e.getMessage());\r
-        }\r
-        finally {\r
-          final int errorCount = context.getMessageCount(CompilerMessageCategory.ERROR);\r
-          if (errorCount != 0) {\r
-            filesToRecompile.addAll(allDependent);\r
-          }\r
-          if (filesToRecompile.size() > 0) {\r
-            sink.add(null, Collections.<TranslatingCompiler.OutputItem>emptyList(), VfsUtilCore.toVirtualFileArray(filesToRecompile));\r
-          }\r
-          if (errorCount == 0) {\r
-            // perform update only if there were no errors, so it is guaranteed that the file was processd by all neccesary compilers\r
-            sink.flushPostponedItems();\r
-          }\r
-        }\r
-      }\r
-    }\r
-    catch (ProcessCanceledException e) {\r
-      ProgressManager.getInstance().executeNonCancelableSection(new Runnable() {\r
-        public void run() {\r
-          try {\r
-            final Collection<VirtualFile> deps = CacheUtils.findDependentFiles(context, Collections.<VirtualFile>emptySet(), null);\r
-            if (deps.size() > 0) {\r
-              TranslatingCompilerFilesMonitor.getInstance().update(context, null, Collections.<TranslatingCompiler.OutputItem>emptyList(),\r
-                                                                   VfsUtilCore.toVirtualFileArray(deps));\r
-            }\r
-          }\r
-          catch (IOException ignored) {\r
-            LOG.info(ignored);\r
-          }\r
-          catch (CacheCorruptedException ignored) {\r
-            LOG.info(ignored);\r
-          }\r
-          catch (ExitException e1) {\r
-            LOG.info(e1);\r
-          }\r
-        }\r
-      });\r
-      throw e;\r
-    }\r
-    finally {\r
-      dropDependencyCache(context);\r
-      if (didSomething) {\r
-        TranslatingCompilerFilesMonitor.getInstance().updateOutputRootsLayout(myProject);\r
-      }\r
-    }\r
-    return didSomething;\r
-  }\r
-\r
-  private static List<VirtualFile> getFilesInScope(final CompileContextEx context, final Chunk<Module> chunk, final Collection<VirtualFile> files) {\r
-    final List<VirtualFile> filesInScope = new ArrayList<VirtualFile>(files.size());\r
-    ApplicationManager.getApplication().runReadAction(new Runnable() {\r
-      public void run() {\r
-        for (VirtualFile file : files) {\r
-          if (context.getCompileScope().belongs(file.getUrl())) {\r
-            final Module module = context.getModuleByFile(file);\r
-            if (chunk.getNodes().contains(module)) {\r
-              filesInScope.add(file);\r
-            }\r
-          }\r
-        }\r
-      }\r
-    });\r
-    return filesInScope;\r
-  }\r
-\r
-  private static void recalculateChunkToFilesMap(CompileContextEx context, List<Chunk<Module>> allChunks, VirtualFile[] snapshot, Map<Chunk<Module>, Collection<VirtualFile>> chunkMap) {\r
-    final Map<Module, List<VirtualFile>> moduleToFilesMap = CompilerUtil.buildModuleToFilesMap(context, snapshot);\r
-    for (Chunk<Module> moduleChunk : allChunks) {\r
-      List<VirtualFile> files = Collections.emptyList();\r
-      for (Module module : moduleChunk.getNodes()) {\r
-        final List<VirtualFile> moduleFiles = moduleToFilesMap.get(module);\r
-        if (moduleFiles != null) {\r
-          files = ContainerUtil.concat(files, moduleFiles);\r
-        }\r
-      }\r
-      chunkMap.put(moduleChunk, files);\r
-    }\r
-  }\r
-\r
-  private interface FileProcessingCompilerAdapterFactory {\r
-    FileProcessingCompilerAdapter create(CompileContext context, FileProcessingCompiler compiler);\r
-  }\r
-\r
-  private boolean invokeFileProcessingCompilers(final CompilerManager compilerManager,\r
-                                                CompileContextEx context,\r
-                                                Class<? extends FileProcessingCompiler> fileProcessingCompilerClass,\r
-                                                FileProcessingCompilerAdapterFactory factory,\r
-                                                boolean forceCompile,\r
-                                                final boolean checkScope,\r
-                                                final boolean onlyCheckStatus) throws ExitException {\r
-    boolean didSomething = false;\r
-    final FileProcessingCompiler[] compilers = compilerManager.getCompilers(fileProcessingCompilerClass, myCompilerFilter);\r
-    if (compilers.length > 0) {\r
-      try {\r
-        CacheDeferredUpdater cacheUpdater = new CacheDeferredUpdater();\r
-        try {\r
-          for (final FileProcessingCompiler compiler : compilers) {\r
-            if (context.getProgressIndicator().isCanceled()) {\r
-              throw new ExitException(ExitStatus.CANCELLED);\r
-            }\r
-\r
-            CompileContextEx _context = context;\r
-            if (compiler instanceof IntermediateOutputCompiler) {\r
-              final IntermediateOutputCompiler _compiler = (IntermediateOutputCompiler)compiler;\r
-              _context = new CompileContextExProxy(context) {\r
-                public VirtualFile getModuleOutputDirectory(final Module module) {\r
-                  return getGenerationOutputDir(_compiler, module, false);\r
-                }\r
-\r
-                public VirtualFile getModuleOutputDirectoryForTests(final Module module) {\r
-                  return getGenerationOutputDir(_compiler, module, true);\r
-                }\r
-              };\r
-            }\r
-\r
-            final boolean processedSomething = processFiles(factory.create(_context, compiler), forceCompile, checkScope, onlyCheckStatus, cacheUpdater);\r
-\r
-            if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {\r
-              throw new ExitException(ExitStatus.ERRORS);\r
-            }\r
-\r
-            didSomething |= processedSomething;\r
-          }\r
-        }\r
-        finally {\r
-          cacheUpdater.doUpdate();\r
-        }\r
-      }\r
-      catch (IOException e) {\r
-        LOG.info(e);\r
-        context.requestRebuildNextTime(e.getMessage());\r
-        throw new ExitException(ExitStatus.ERRORS);\r
-      }\r
-      catch (ProcessCanceledException e) {\r
-        throw e;\r
-      }\r
-      catch (ExitException e) {\r
-        throw e;\r
-      }\r
-      catch (Exception e) {\r
-        context.addMessage(CompilerMessageCategory.ERROR, CompilerBundle.message("compiler.error.exception", e.getMessage()), null, -1, -1);\r
-        LOG.error(e);\r
-      }\r
-    }\r
-\r
-    return didSomething;\r
-  }\r
-\r
-  private static Map<Module, Set<GeneratingCompiler.GenerationItem>> buildModuleToGenerationItemMap(GeneratingCompiler.GenerationItem[] items) {\r
-    final Map<Module, Set<GeneratingCompiler.GenerationItem>> map = new HashMap<Module, Set<GeneratingCompiler.GenerationItem>>();\r
-    for (GeneratingCompiler.GenerationItem item : items) {\r
-      Module module = item.getModule();\r
-      LOG.assertTrue(module != null);\r
-      Set<GeneratingCompiler.GenerationItem> itemSet = map.get(module);\r
-      if (itemSet == null) {\r
-        itemSet = new HashSet<GeneratingCompiler.GenerationItem>();\r
-        map.put(module, itemSet);\r
-      }\r
-      itemSet.add(item);\r
-    }\r
-    return map;\r
-  }\r
-\r
-  private void deleteAll(final CompileContextEx context) {\r
-    CompilerUtil.runInContext(context, CompilerBundle.message("progress.clearing.output"), new ThrowableRunnable<RuntimeException>() {\r
-      public void run() {\r
-        final boolean isTestMode = ApplicationManager.getApplication().isUnitTestMode();\r
-        final VirtualFile[] allSources = context.getProjectCompileScope().getFiles(null, true);\r
-        if (myShouldClearOutputDirectory) {\r
-          CompilerUtil.clearOutputDirectories(myAllOutputDirectories);\r
-        }\r
-        else { // refresh is still required\r
-          try {\r
-            for (final Compiler compiler : CompilerManager.getInstance(myProject).getCompilers(Compiler.class)) {\r
-              try {\r
-                if (compiler instanceof GeneratingCompiler) {\r
-                  final StateCache<ValidityState> cache = getGeneratingCompilerCache((GeneratingCompiler)compiler);\r
-                  final Iterator<String> urlIterator = cache.getUrlsIterator();\r
-                  while (urlIterator.hasNext()) {\r
-                    context.getProgressIndicator().checkCanceled();\r
-                    deleteFile(new File(VirtualFileManager.extractPath(urlIterator.next())));\r
-                  }\r
-                }\r
-                else if (compiler instanceof TranslatingCompiler) {\r
-                  final ArrayList<Trinity<File, String, Boolean>> toDelete = new ArrayList<Trinity<File, String, Boolean>>();\r
-                  ApplicationManager.getApplication().runReadAction(new Runnable() {\r
-                    public void run() {\r
-                      TranslatingCompilerFilesMonitor.getInstance().collectFiles(\r
-                        context, \r
-                        (TranslatingCompiler)compiler, Arrays.<VirtualFile>asList(allSources).iterator(), \r
-                        true /*pass true to make sure that every source in scope file is processed*/, \r
-                        false /*important! should pass false to enable collection of files to delete*/,\r
-                        new ArrayList<VirtualFile>(), \r
-                        toDelete\r
-                      );\r
-                    }\r
-                  });\r
-                  for (Trinity<File, String, Boolean> trinity : toDelete) {\r
-                    context.getProgressIndicator().checkCanceled();\r
-                    final File file = trinity.getFirst();\r
-                    deleteFile(file);\r
-                    if (isTestMode) {\r
-                      CompilerManagerImpl.addDeletedPath(file.getPath());\r
-                    }\r
-                  }\r
-                }\r
-              }\r
-              catch (IOException e) {\r
-                LOG.info(e);\r
-              }\r
-            }\r
-            pruneEmptyDirectories(context.getProgressIndicator(), myAllOutputDirectories); // to avoid too much files deleted events\r
-          }\r
-          finally {\r
-            CompilerUtil.refreshIODirectories(myAllOutputDirectories);\r
-          }\r
-        }\r
-        dropScopesCaches();\r
-\r
-        clearCompilerSystemDirectory(context);\r
-      }\r
-    });\r
-  }\r
-\r
-  private void dropScopesCaches() {\r
-    // hack to be sure the classpath will include the output directories\r
-    ApplicationManager.getApplication().runReadAction(new Runnable() {\r
-      public void run() {\r
-        ((ProjectRootManagerEx)ProjectRootManager.getInstance(myProject)).clearScopesCachesForModules();\r
-      }\r
-    });\r
-  }\r
-\r
-  private static void pruneEmptyDirectories(ProgressIndicator progress, final Set<File> directories) {\r
-    for (File directory : directories) {\r
-      doPrune(progress, directory, directories);\r
-    }\r
-  }\r
-\r
-  private static boolean doPrune(ProgressIndicator progress, final File directory, final Set<File> outPutDirectories) {\r
-    progress.checkCanceled();\r
-    final File[] files = directory.listFiles();\r
-    boolean isEmpty = true;\r
-    if (files != null) {\r
-      for (File file : files) {\r
-        if (!outPutDirectories.contains(file)) {\r
-          if (doPrune(progress, file, outPutDirectories)) {\r
-            deleteFile(file);\r
-          }\r
-          else {\r
-            isEmpty = false;\r
-          }\r
-        }\r
-        else {\r
-          isEmpty = false;\r
-        }\r
-      }\r
-    }\r
-    else {\r
-      isEmpty = false;\r
-    }\r
-\r
-    return isEmpty;\r
-  }\r
-\r
-  private Set<File> getAllOutputDirectories(CompileContext context) {\r
-    final Set<File> outputDirs = new OrderedSet<File>();\r
-    final Module[] modules = ModuleManager.getInstance(myProject).getModules();\r
-    for (final String path : CompilerPathsEx.getOutputPaths(modules)) {\r
-      outputDirs.add(new File(path));\r
-    }\r
-    for (Pair<IntermediateOutputCompiler, Module> pair : myGenerationCompilerModuleToOutputDirMap.keySet()) {\r
-      outputDirs.add(new File(CompilerPaths.getGenerationOutputPath(pair.getFirst(), pair.getSecond(), false)));\r
-      outputDirs.add(new File(CompilerPaths.getGenerationOutputPath(pair.getFirst(), pair.getSecond(), true)));\r
-    }\r
-    final CompilerConfiguration config = CompilerConfiguration.getInstance(myProject);\r
-    if (context.isAnnotationProcessorsEnabled()) {\r
-      for (Module module : modules) {\r
-        if (config.getAnnotationProcessingConfiguration(module).isEnabled()) {\r
-          final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);\r
-          if (path != null) {\r
-            outputDirs.add(new File(path));\r
-          }\r
-        }\r
-      }\r
-    }\r
-    for (Artifact artifact : ArtifactManager.getInstance(myProject).getArtifacts()) {\r
-      final String path = ((ArtifactImpl)artifact).getOutputDirectoryPathToCleanOnRebuild();\r
-      if (path != null) {\r
-        outputDirs.add(new File(FileUtil.toSystemDependentName(path)));\r
-      }\r
-    }\r
-    return outputDirs;\r
-  }\r
-\r
-  private void clearCompilerSystemDirectory(final CompileContextEx context) {\r
-    CompilerCacheManager.getInstance(myProject).clearCaches(context);\r
-    FileUtil.delete(CompilerPathsEx.getZipStoreDirectory(myProject));\r
-    dropDependencyCache(context);\r
-\r
-    for (Pair<IntermediateOutputCompiler, Module> pair : myGenerationCompilerModuleToOutputDirMap.keySet()) {\r
-      final File[] outputs = {\r
-        new File(CompilerPaths.getGenerationOutputPath(pair.getFirst(), pair.getSecond(), false)),\r
-        new File(CompilerPaths.getGenerationOutputPath(pair.getFirst(), pair.getSecond(), true))\r
-      };\r
-      for (File output : outputs) {\r
-        final File[] files = output.listFiles();\r
-        if (files != null) {\r
-          for (final File file : files) {\r
-            final boolean deleteOk = deleteFile(file);\r
-            if (!deleteOk) {\r
-              context.addMessage(CompilerMessageCategory.ERROR, CompilerBundle.message("compiler.error.failed.to.delete", file.getPath()),\r
-                                 null, -1, -1);\r
-            }\r
-          }\r
-        }\r
-      }\r
-    }\r
-  }\r
-\r
-  /**\r
-   * @param file a file to delete\r
-   * @return true if and only if the file existed and was successfully deleted\r
-   * Note: the behaviour is different from FileUtil.delete() which returns true if the file absent on the disk\r
-   */\r
-  private static boolean deleteFile(final File file) {\r
-    File[] files = file.listFiles();\r
-    if (files != null) {\r
-      for (File file1 : files) {\r
-        deleteFile(file1);\r
-      }\r
-    }\r
-\r
-    for (int i = 0; i < 10; i++){\r
-      if (file.delete()) {\r
-        return true;\r
-      }\r
-      if (!file.exists()) {\r
-        return false;\r
-      }\r
-      try {\r
-        Thread.sleep(50);\r
-      }\r
-      catch (InterruptedException ignored) {\r
-      }\r
-    }\r
-    return false;\r
-  }\r
-\r
-  private VirtualFile getGenerationOutputDir(final IntermediateOutputCompiler compiler, final Module module, final boolean forTestSources) {\r
-    final Pair<VirtualFile, VirtualFile> outputs =\r
-      myGenerationCompilerModuleToOutputDirMap.get(new Pair<IntermediateOutputCompiler, Module>(compiler, module));\r
-    return forTestSources? outputs.getSecond() : outputs.getFirst();\r
-  }\r
-\r
-  private boolean generateOutput(final CompileContextEx context,\r
-                                 final GeneratingCompiler compiler,\r
-                                 final boolean forceGenerate,\r
-                                 final boolean onlyCheckStatus) throws ExitException {\r
-    final GeneratingCompiler.GenerationItem[] allItems = compiler.getGenerationItems(context);\r
-    final List<GeneratingCompiler.GenerationItem> toGenerate = new ArrayList<GeneratingCompiler.GenerationItem>();\r
-    final List<File> filesToRefresh = new ArrayList<File>();\r
-    final List<File> generatedFiles = new ArrayList<File>();\r
-    final List<Module> affectedModules = new ArrayList<Module>();\r
-    try {\r
-      final StateCache<ValidityState> cache = getGeneratingCompilerCache(compiler);\r
-      final Set<String> pathsToRemove = new HashSet<String>(cache.getUrls());\r
-\r
-      final Map<GeneratingCompiler.GenerationItem, String> itemToOutputPathMap = new HashMap<GeneratingCompiler.GenerationItem, String>();\r
-      final IOException[] ex = {null};\r
-      ApplicationManager.getApplication().runReadAction(new Runnable() {\r
-        public void run() {\r
-          for (final GeneratingCompiler.GenerationItem item : allItems) {\r
-            final Module itemModule = item.getModule();\r
-            final String outputDirPath = CompilerPaths.getGenerationOutputPath(compiler, itemModule, item.isTestSource());\r
-            final String outputPath = outputDirPath + "/" + item.getPath();\r
-            itemToOutputPathMap.put(item, outputPath);\r
-\r
-            try {\r
-              final ValidityState savedState = cache.getState(outputPath);\r
-\r
-              if (forceGenerate || savedState == null || !savedState.equalsTo(item.getValidityState())) {\r
-                final String outputPathUrl = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, outputPath);\r
-                if (context.getCompileScope().belongs(outputPathUrl)) {\r
-                  toGenerate.add(item);\r
-                }\r
-                else {\r
-                  pathsToRemove.remove(outputPath);\r
-                }\r
-              }\r
-              else {\r
-                pathsToRemove.remove(outputPath);\r
-              }\r
-            }\r
-            catch (IOException e) {\r
-              ex[0] = e;\r
-            }\r
-          }\r
-        }\r
-      });\r
-      if (ex[0] != null) {\r
-        throw ex[0];\r
-      }                   \r
-\r
-      if (onlyCheckStatus) {\r
-        if (toGenerate.isEmpty() && pathsToRemove.isEmpty()) {\r
-          return false;\r
-        }\r
-        if (LOG.isDebugEnabled()) {\r
-          if (!toGenerate.isEmpty()) {\r
-            LOG.debug("Found items to generate, compiler " + compiler.getDescription());\r
-          }\r
-          if (!pathsToRemove.isEmpty()) {\r
-            LOG.debug("Found paths to remove, compiler " + compiler.getDescription());\r
-          }\r
-        }\r
-        throw new ExitException(ExitStatus.CANCELLED);\r
-      }\r
-\r
-      if (!pathsToRemove.isEmpty()) {\r
-        CompilerUtil.runInContext(context, CompilerBundle.message("progress.synchronizing.output.directory"), new ThrowableRunnable<IOException>(){\r
-          public void run() throws IOException {\r
-            for (final String path : pathsToRemove) {\r
-              final File file = new File(path);\r
-              final boolean deleted = deleteFile(file);\r
-              if (deleted) {\r
-                cache.remove(path);\r
-                filesToRefresh.add(file);\r
-              }\r
-            }\r
-          }\r
-        });\r
-      }\r
-\r
-      final Map<Module, Set<GeneratingCompiler.GenerationItem>> moduleToItemMap =\r
-          buildModuleToGenerationItemMap(toGenerate.toArray(new GeneratingCompiler.GenerationItem[toGenerate.size()]));\r
-      List<Module> modules = new ArrayList<Module>(moduleToItemMap.size());\r
-      for (final Module module : moduleToItemMap.keySet()) {\r
-        modules.add(module);\r
-      }\r
-      ModuleCompilerUtil.sortModules(myProject, modules);\r
-\r
-      for (final Module module : modules) {\r
-        CompilerUtil.runInContext(context, "Generating output from "+compiler.getDescription(),new ThrowableRunnable<IOException>(){\r
-          public void run() throws IOException {\r
-            final Set<GeneratingCompiler.GenerationItem> items = moduleToItemMap.get(module);\r
-            if (items != null && !items.isEmpty()) {\r
-              final GeneratingCompiler.GenerationItem[][] productionAndTestItems = splitGenerationItems(items);\r
-              for (GeneratingCompiler.GenerationItem[] _items : productionAndTestItems) {\r
-                if (_items.length == 0) continue;\r
-                final VirtualFile outputDir = getGenerationOutputDir(compiler, module, _items[0].isTestSource());\r
-                final GeneratingCompiler.GenerationItem[] successfullyGenerated = compiler.generate(context, _items, outputDir);\r
-\r
-                CompilerUtil.runInContext(context, CompilerBundle.message("progress.updating.caches"), new ThrowableRunnable<IOException>() {\r
-                  public void run() throws IOException {\r
-                    if (successfullyGenerated.length > 0) {\r
-                      affectedModules.add(module);\r
-                    }\r
-                    for (final GeneratingCompiler.GenerationItem item : successfullyGenerated) {\r
-                      final String fullOutputPath = itemToOutputPathMap.get(item);\r
-                      cache.update(fullOutputPath, item.getValidityState());\r
-                      final File file = new File(fullOutputPath);\r
-                      filesToRefresh.add(file);\r
-                      generatedFiles.add(file);\r
-                      context.getProgressIndicator().setText2(file.getPath());\r
-                    }\r
-                  }\r
-                });\r
-              }\r
-            }\r
-          }\r
-        });\r
-      }\r
-    }\r
-    catch (IOException e) {\r
-      LOG.info(e);\r
-      context.requestRebuildNextTime(e.getMessage());\r
-      throw new ExitException(ExitStatus.ERRORS);\r
-    }\r
-    finally {\r
-      CompilerUtil.refreshIOFiles(filesToRefresh);\r
-      if (!generatedFiles.isEmpty()) {\r
-        DumbService.getInstance(myProject).waitForSmartMode();\r
-        List<VirtualFile> vFiles = ApplicationManager.getApplication().runReadAction(new Computable<List<VirtualFile>>() {\r
-          public List<VirtualFile> compute() {\r
-            final ArrayList<VirtualFile> vFiles = new ArrayList<VirtualFile>(generatedFiles.size());\r
-            for (File generatedFile : generatedFiles) {\r
-              final VirtualFile vFile = LocalFileSystem.getInstance().findFileByIoFile(generatedFile);\r
-              if (vFile != null) {\r
-                vFiles.add(vFile);\r
-              }\r
-            }\r
-            return vFiles;\r
-          }\r
-        });\r
-        if (forceGenerate) {\r
-          context.addScope(new FileSetCompileScope(vFiles, affectedModules.toArray(new Module[affectedModules.size()])));\r
-        }\r
-        context.markGenerated(vFiles);\r
-      }\r
-    }\r
-    return !toGenerate.isEmpty() || !filesToRefresh.isEmpty();\r
-  }\r
-\r
-  private static GeneratingCompiler.GenerationItem[][] splitGenerationItems(final Set<GeneratingCompiler.GenerationItem> items) {\r
-    final List<GeneratingCompiler.GenerationItem> production = new ArrayList<GeneratingCompiler.GenerationItem>();\r
-    final List<GeneratingCompiler.GenerationItem> tests = new ArrayList<GeneratingCompiler.GenerationItem>();\r
-    for (GeneratingCompiler.GenerationItem item : items) {\r
-      if (item.isTestSource()) {\r
-        tests.add(item);\r
-      }\r
-      else {\r
-        production.add(item);\r
-      }\r
-    }\r
-    return new GeneratingCompiler.GenerationItem[][]{\r
-      production.toArray(new GeneratingCompiler.GenerationItem[production.size()]),\r
-      tests.toArray(new GeneratingCompiler.GenerationItem[tests.size()])\r
-    };\r
-  }\r
-\r
-  private boolean compileSources(final CompileContextEx context,\r
-                                 final Chunk<Module> moduleChunk,\r
-                                 final TranslatingCompiler compiler,\r
-                                 final Collection<VirtualFile> srcSnapshot,\r
-                                 final boolean forceCompile,\r
-                                 final boolean isRebuild,\r
-                                 final boolean onlyCheckStatus,\r
-                                 TranslatingCompiler.OutputSink sink) throws ExitException {\r
-\r
-    final Set<VirtualFile> toCompile = new HashSet<VirtualFile>();\r
-    final List<Trinity<File, String, Boolean>> toDelete = new ArrayList<Trinity<File, String, Boolean>>();\r
-    context.getProgressIndicator().pushState();\r
-\r
-    final boolean[] wereFilesDeleted = {false};\r
-    try {\r
-      ApplicationManager.getApplication().runReadAction(new Runnable() {\r
-        public void run() {\r
-          TranslatingCompilerFilesMonitor.getInstance().collectFiles(\r
-            context, compiler, srcSnapshot.iterator(), forceCompile, isRebuild, toCompile, toDelete\r
-          );\r
-        }\r
-      });\r
-\r
-      if (onlyCheckStatus) {\r
-        if (toDelete.isEmpty() && toCompile.isEmpty()) {\r
-          return false;\r
-        }\r
-        if (LOG.isDebugEnabled() || ourDebugMode) {\r
-          if (!toDelete.isEmpty()) {\r
-            final StringBuilder message = new StringBuilder();\r
-            message.append("Found items to delete, compiler ").append(compiler.getDescription());\r
-            for (Trinity<File, String, Boolean> trinity : toDelete) {\r
-              message.append("\n").append(trinity.getFirst());\r
-            }\r
-            LOG.debug(message.toString());\r
-            if (ourDebugMode) {\r
-              System.out.println(message);\r
-            }\r
-          }\r
-          if (!toCompile.isEmpty()) {\r
-            final String message = "Found items to compile, compiler " + compiler.getDescription();\r
-            LOG.debug(message);\r
-            if (ourDebugMode) {\r
-              System.out.println(message);\r
-            }\r
-          }\r
-        }\r
-        throw new ExitException(ExitStatus.CANCELLED);\r
-      }\r
-\r
-      if (!toDelete.isEmpty()) {\r
-        try {\r
-          wereFilesDeleted[0] = syncOutputDir(context, toDelete);\r
-        }\r
-        catch (CacheCorruptedException e) {\r
-          LOG.info(e);\r
-          context.requestRebuildNextTime(e.getMessage());\r
-        }\r
-      }\r
-\r
-      if ((wereFilesDeleted[0] || !toCompile.isEmpty()) && context.getMessageCount(CompilerMessageCategory.ERROR) == 0) {\r
-        compiler.compile(context, moduleChunk, VfsUtilCore.toVirtualFileArray(toCompile), sink);\r
-      }\r
-    }\r
-    finally {\r
-      context.getProgressIndicator().popState();\r
-    }\r
-    return !toCompile.isEmpty() || wereFilesDeleted[0];\r
-  }\r
-\r
-  private static boolean syncOutputDir(final CompileContextEx context, final Collection<Trinity<File, String, Boolean>> toDelete) throws CacheCorruptedException {\r
-    final DependencyCache dependencyCache = context.getDependencyCache();\r
-    final boolean isTestMode = ApplicationManager.getApplication().isUnitTestMode();\r
-\r
-    final List<File> filesToRefresh = new ArrayList<File>();\r
-    final boolean[] wereFilesDeleted = {false};\r
-    CompilerUtil.runInContext(context, CompilerBundle.message("progress.synchronizing.output.directory"), new ThrowableRunnable<CacheCorruptedException>(){\r
-      public void run() throws CacheCorruptedException {\r
-        final long start = System.currentTimeMillis();\r
-        try {\r
-          for (final Trinity<File, String, Boolean> trinity : toDelete) {\r
-            final File outputPath = trinity.getFirst();\r
-            context.getProgressIndicator().checkCanceled();\r
-            context.getProgressIndicator().setText2(outputPath.getPath());\r
-            filesToRefresh.add(outputPath);\r
-            if (isTestMode) {\r
-              LOG.assertTrue(outputPath.exists());\r
-            }\r
-            if (!deleteFile(outputPath)) {\r
-              if (isTestMode) {\r
-                if (outputPath.exists()) {\r
-                  LOG.error("Was not able to delete output file: " + outputPath.getPath());\r
-                }\r
-                else {\r
-                  CompilerManagerImpl.addDeletedPath(outputPath.getPath());\r
-                }\r
-              }\r
-              continue;\r
-            }\r
-            wereFilesDeleted[0] = true;\r
-\r
-            // update zip here\r
-            //final String outputDir = myOutputFinder.lookupOutputPath(outputPath);\r
-            //if (outputDir != null) {\r
-            //  try {\r
-            //    context.updateZippedOuput(outputDir, FileUtil.toSystemIndependentName(outputPath.getPath()).substring(outputDir.length() + 1));\r
-            //  }\r
-            //  catch (IOException e) {\r
-            //    LOG.info(e);\r
-            //  }\r
-            //}\r
-\r
-            final String className = trinity.getSecond();\r
-            if (className != null) {\r
-              final int id = dependencyCache.getSymbolTable().getId(className);\r
-              dependencyCache.addTraverseRoot(id);\r
-              final boolean sourcePresent = trinity.getThird().booleanValue();\r
-              if (!sourcePresent) {\r
-                dependencyCache.markSourceRemoved(id);\r
-              }\r
-            }\r
-            if (isTestMode) {\r
-              CompilerManagerImpl.addDeletedPath(outputPath.getPath());\r
-            }\r
-          }\r
-        }\r
-        finally {\r
-          CompilerUtil.logDuration("Sync output directory", System.currentTimeMillis() - start);\r
-          CompilerUtil.refreshIOFiles(filesToRefresh);\r
-        }\r
-      }\r
-    });\r
-    return wereFilesDeleted[0];\r
-  }\r
-\r
-  // [mike] performance optimization - this method is accessed > 15,000 times in Aurora\r
-  private String getModuleOutputPath(final Module module, boolean inTestSourceContent) {\r
-    final Map<Module, String> map = inTestSourceContent ? myModuleTestOutputPaths : myModuleOutputPaths;\r
-    String path = map.get(module);\r
-    if (path == null) {\r
-      path = CompilerPaths.getModuleOutputPath(module, inTestSourceContent);\r
-      map.put(module, path);\r
-    }\r
-\r
-    return path;\r
-  }\r
-\r
-  private boolean processFiles(final FileProcessingCompilerAdapter adapter,\r
-                               final boolean forceCompile,\r
-                               final boolean checkScope,\r
-                               final boolean onlyCheckStatus, final CacheDeferredUpdater cacheUpdater) throws ExitException, IOException {\r
-    final CompileContextEx context = (CompileContextEx)adapter.getCompileContext();\r
-    final FileProcessingCompilerStateCache cache = getFileProcessingCompilerCache(adapter.getCompiler());\r
-    final FileProcessingCompiler.ProcessingItem[] items = adapter.getProcessingItems();\r
-    if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {\r
-      return false;\r
-    }\r
-    if (LOG.isDebugEnabled() && items.length > 0) {\r
-      LOG.debug("Start processing files by " + adapter.getCompiler().getDescription());\r
-    }\r
-    final CompileScope scope = context.getCompileScope();\r
-    final List<FileProcessingCompiler.ProcessingItem> toProcess = new ArrayList<FileProcessingCompiler.ProcessingItem>();\r
-    final Set<String> allUrls = new HashSet<String>();\r
-    final IOException[] ex = {null};\r
-    DumbService.getInstance(myProject).waitForSmartMode();\r
-    ApplicationManager.getApplication().runReadAction(new Runnable() {\r
-      public void run() {\r
-        try {\r
-          for (FileProcessingCompiler.ProcessingItem item : items) {\r
-            final VirtualFile file = item.getFile();\r
-            final String url = file.getUrl();\r
-            allUrls.add(url);\r
-            if (!forceCompile && cache.getTimestamp(url) == file.getTimeStamp()) {\r
-              final ValidityState state = cache.getExtState(url);\r
-              final ValidityState itemState = item.getValidityState();\r
-              if (state != null ? state.equalsTo(itemState) : itemState == null) {\r
-                continue;\r
-              }\r
-            }\r
-            if (LOG.isDebugEnabled()) {\r
-              LOG.debug("Adding item to process: " + url + "; saved ts= " + cache.getTimestamp(url) + "; VFS ts=" + file.getTimeStamp());\r
-            }\r
-            toProcess.add(item);\r
-          }\r
-        }\r
-        catch (IOException e) {\r
-          ex[0] = e;\r
-        }\r
-      }\r
-    });\r
-\r
-    if (ex[0] != null) {\r
-      throw ex[0];\r
-    }\r
-\r
-    final Collection<String> urls = cache.getUrls();\r
-    final List<String> urlsToRemove = new ArrayList<String>();\r
-    if (!urls.isEmpty()) {\r
-      CompilerUtil.runInContext(context, CompilerBundle.message("progress.processing.outdated.files"), new ThrowableRunnable<IOException>(){\r
-        public void run() throws IOException {\r
-          ApplicationManager.getApplication().runReadAction(new Runnable() {\r
-            public void run() {\r
-              for (final String url : urls) {\r
-                if (!allUrls.contains(url)) {\r
-                  if (!checkScope || scope.belongs(url)) {\r
-                    urlsToRemove.add(url);\r
-                  }\r
-                }\r
-              }\r
-            }\r
-          });\r
-          if (!onlyCheckStatus && !urlsToRemove.isEmpty()) {\r
-            for (final String url : urlsToRemove) {\r
-              adapter.processOutdatedItem(context, url, cache.getExtState(url));\r
-              cache.remove(url);\r
-            }\r
-          }\r
-        }\r
-      });\r
-    }\r
-\r
-    if (onlyCheckStatus) {\r
-      if (urlsToRemove.isEmpty() && toProcess.isEmpty()) {\r
-        return false;\r
-      }\r
-      if (LOG.isDebugEnabled()) {\r
-        if (!urlsToRemove.isEmpty()) {\r
-          LOG.debug("Found urls to remove, compiler " + adapter.getCompiler().getDescription());\r
-          for (String url : urlsToRemove) {\r
-            LOG.debug("\t" + url);\r
-          }\r
-        }\r
-        if (!toProcess.isEmpty()) {\r
-          LOG.debug("Found items to compile, compiler " + adapter.getCompiler().getDescription());\r
-          for (FileProcessingCompiler.ProcessingItem item : toProcess) {\r
-            LOG.debug("\t" + item.getFile().getPresentableUrl());\r
-          }\r
-        }\r
-      }\r
-      throw new ExitException(ExitStatus.CANCELLED);\r
-    }\r
-\r
-    if (toProcess.isEmpty()) {\r
-      return false;\r
-    }\r
-\r
-    final FileProcessingCompiler.ProcessingItem[] processed =\r
-      adapter.process(toProcess.toArray(new FileProcessingCompiler.ProcessingItem[toProcess.size()]));\r
-\r
-    if (processed.length == 0) {\r
-      return true;\r
-    }\r
-    CompilerUtil.runInContext(context, CompilerBundle.message("progress.updating.caches"), new ThrowableRunnable<IOException>() {\r
-      public void run() {\r
-        final List<VirtualFile> vFiles = new ArrayList<VirtualFile>(processed.length);\r
-        for (FileProcessingCompiler.ProcessingItem aProcessed : processed) {\r
-          final VirtualFile file = aProcessed.getFile();\r
-          vFiles.add(file);\r
-          if (LOG.isDebugEnabled()) {\r
-            LOG.debug("\tFile processed " + file.getPresentableUrl() + "; ts=" + file.getTimeStamp());\r
-          }\r
-\r
-          //final String path = file.getPath();\r
-          //final String outputDir = myOutputFinder.lookupOutputPath(path);\r
-          //if (outputDir != null) {\r
-          //  context.updateZippedOuput(outputDir, path.substring(outputDir.length() + 1));\r
-          //}\r
-        }\r
-        LocalFileSystem.getInstance().refreshFiles(vFiles);\r
-        if (LOG.isDebugEnabled()) {\r
-          LOG.debug("Files after VFS refresh:");\r
-          for (VirtualFile file : vFiles) {\r
-            LOG.debug("\t" + file.getPresentableUrl() + "; ts=" + file.getTimeStamp());\r
-          }\r
-        }\r
-        for (FileProcessingCompiler.ProcessingItem item : processed) {\r
-          cacheUpdater.addFileForUpdate(item, cache);\r
-        }\r
-      }\r
-    });\r
-    return true;\r
-  }\r
-\r
-  private FileProcessingCompilerStateCache getFileProcessingCompilerCache(FileProcessingCompiler compiler) throws IOException {\r
-    return CompilerCacheManager.getInstance(myProject).getFileProcessingCompilerCache(compiler);\r
-  }\r
-\r
-  private StateCache<ValidityState> getGeneratingCompilerCache(final GeneratingCompiler compiler) throws IOException {\r
-    return CompilerCacheManager.getInstance(myProject).getGeneratingCompilerCache(compiler);\r
-  }\r
-\r
-  public void executeCompileTask(final CompileTask task, final CompileScope scope, final String contentName, final Runnable onTaskFinished) {\r
-    final CompilerTask progressManagerTask =\r
-      new CompilerTask(myProject, contentName, false, false);\r
-    final CompileContextImpl compileContext = new CompileContextImpl(myProject, progressManagerTask, scope, null, false, false);\r
-\r
-    FileDocumentManager.getInstance().saveAllDocuments();\r
-\r
-    progressManagerTask.start(new Runnable() {\r
-      public void run() {\r
-        try {\r
-          task.execute(compileContext);\r
-        }\r
-        catch (ProcessCanceledException ex) {\r
-          // suppressed\r
-        }\r
-        finally {\r
-          if (onTaskFinished != null) {\r
-            onTaskFinished.run();\r
-          }\r
-        }\r
-      }\r
-    }, null);\r
-  }\r
-\r
-  private boolean executeCompileTasks(final CompileContext context, final boolean beforeTasks) {\r
-    final CompilerManager manager = CompilerManager.getInstance(myProject);\r
-    final ProgressIndicator progressIndicator = context.getProgressIndicator();\r
-    progressIndicator.pushState();\r
-    try {\r
-      CompileTask[] tasks = beforeTasks ? manager.getBeforeTasks() : manager.getAfterTasks();\r
-      if (tasks.length > 0) {\r
-        progressIndicator.setText(beforeTasks\r
-                                  ? CompilerBundle.message("progress.executing.precompile.tasks")\r
-                                  : CompilerBundle.message("progress.executing.postcompile.tasks"));\r
-        for (CompileTask task : tasks) {\r
-          if (!task.execute(context)) {\r
-            return false;\r
-          }\r
-        }\r
-      }\r
-    }\r
-    finally {\r
-      progressIndicator.popState();\r
-      WindowManager.getInstance().getStatusBar(myProject).setInfo("");\r
-      if (progressIndicator instanceof CompilerTask) {\r
-        ApplicationManager.getApplication().invokeLater(new Runnable() {\r
-          public void run() {\r
-            ((CompilerTask)progressIndicator).showCompilerContent();\r
-          }\r
-        });\r
-      }\r
-    }\r
-    return true;\r
-  }\r
-\r
-  private boolean validateCompilerConfiguration(final CompileScope scope, boolean checkOutputAndSourceIntersection) {\r
-    try {\r
-      final Module[] scopeModules = scope.getAffectedModules()/*ModuleManager.getInstance(myProject).getModules()*/;\r
-      final List<String> modulesWithoutOutputPathSpecified = new ArrayList<String>();\r
-      boolean isProjectCompilePathSpecified = true;\r
-      final List<String> modulesWithoutJdkAssigned = new ArrayList<String>();\r
-      final Set<File> nonExistingOutputPaths = new HashSet<File>();\r
-      final CompilerConfiguration config = CompilerConfiguration.getInstance(myProject);\r
-      final CompilerManager compilerManager = CompilerManager.getInstance(myProject);\r
-      for (final Module module : scopeModules) {\r
-        if (!compilerManager.isValidationEnabled(module)) {\r
-          continue;\r
-        }\r
-        final boolean hasSources = hasSources(module, false);\r
-        final boolean hasTestSources = hasSources(module, true);\r
-        if (!hasSources && !hasTestSources) {\r
-          // If module contains no sources, shouldn't have to select JDK or output directory (SCR #19333)\r
-          // todo still there may be problems with this approach if some generated files are attributed by this module\r
-          continue;\r
-        }\r
-        final Sdk jdk = ModuleRootManager.getInstance(module).getSdk();\r
-        if (jdk == null) {\r
-          modulesWithoutJdkAssigned.add(module.getName());\r
-        }\r
-        final String outputPath = getModuleOutputPath(module, false);\r
-        final String testsOutputPath = getModuleOutputPath(module, true);\r
-        if (outputPath == null && testsOutputPath == null) {\r
-          modulesWithoutOutputPathSpecified.add(module.getName());\r
-        }\r
-        else {\r
-          if (outputPath != null) {\r
-            final File file = new File(outputPath.replace('/', File.separatorChar));\r
-            if (!file.exists()) {\r
-              nonExistingOutputPaths.add(file);\r
-            }\r
-          }\r
-          else {\r
-            if (hasSources) {\r
-              modulesWithoutOutputPathSpecified.add(module.getName());\r
-            }\r
-          }\r
-          if (testsOutputPath != null) {\r
-            final File f = new File(testsOutputPath.replace('/', File.separatorChar));\r
-            if (!f.exists()) {\r
-              nonExistingOutputPaths.add(f);\r
-            }\r
-          }\r
-          else {\r
-            if (hasTestSources) {\r
-              modulesWithoutOutputPathSpecified.add(module.getName());\r
-            }\r
-          }\r
-          if (!useOutOfProcessBuild()) {\r
-            if (config.getAnnotationProcessingConfiguration(module).isEnabled()) {\r
-              final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);\r
-              if (path == null) {\r
-                final CompilerProjectExtension extension = CompilerProjectExtension.getInstance(module.getProject());\r
-                if (extension == null || extension.getCompilerOutputUrl() == null) {\r
-                  isProjectCompilePathSpecified = false;\r
-                }\r
-                else {\r
-                  modulesWithoutOutputPathSpecified.add(module.getName());\r
-                }\r
-              }\r
-              else {\r
-                final File file = new File(path);\r
-                if (!file.exists()) {\r
-                  nonExistingOutputPaths.add(file);\r
-                }\r
-              }\r
-            }\r
-          }\r
-        }\r
-      }\r
-      if (!modulesWithoutJdkAssigned.isEmpty()) {\r
-        showNotSpecifiedError("error.jdk.not.specified", modulesWithoutJdkAssigned, ProjectBundle.message("modules.classpath.title"));\r
-        return false;\r
-      }\r
-\r
-      if (!isProjectCompilePathSpecified) {\r
-        final String message = CompilerBundle.message("error.project.output.not.specified");\r
-        if (ApplicationManager.getApplication().isUnitTestMode()) {\r
-          LOG.error(message);\r
-        }\r
-  \r
-        Messages.showMessageDialog(myProject, message, CommonBundle.getErrorTitle(), Messages.getErrorIcon());\r
-        ProjectSettingsService.getInstance(myProject).openProjectSettings();\r
-        return false;\r
-      }\r
-\r
-      if (!modulesWithoutOutputPathSpecified.isEmpty()) {\r
-        showNotSpecifiedError("error.output.not.specified", modulesWithoutOutputPathSpecified, CommonContentEntriesEditor.NAME);\r
-        return false;\r
-      }\r
-\r
-      if (!nonExistingOutputPaths.isEmpty()) {\r
-        for (File file : nonExistingOutputPaths) {\r
-          final boolean succeeded = file.mkdirs();\r
-          if (!succeeded) {\r
-            if (file.exists()) {\r
-              // for overlapping paths, this one might have been created as an intermediate path on a previous iteration\r
-              continue;\r
-            }\r
-            Messages.showMessageDialog(myProject, CompilerBundle.message("error.failed.to.create.directory", file.getPath()),\r
-                                       CommonBundle.getErrorTitle(), Messages.getErrorIcon());\r
-            return false;\r
-          }\r
-        }\r
-        final Boolean refreshSuccess =\r
-          new WriteAction<Boolean>() {\r
-            @Override\r
-            protected void run(Result<Boolean> result) throws Throwable {\r
-              LocalFileSystem.getInstance().refreshIoFiles(nonExistingOutputPaths);\r
-              Boolean res = Boolean.TRUE;\r
-              for (File file : nonExistingOutputPaths) {\r
-                if (LocalFileSystem.getInstance().findFileByIoFile(file) == null) {\r
-                  res = Boolean.FALSE;\r
-                  break;\r
-                }\r
-              }\r
-              result.setResult(res);\r
-            }\r
-          }.execute().getResultObject();\r
-  \r
-        if (!refreshSuccess.booleanValue()) {\r
-          return false;\r
-        }\r
-        dropScopesCaches();\r
-      }\r
-\r
-      if (checkOutputAndSourceIntersection && myShouldClearOutputDirectory) {\r
-        if (!validateOutputAndSourcePathsIntersection()) {\r
-          return false;\r
-        }\r
-        // myShouldClearOutputDirectory may change in validateOutputAndSourcePathsIntersection()\r
-        CompilerPathsEx.CLEAR_ALL_OUTPUTS_KEY.set(scope, myShouldClearOutputDirectory);\r
-      }\r
-      else {\r
-        CompilerPathsEx.CLEAR_ALL_OUTPUTS_KEY.set(scope, false);\r
-      }\r
-      final List<Chunk<Module>> chunks = ModuleCompilerUtil.getSortedModuleChunks(myProject, Arrays.asList(scopeModules));\r
-      for (final Chunk<Module> chunk : chunks) {\r
-        final Set<Module> chunkModules = chunk.getNodes();\r
-        if (chunkModules.size() <= 1) {\r
-          continue; // no need to check one-module chunks\r
-        }\r
-        for (Module chunkModule : chunkModules) {\r
-          if (config.getAnnotationProcessingConfiguration(chunkModule).isEnabled()) {\r
-            showCyclesNotSupportedForAnnotationProcessors(chunkModules.toArray(new Module[chunkModules.size()]));\r
-            return false;\r
-          }\r
-        }\r
-        Sdk jdk = null;\r
-        LanguageLevel languageLevel = null;\r
-        for (final Module module : chunkModules) {\r
-          final Sdk moduleJdk = ModuleRootManager.getInstance(module).getSdk();\r
-          if (jdk == null) {\r
-            jdk = moduleJdk;\r
-          }\r
-          else {\r
-            if (!jdk.equals(moduleJdk)) {\r
-              showCyclicModulesHaveDifferentJdksError(chunkModules.toArray(new Module[chunkModules.size()]));\r
-              return false;\r
-            }\r
-          }\r
-  \r
-          LanguageLevel moduleLanguageLevel = LanguageLevelUtil.getEffectiveLanguageLevel(module);\r
-          if (languageLevel == null) {\r
-            languageLevel = moduleLanguageLevel;\r
-          }\r
-          else {\r
-            if (!languageLevel.equals(moduleLanguageLevel)) {\r
-              showCyclicModulesHaveDifferentLanguageLevel(chunkModules.toArray(new Module[chunkModules.size()]));\r
-              return false;\r
-            }\r
-          }\r
-        }\r
-      }\r
-      if (!useOutOfProcessBuild()) {\r
-        final Compiler[] allCompilers = compilerManager.getCompilers(Compiler.class);\r
-        for (Compiler compiler : allCompilers) {\r
-          if (!compiler.validateConfiguration(scope)) {\r
-            return false;\r
-          }\r
-        }\r
-      }\r
-      return true;\r
-    }\r
-    catch (Throwable e) {\r
-      LOG.info(e);\r
-      return false;\r
-    }\r
-  }\r
-\r
-  private boolean useOutOfProcessBuild() {\r
-    return CompilerWorkspaceConfiguration.getInstance(myProject).useOutOfProcessBuild();\r
-  }\r
-\r
-  private void showCyclicModulesHaveDifferentLanguageLevel(Module[] modulesInChunk) {\r
-    LOG.assertTrue(modulesInChunk.length > 0);\r
-    String moduleNameToSelect = modulesInChunk[0].getName();\r
-    final String moduleNames = getModulesString(modulesInChunk);\r
-    Messages.showMessageDialog(myProject, CompilerBundle.message("error.chunk.modules.must.have.same.language.level", moduleNames),\r
-                               CommonBundle.getErrorTitle(), Messages.getErrorIcon());\r
-    showConfigurationDialog(moduleNameToSelect, null);\r
-  }\r
-\r
-  private void showCyclicModulesHaveDifferentJdksError(Module[] modulesInChunk) {\r
-    LOG.assertTrue(modulesInChunk.length > 0);\r
-    String moduleNameToSelect = modulesInChunk[0].getName();\r
-    final String moduleNames = getModulesString(modulesInChunk);\r
-    Messages.showMessageDialog(myProject, CompilerBundle.message("error.chunk.modules.must.have.same.jdk", moduleNames),\r
-                               CommonBundle.getErrorTitle(), Messages.getErrorIcon());\r
-    showConfigurationDialog(moduleNameToSelect, null);\r
-  }\r
-\r
-  private void showCyclesNotSupportedForAnnotationProcessors(Module[] modulesInChunk) {\r
-    LOG.assertTrue(modulesInChunk.length > 0);\r
-    String moduleNameToSelect = modulesInChunk[0].getName();\r
-    final String moduleNames = getModulesString(modulesInChunk);\r
-    Messages.showMessageDialog(myProject, CompilerBundle.message("error.annotation.processing.not.supported.for.module.cycles", moduleNames),\r
-                               CommonBundle.getErrorTitle(), Messages.getErrorIcon());\r
-    showConfigurationDialog(moduleNameToSelect, null);\r
-  }\r
-\r
-  private static String getModulesString(Module[] modulesInChunk) {\r
-    final StringBuilder moduleNames = StringBuilderSpinAllocator.alloc();\r
-    try {\r
-      for (Module module : modulesInChunk) {\r
-        if (moduleNames.length() > 0) {\r
-          moduleNames.append("\n");\r
-        }\r
-        moduleNames.append("\"").append(module.getName()).append("\"");\r
-      }\r
-      return moduleNames.toString();\r
-    }\r
-    finally {\r
-      StringBuilderSpinAllocator.dispose(moduleNames);\r
-    }\r
-  }\r
-\r
-  private static boolean hasSources(Module module, boolean checkTestSources) {\r
-    final ContentEntry[] contentEntries = ModuleRootManager.getInstance(module).getContentEntries();\r
-    for (final ContentEntry contentEntry : contentEntries) {\r
-      final SourceFolder[] sourceFolders = contentEntry.getSourceFolders();\r
-      for (final SourceFolder sourceFolder : sourceFolders) {\r
-        if (sourceFolder.getFile() == null) {\r
-          continue; // skip invalid source folders\r
-        }\r
-        if (checkTestSources) {\r
-          if (sourceFolder.isTestSource()) {\r
-            return true;\r
-          }\r
-        }\r
-        else {\r
-          if (!sourceFolder.isTestSource()) {\r
-            return true;\r
-          }\r
-        }\r
-      }\r
-    }\r
-    return false;\r
-  }\r
-\r
-  private void showNotSpecifiedError(@NonNls final String resourceId, List<String> modules, String editorNameToSelect) {\r
-    String nameToSelect = null;\r
-    final StringBuilder names = StringBuilderSpinAllocator.alloc();\r
-    final String message;\r
-    try {\r
-      final int maxModulesToShow = 10;\r
-      for (String name : modules.size() > maxModulesToShow ? modules.subList(0, maxModulesToShow) : modules) {\r
-        if (nameToSelect == null) {\r
-          nameToSelect = name;\r
-        }\r
-        if (names.length() > 0) {\r
-          names.append(",\n");\r
-        }\r
-        names.append("\"");\r
-        names.append(name);\r
-        names.append("\"");\r
-      }\r
-      if (modules.size() > maxModulesToShow) {\r
-        names.append(",\n...");\r
-      }\r
-      message = CompilerBundle.message(resourceId, modules.size(), names.toString());\r
-    }\r
-    finally {\r
-      StringBuilderSpinAllocator.dispose(names);\r
-    }\r
-\r
-    if (ApplicationManager.getApplication().isUnitTestMode()) {\r
-      LOG.error(message);\r
-    }\r
-\r
-    Messages.showMessageDialog(myProject, message, CommonBundle.getErrorTitle(), Messages.getErrorIcon());\r
-    showConfigurationDialog(nameToSelect, editorNameToSelect);\r
-  }\r
-\r
-  private boolean validateOutputAndSourcePathsIntersection() {\r
-    final Module[] allModules = ModuleManager.getInstance(myProject).getModules();\r
-    List<VirtualFile> allOutputs = new ArrayList<VirtualFile>();\r
-    ContainerUtil.addAll(allOutputs, CompilerPathsEx.getOutputDirectories(allModules));\r
-    for (Artifact artifact : ArtifactManager.getInstance(myProject).getArtifacts()) {\r
-      ContainerUtil.addIfNotNull(artifact.getOutputFile(), allOutputs);\r
-    }\r
-    final Set<VirtualFile> affectedOutputPaths = new HashSet<VirtualFile>();\r
-    CompilerUtil.computeIntersectingPaths(myProject, allOutputs, affectedOutputPaths);\r
-    affectedOutputPaths.addAll(ArtifactCompilerUtil.getArtifactOutputsContainingSourceFiles(myProject));\r
-\r
-    if (!affectedOutputPaths.isEmpty()) {\r
-      if (CompilerUtil.askUserToContinueWithNoClearing(myProject, affectedOutputPaths)) {\r
-        myShouldClearOutputDirectory = false;\r
-        return true;\r
-      }\r
-      else {\r
-        return false;\r
-      }\r
-    }\r
-    return true;\r
-  }\r
-\r
-  private void showConfigurationDialog(String moduleNameToSelect, String tabNameToSelect) {\r
-    ProjectSettingsService.getInstance(myProject).showModuleConfigurationDialog(moduleNameToSelect, tabNameToSelect);\r
-  }\r
-\r
-  private static VirtualFile lookupVFile(final LocalFileSystem lfs, final String path) {\r
-    final File file = new File(path);\r
-\r
-    VirtualFile vFile = lfs.findFileByIoFile(file);\r
-    if (vFile != null) {\r
-      return vFile;\r
-    }\r
-\r
-    final boolean justCreated = file.mkdirs();\r
-    vFile = lfs.refreshAndFindFileByIoFile(file);\r
-\r
-    if (vFile == null) {\r
-      assert false: "Virtual file not found for " + file.getPath() + "; mkdirs() exit code is " + justCreated + "; file exists()? " + file.exists();\r
-    }\r
-\r
-    return vFile;\r
-  }\r
-\r
-  private static class CacheDeferredUpdater {\r
-    private final Map<VirtualFile, List<Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>>> myData = new java.util.HashMap<VirtualFile, List<Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>>>();\r
-\r
-    public void addFileForUpdate(final FileProcessingCompiler.ProcessingItem item, FileProcessingCompilerStateCache cache) {\r
-      final VirtualFile file = item.getFile();\r
-      List<Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>> list = myData.get(file);\r
-      if (list == null) {\r
-        list = new ArrayList<Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>>();\r
-        myData.put(file, list);\r
-      }\r
-      list.add(new Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>(cache, item));\r
-    }\r
-\r
-    public void doUpdate() throws IOException{\r
-      final IOException[] ex = {null};\r
-      ApplicationManager.getApplication().runReadAction(new Runnable() {\r
-        public void run() {\r
-          try {\r
-            for (Map.Entry<VirtualFile, List<Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>>> entry : myData.entrySet()) {\r
-              for (Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem> pair : entry.getValue()) {\r
-                final FileProcessingCompiler.ProcessingItem item = pair.getSecond();\r
-                pair.getFirst().update(entry.getKey(), item.getValidityState());\r
-              }\r
-            }\r
-          }\r
-          catch (IOException e) {\r
-            ex[0] = e;\r
-          }\r
-        }\r
-      });\r
-      if (ex[0] != null) {\r
-        throw ex[0];\r
-      }\r
-    }\r
-  }\r
-\r
-  private static class TranslatorsOutputSink implements TranslatingCompiler.OutputSink {\r
-    final Map<String, Collection<TranslatingCompiler.OutputItem>> myPostponedItems = new HashMap<String, Collection<TranslatingCompiler.OutputItem>>();\r
-    private final CompileContextEx myContext;\r
-    private final TranslatingCompiler[] myCompilers;\r
-    private int myCurrentCompilerIdx;\r
-    private final Set<VirtualFile> myCompiledSources = new HashSet<VirtualFile>();\r
-    //private LinkedBlockingQueue<Future> myFutures = new LinkedBlockingQueue<Future>();\r
-\r
-    private TranslatorsOutputSink(CompileContextEx context, TranslatingCompiler[] compilers) {\r
-      myContext = context;\r
-      myCompilers = compilers;\r
-    }\r
-\r
-    public void setCurrentCompilerIndex(int index) {\r
-      myCurrentCompilerIdx = index;\r
-    }\r
-\r
-    public Set<VirtualFile> getCompiledSources() {\r
-      return Collections.unmodifiableSet(myCompiledSources);\r
-    }\r
-\r
-    public void add(final String outputRoot, final Collection<TranslatingCompiler.OutputItem> items, final VirtualFile[] filesToRecompile) {\r
-      for (TranslatingCompiler.OutputItem item : items) {\r
-        final VirtualFile file = item.getSourceFile();\r
-        if (file != null) {\r
-          myCompiledSources.add(file);\r
-        }\r
-      }\r
-      final TranslatingCompiler compiler = myCompilers[myCurrentCompilerIdx];\r
-      if (compiler instanceof IntermediateOutputCompiler) {\r
-        final LocalFileSystem lfs = LocalFileSystem.getInstance();\r
-        final List<VirtualFile> outputs = new ArrayList<VirtualFile>();\r
-        for (TranslatingCompiler.OutputItem item : items) {\r
-          final VirtualFile vFile = lfs.findFileByPath(item.getOutputPath());\r
-          if (vFile != null) {\r
-            outputs.add(vFile);\r
-          }\r
-        }\r
-        myContext.markGenerated(outputs);\r
-      }\r
-      final int nextCompilerIdx = myCurrentCompilerIdx + 1;\r
-      try {\r
-        if (nextCompilerIdx < myCompilers.length ) {\r
-          final Map<String, Collection<TranslatingCompiler.OutputItem>> updateNow = new java.util.HashMap<String, Collection<TranslatingCompiler.OutputItem>>();\r
-          // process postponed\r
-          for (Map.Entry<String, Collection<TranslatingCompiler.OutputItem>> entry : myPostponedItems.entrySet()) {\r
-            final String outputDir = entry.getKey();\r
-            final Collection<TranslatingCompiler.OutputItem> postponed = entry.getValue();\r
-            for (Iterator<TranslatingCompiler.OutputItem> it = postponed.iterator(); it.hasNext();) {\r
-              TranslatingCompiler.OutputItem item = it.next();\r
-              boolean shouldPostpone = false;\r
-              for (int idx = nextCompilerIdx; idx < myCompilers.length; idx++) {\r
-                shouldPostpone = myCompilers[idx].isCompilableFile(item.getSourceFile(), myContext);\r
-                if (shouldPostpone) {\r
-                  break;\r
-                }\r
-              }\r
-              if (!shouldPostpone) {\r
-                // the file is not compilable by the rest of compilers, so it is safe to update it now\r
-                it.remove();\r
-                addItemToMap(updateNow, outputDir, item);\r
-              }\r
-            }\r
-          }\r
-          // process items from current compilation\r
-          for (TranslatingCompiler.OutputItem item : items) {\r
-            boolean shouldPostpone = false;\r
-            for (int idx = nextCompilerIdx; idx < myCompilers.length; idx++) {\r
-              shouldPostpone = myCompilers[idx].isCompilableFile(item.getSourceFile(), myContext);\r
-              if (shouldPostpone) {\r
-                break;\r
-              }\r
-            }\r
-            if (shouldPostpone) {\r
-              // the file is compilable by the next compiler in row, update should be postponed\r
-              addItemToMap(myPostponedItems, outputRoot, item);\r
-            }\r
-            else {\r
-              addItemToMap(updateNow, outputRoot, item);\r
-            }\r
-          }\r
-\r
-          if (updateNow.size() == 1) {\r
-            final Map.Entry<String, Collection<TranslatingCompiler.OutputItem>> entry = updateNow.entrySet().iterator().next();\r
-            final String outputDir = entry.getKey();\r
-            final Collection<TranslatingCompiler.OutputItem> itemsToUpdate = entry.getValue();\r
-            TranslatingCompilerFilesMonitor.getInstance().update(myContext, outputDir, itemsToUpdate, filesToRecompile);\r
-          }\r
-          else {\r
-            for (Map.Entry<String, Collection<TranslatingCompiler.OutputItem>> entry : updateNow.entrySet()) {\r
-              final String outputDir = entry.getKey();\r
-              final Collection<TranslatingCompiler.OutputItem> itemsToUpdate = entry.getValue();\r
-              TranslatingCompilerFilesMonitor.getInstance().update(myContext, outputDir, itemsToUpdate, VirtualFile.EMPTY_ARRAY);\r
-            }\r
-            if (filesToRecompile.length > 0) {\r
-              TranslatingCompilerFilesMonitor.getInstance().update(myContext, null, Collections.<TranslatingCompiler.OutputItem>emptyList(), filesToRecompile);\r
-            }\r
-          }\r
-        }\r
-        else {\r
-          TranslatingCompilerFilesMonitor.getInstance().update(myContext, outputRoot, items, filesToRecompile);\r
-        }\r
-      }\r
-      catch (IOException e) {\r
-        LOG.info(e);\r
-        myContext.requestRebuildNextTime(e.getMessage());\r
-      }\r
-    }\r
-\r
-    private static void addItemToMap(Map<String, Collection<TranslatingCompiler.OutputItem>> map, String outputDir, TranslatingCompiler.OutputItem item) {\r
-      Collection<TranslatingCompiler.OutputItem> collection = map.get(outputDir);\r
-      if (collection == null) {\r
-        collection = new ArrayList<TranslatingCompiler.OutputItem>();\r
-        map.put(outputDir, collection);\r
-      }\r
-      collection.add(item);\r
-    }\r
-\r
-    public void flushPostponedItems() {\r
-      final TranslatingCompilerFilesMonitor filesMonitor = TranslatingCompilerFilesMonitor.getInstance();\r
-      try {\r
-        for (Map.Entry<String, Collection<TranslatingCompiler.OutputItem>> entry : myPostponedItems.entrySet()) {\r
-          final String outputDir = entry.getKey();\r
-          final Collection<TranslatingCompiler.OutputItem> items = entry.getValue();\r
-          filesMonitor.update(myContext, outputDir, items, VirtualFile.EMPTY_ARRAY);\r
-        }\r
-      }\r
-      catch (IOException e) {\r
-        LOG.info(e);\r
-        myContext.requestRebuildNextTime(e.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  private static class DependentClassesCumulativeFilter implements Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>> {\r
-\r
-    private final TIntHashSet myProcessedNames = new TIntHashSet();\r
-    private final Set<VirtualFile> myProcessedFiles = new HashSet<VirtualFile>();\r
-\r
-    public Pair<int[], Set<VirtualFile>> fun(Pair<int[], Set<VirtualFile>> deps) {\r
-      final TIntHashSet currentDeps = new TIntHashSet(deps.getFirst());\r
-      currentDeps.removeAll(myProcessedNames.toArray());\r
-      myProcessedNames.addAll(deps.getFirst());\r
-\r
-      final Set<VirtualFile> depFiles = new HashSet<VirtualFile>(deps.getSecond());\r
-      depFiles.removeAll(myProcessedFiles);\r
-      myProcessedFiles.addAll(deps.getSecond());\r
-      return new Pair<int[], Set<VirtualFile>>(currentDeps.toArray(), depFiles);\r
-    }\r
-  }\r
-}\r
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @author: Eugene Zhuravlev
+ * Date: Jan 17, 2003
+ * Time: 1:42:26 PM
+ */
+package com.intellij.compiler.impl;
+
+import com.intellij.CommonBundle;
+import com.intellij.compiler.*;
+import com.intellij.compiler.make.CacheCorruptedException;
+import com.intellij.compiler.make.CacheUtils;
+import com.intellij.compiler.make.ChangedConstantsDependencyProcessor;
+import com.intellij.compiler.make.DependencyCache;
+import com.intellij.compiler.progress.CompilerTask;
+import com.intellij.compiler.server.BuildManager;
+import com.intellij.compiler.server.CustomBuilderMessageHandler;
+import com.intellij.compiler.server.DefaultMessageHandler;
+import com.intellij.diagnostic.IdeErrorsDialog;
+import com.intellij.diagnostic.PluginException;
+import com.intellij.openapi.application.*;
+import com.intellij.openapi.compiler.*;
+import com.intellij.openapi.compiler.Compiler;
+import com.intellij.openapi.compiler.ex.CompileContextEx;
+import com.intellij.openapi.compiler.ex.CompilerPathsEx;
+import com.intellij.openapi.compiler.generic.GenericCompiler;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.extensions.Extensions;
+import com.intellij.openapi.extensions.PluginId;
+import com.intellij.openapi.fileEditor.FileDocumentManager;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.module.LanguageLevelUtil;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleManager;
+import com.intellij.openapi.progress.ProcessCanceledException;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.progress.ProgressManager;
+import com.intellij.openapi.project.DumbService;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ProjectBundle;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.openapi.roots.*;
+import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
+import com.intellij.openapi.roots.ui.configuration.CommonContentEntriesEditor;
+import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
+import com.intellij.openapi.ui.MessageType;
+import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.util.*;
+import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.util.registry.Registry;
+import com.intellij.openapi.vfs.*;
+import com.intellij.openapi.vfs.newvfs.ManagingFS;
+import com.intellij.openapi.vfs.newvfs.RefreshQueue;
+import com.intellij.openapi.wm.StatusBar;
+import com.intellij.openapi.wm.ToolWindowId;
+import com.intellij.openapi.wm.ToolWindowManager;
+import com.intellij.openapi.wm.WindowManager;
+import com.intellij.packaging.artifacts.Artifact;
+import com.intellij.packaging.artifacts.ArtifactManager;
+import com.intellij.packaging.impl.artifacts.ArtifactImpl;
+import com.intellij.packaging.impl.artifacts.ArtifactUtil;
+import com.intellij.packaging.impl.compiler.ArtifactCompileScope;
+import com.intellij.packaging.impl.compiler.ArtifactCompilerUtil;
+import com.intellij.pom.java.LanguageLevel;
+import com.intellij.psi.PsiDocumentManager;
+import com.intellij.util.Chunk;
+import com.intellij.util.Function;
+import com.intellij.util.StringBuilderSpinAllocator;
+import com.intellij.util.ThrowableRunnable;
+import com.intellij.util.concurrency.Semaphore;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.HashMap;
+import com.intellij.util.containers.MultiMap;
+import com.intellij.util.containers.OrderedSet;
+import com.intellij.util.messages.MessageBus;
+import gnu.trove.TIntHashSet;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.TestOnly;
+import org.jetbrains.jps.api.CmdlineProtoUtil;
+import org.jetbrains.jps.api.CmdlineRemoteProto;
+import org.jetbrains.jps.api.RequestFuture;
+import org.jetbrains.jps.incremental.Utils;
+
+import javax.swing.*;
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+import static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope;
+
+public class CompileDriver {
+
+  private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.CompileDriver");
+  // to be used in tests only for debug output
+  public static volatile boolean ourDebugMode = false;
+
+  private final Project myProject;
+  private final Map<Pair<IntermediateOutputCompiler, Module>, Pair<VirtualFile, VirtualFile>> myGenerationCompilerModuleToOutputDirMap; // [IntermediateOutputCompiler, Module] -> [ProductionSources, TestSources]
+  private final String myCachesDirectoryPath;
+  private boolean myShouldClearOutputDirectory;
+
+  private final Map<Module, String> myModuleOutputPaths = new HashMap<Module, String>();
+  private final Map<Module, String> myModuleTestOutputPaths = new HashMap<Module, String>();
+
+  @NonNls private static final String VERSION_FILE_NAME = "version.dat";
+  @NonNls private static final String LOCK_FILE_NAME = "in_progress.dat";
+
+  private static final boolean GENERATE_CLASSPATH_INDEX = "true".equals(System.getProperty("generate.classpath.index"));
+  private static final String PROP_PERFORM_INITIAL_REFRESH = "compiler.perform.outputs.refresh.on.start";
+  private static final Key<Boolean> REFRESH_DONE_KEY = Key.create("_compiler.initial.refresh.done_");
+
+  private static final FileProcessingCompilerAdapterFactory FILE_PROCESSING_COMPILER_ADAPTER_FACTORY = new FileProcessingCompilerAdapterFactory() {
+    public FileProcessingCompilerAdapter create(CompileContext context, FileProcessingCompiler compiler) {
+      return new FileProcessingCompilerAdapter(context, compiler);
+    }
+  };
+  private static final FileProcessingCompilerAdapterFactory FILE_PACKAGING_COMPILER_ADAPTER_FACTORY = new FileProcessingCompilerAdapterFactory() {
+    public FileProcessingCompilerAdapter create(CompileContext context, FileProcessingCompiler compiler) {
+      return new PackagingCompilerAdapter(context, (PackagingCompiler)compiler);
+    }
+  };
+  private CompilerFilter myCompilerFilter = CompilerFilter.ALL;
+  private static final CompilerFilter SOURCE_PROCESSING_ONLY = new CompilerFilter() {
+    public boolean acceptCompiler(Compiler compiler) {
+      return compiler instanceof SourceProcessingCompiler;
+    }
+  };
+  private static final CompilerFilter ALL_EXCEPT_SOURCE_PROCESSING = new CompilerFilter() {
+    public boolean acceptCompiler(Compiler compiler) {
+      return !SOURCE_PROCESSING_ONLY.acceptCompiler(compiler);
+    }
+  };
+
+  private Set<File> myAllOutputDirectories;
+  private static final long ONE_MINUTE_MS = 60L /*sec*/ * 1000L /*millisec*/;
+
+  public CompileDriver(Project project) {
+    myProject = project;
+    myCachesDirectoryPath = CompilerPaths.getCacheStoreDirectory(myProject).getPath().replace('/', File.separatorChar);
+    myShouldClearOutputDirectory = CompilerWorkspaceConfiguration.getInstance(myProject).CLEAR_OUTPUT_DIRECTORY;
+
+    myGenerationCompilerModuleToOutputDirMap = new HashMap<Pair<IntermediateOutputCompiler, Module>, Pair<VirtualFile, VirtualFile>>();
+
+    if (!useOutOfProcessBuild()) {
+      final LocalFileSystem lfs = LocalFileSystem.getInstance();
+      final IntermediateOutputCompiler[] generatingCompilers = CompilerManager.getInstance(myProject).getCompilers(IntermediateOutputCompiler.class, myCompilerFilter);
+      final Module[] allModules = ModuleManager.getInstance(myProject).getModules();
+      final CompilerConfiguration config = CompilerConfiguration.getInstance(project);
+      for (Module module : allModules) {
+        for (IntermediateOutputCompiler compiler : generatingCompilers) {
+          final VirtualFile productionOutput = lookupVFile(lfs, CompilerPaths.getGenerationOutputPath(compiler, module, false));
+          final VirtualFile testOutput = lookupVFile(lfs, CompilerPaths.getGenerationOutputPath(compiler, module, true));
+          final Pair<IntermediateOutputCompiler, Module> pair = new Pair<IntermediateOutputCompiler, Module>(compiler, module);
+          final Pair<VirtualFile, VirtualFile> outputs = new Pair<VirtualFile, VirtualFile>(productionOutput, testOutput);
+          myGenerationCompilerModuleToOutputDirMap.put(pair, outputs);
+        }
+        if (config.getAnnotationProcessingConfiguration(module).isEnabled()) {
+          final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);
+          if (path != null) {
+            lookupVFile(lfs, path);  // ensure the file is created and added to VFS
+          }
+        }
+      }
+    }
+  }
+
+  public void setCompilerFilter(CompilerFilter compilerFilter) {
+    myCompilerFilter = compilerFilter == null? CompilerFilter.ALL : compilerFilter;
+  }
+
+  public void rebuild(CompileStatusNotification callback) {
+    final CompileScope compileScope;
+    ProjectCompileScope projectScope = new ProjectCompileScope(myProject);
+    if (useOutOfProcessBuild()) {
+      compileScope = projectScope;
+    }
+    else {
+      CompileScope scopeWithArtifacts = ArtifactCompileScope.createScopeWithArtifacts(projectScope, ArtifactUtil.getArtifactWithOutputPaths(myProject), false);
+      compileScope = addAdditionalRoots(scopeWithArtifacts, ALL_EXCEPT_SOURCE_PROCESSING);
+    }
+    doRebuild(callback, null, true, compileScope);
+  }
+
+  public void make(CompileScope scope, CompileStatusNotification callback) {
+    if (!useOutOfProcessBuild()) {
+      scope = addAdditionalRoots(scope, ALL_EXCEPT_SOURCE_PROCESSING);
+    }
+    if (validateCompilerConfiguration(scope, false)) {
+      startup(scope, false, false, callback, null, true);
+    }
+    else {
+      callback.finished(true, 0, 0, DummyCompileContext.getInstance());
+    }
+  }
+
+  public boolean isUpToDate(CompileScope scope) {
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("isUpToDate operation started");
+    }
+    if (!useOutOfProcessBuild()) {
+      scope = addAdditionalRoots(scope, ALL_EXCEPT_SOURCE_PROCESSING);
+    }
+
+    final CompilerTask task = new CompilerTask(myProject, "Classes up-to-date check", true, false);
+    final DependencyCache cache = useOutOfProcessBuild()? null : createDependencyCache();
+    final CompileContextImpl compileContext = new CompileContextImpl(myProject, task, scope, cache, true, false);
+
+    if (!useOutOfProcessBuild()) {
+      checkCachesVersion(compileContext, ManagingFS.getInstance().getCreationTimestamp());
+      if (compileContext.isRebuildRequested()) {
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("Rebuild requested, up-to-date=false");
+        }
+        return false;
+      }
+
+      for (Map.Entry<Pair<IntermediateOutputCompiler, Module>, Pair<VirtualFile, VirtualFile>> entry : myGenerationCompilerModuleToOutputDirMap.entrySet()) {
+        final Pair<VirtualFile, VirtualFile> outputs = entry.getValue();
+        final Pair<IntermediateOutputCompiler, Module> key = entry.getKey();
+        final Module module = key.getSecond();
+        compileContext.assignModule(outputs.getFirst(), module, false, key.getFirst());
+        compileContext.assignModule(outputs.getSecond(), module, true, key.getFirst());
+      }
+    }
+
+    final Ref<ExitStatus> result = new Ref<ExitStatus>();
+
+    final Runnable compileWork;
+    if (useOutOfProcessBuild()) {
+      compileWork = new Runnable() {
+        public void run() {
+          final ProgressIndicator indicator = compileContext.getProgressIndicator();
+          if (indicator.isCanceled() || myProject.isDisposed()) {
+            return;
+          }
+          try {
+            final Collection<String> paths = CompileScopeUtil.fetchFiles(compileContext);
+            List<TargetTypeBuildScope> scopes = new ArrayList<TargetTypeBuildScope>();
+            if (paths.isEmpty()) {
+              if (!compileContext.isRebuild() && !CompileScopeUtil.allProjectModulesAffected(compileContext)) {
+                CompileScopeUtil.addScopesForModules(Arrays.asList(compileContext.getCompileScope().getAffectedModules()), scopes);
+              }
+              else {
+                scopes.addAll(CmdlineProtoUtil.createAllModulesScopes());
+              }
+              for (BuildTargetScopeProvider provider : BuildTargetScopeProvider.EP_NAME.getExtensions()) {
+                scopes = CompileScopeUtil.mergeScopes(scopes, provider.getBuildTargetScopes(compileContext.getCompileScope(), myCompilerFilter, myProject));
+              }
+            }
+            final RequestFuture future = compileInExternalProcess(compileContext, scopes, paths, true);
+            if (future != null) {
+              while (!future.waitFor(200L , TimeUnit.MILLISECONDS)) {
+                if (indicator.isCanceled()) {
+                  future.cancel(false);
+                }
+              }
+            }
+          }
+          catch (Throwable e) {
+            LOG.error(e);
+          }
+          finally {
+            result.set(COMPILE_SERVER_BUILD_STATUS.get(compileContext));
+            CompilerCacheManager.getInstance(myProject).flushCaches();
+          }
+        }
+      };
+    }
+    else {
+      compileWork = new Runnable() {
+        public void run() {
+          try {
+            myAllOutputDirectories = getAllOutputDirectories(compileContext);
+            // need this for updating zip archives experiment, uncomment if the feature is turned on
+            //myOutputFinder = new OutputPathFinder(myAllOutputDirectories);
+            result.set(doCompile(compileContext, false, false, true));
+          }
+          finally {
+            CompilerCacheManager.getInstance(myProject).flushCaches();
+          }
+        }
+      };
+    }
+    task.start(compileWork, null);
+
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("isUpToDate operation finished");
+    }
+
+    return ExitStatus.UP_TO_DATE.equals(result.get());
+  }
+
+  private DependencyCache createDependencyCache() {
+    return new DependencyCache(myCachesDirectoryPath + File.separator + ".dependency-info");
+  }
+
+  public void compile(CompileScope scope, CompileStatusNotification callback, boolean clearingOutputDirsPossible) {
+    myShouldClearOutputDirectory &= clearingOutputDirsPossible;
+    if (containsFileIndexScopes(scope)) {
+      scope = addAdditionalRoots(scope, ALL_EXCEPT_SOURCE_PROCESSING);
+    }
+    if (validateCompilerConfiguration(scope, false)) {
+      startup(scope, false, true, callback, null, true);
+    }
+    else {
+      callback.finished(true, 0, 0, DummyCompileContext.getInstance());
+    }
+  }
+
+  private static boolean containsFileIndexScopes(CompileScope scope) {
+    if (scope instanceof CompositeScope) {
+      for (CompileScope childScope : ((CompositeScope)scope).getScopes()) {
+        if (containsFileIndexScopes(childScope)) {
+          return true;
+        }
+      }
+    }
+    return scope instanceof FileIndexCompileScope;
+  }
+
+  private static class CompileStatus {
+    final int CACHE_FORMAT_VERSION;
+    final boolean COMPILATION_IN_PROGRESS;
+    final long VFS_CREATION_STAMP;
+
+    private CompileStatus(int cacheVersion, boolean isCompilationInProgress, long vfsStamp) {
+      CACHE_FORMAT_VERSION = cacheVersion;
+      COMPILATION_IN_PROGRESS = isCompilationInProgress;
+      VFS_CREATION_STAMP = vfsStamp;
+    }
+  }
+
+  private CompileStatus readStatus() {
+    final boolean isInProgress = getLockFile().exists();
+    int version = -1;
+    long vfsStamp = -1L;
+    try {
+      final File versionFile = new File(myCachesDirectoryPath, VERSION_FILE_NAME);
+      DataInputStream in = new DataInputStream(new FileInputStream(versionFile));
+      try {
+        version = in.readInt();
+        try {
+          vfsStamp = in.readLong();
+        }
+        catch (IOException ignored) {
+        }
+      }
+      finally {
+        in.close();
+      }
+    }
+    catch (FileNotFoundException e) {
+      // ignore
+    }
+    catch (IOException e) {
+      LOG.info(e);  // may happen in case of IDEA crashed and the file is not written properly
+      return null;
+    }
+    return new CompileStatus(version, isInProgress, vfsStamp);
+  }
+
+  private void writeStatus(CompileStatus status, CompileContext context) {
+    final File statusFile = new File(myCachesDirectoryPath, VERSION_FILE_NAME);
+
+    final File lockFile = getLockFile();
+    try {
+      FileUtil.createIfDoesntExist(statusFile);
+      DataOutputStream out = new DataOutputStream(new FileOutputStream(statusFile));
+      try {
+        out.writeInt(status.CACHE_FORMAT_VERSION);
+        out.writeLong(status.VFS_CREATION_STAMP);
+      }
+      finally {
+        out.close();
+      }
+      if (status.COMPILATION_IN_PROGRESS) {
+        FileUtil.createIfDoesntExist(lockFile);
+      }
+      else {
+        deleteFile(lockFile);
+      }
+    }
+    catch (IOException e) {
+      context.addMessage(CompilerMessageCategory.ERROR, CompilerBundle.message("compiler.error.exception", e.getMessage()), null, -1, -1);
+    }
+  }
+
+  private File getLockFile() {
+    return new File(CompilerPaths.getCompilerSystemDirectory(myProject), LOCK_FILE_NAME);
+  }
+
+  private void doRebuild(CompileStatusNotification callback,
+                         CompilerMessage message,
+                         final boolean checkCachesVersion,
+                         final CompileScope compileScope) {
+    if (validateCompilerConfiguration(compileScope, !useOutOfProcessBuild())) {
+      startup(compileScope, true, false, callback, message, checkCachesVersion);
+    }
+    else {
+      callback.finished(true, 0, 0, DummyCompileContext.getInstance());
+    }
+  }
+
+  private CompileScope addAdditionalRoots(CompileScope originalScope, final CompilerFilter filter) {
+    CompileScope scope = attachIntermediateOutputDirectories(originalScope, filter);
+
+    final AdditionalCompileScopeProvider[] scopeProviders = Extensions.getExtensions(AdditionalCompileScopeProvider.EXTENSION_POINT_NAME);
+    CompileScope baseScope = scope;
+    for (AdditionalCompileScopeProvider scopeProvider : scopeProviders) {
+      final CompileScope additionalScope = scopeProvider.getAdditionalScope(baseScope, filter, myProject);
+      if (additionalScope != null) {
+        scope = new CompositeScope(scope, additionalScope);
+      }
+    }
+    return scope;
+  }
+
+  private CompileScope attachIntermediateOutputDirectories(CompileScope originalScope, CompilerFilter filter) {
+    CompileScope scope = originalScope;
+    final Set<Module> affected = new HashSet<Module>(Arrays.asList(originalScope.getAffectedModules()));
+    for (Map.Entry<Pair<IntermediateOutputCompiler, Module>, Pair<VirtualFile, VirtualFile>> entry : myGenerationCompilerModuleToOutputDirMap.entrySet()) {
+      final Module module = entry.getKey().getSecond();
+      if (affected.contains(module) && filter.acceptCompiler(entry.getKey().getFirst())) {
+        final Pair<VirtualFile, VirtualFile> outputs = entry.getValue();
+        scope = new CompositeScope(scope, new FileSetCompileScope(Arrays.asList(outputs.getFirst(), outputs.getSecond()), new Module[]{module}));
+      }
+    }
+    return scope;
+  }
+
+  private void attachAnnotationProcessorsOutputDirectories(CompileContextEx context) {
+    final LocalFileSystem lfs = LocalFileSystem.getInstance();
+    final CompilerConfiguration config = CompilerConfiguration.getInstance(myProject);
+    final Set<Module> affected = new HashSet<Module>(Arrays.asList(context.getCompileScope().getAffectedModules()));
+    for (Module module : affected) {
+      if (!config.getAnnotationProcessingConfiguration(module).isEnabled()) {
+        continue;
+      }
+      final String path = CompilerPaths.getAnnotationProcessorsGenerationPath(module);
+      if (path == null) {
+        continue;
+      }
+      final VirtualFile vFile = lfs.findFileByPath(path);
+      if (vFile == null) {
+        continue;
+      }
+      if (ModuleRootManager.getInstance(module).getFileIndex().isInSourceContent(vFile)) {
+        // no need to add, is already marked as source
+        continue;
+      }
+      context.addScope(new FileSetCompileScope(Collections.singletonList(vFile), new Module[]{module}));
+      context.assignModule(vFile, module, false, null);
+    }
+  }
+
+  @Nullable
+  private RequestFuture compileInExternalProcess(final @NotNull CompileContextImpl compileContext,
+                                                 @NotNull List<TargetTypeBuildScope> scopes,
+                                                 final @NotNull Collection<String> paths,
+                                                 final boolean onlyCheckUpToDate)
+    throws Exception {
+    final CompileScope scope = compileContext.getCompileScope();
+    // need to pass scope's user data to server
+    final Map<String, String> builderParams;
+    if (onlyCheckUpToDate) {
+      builderParams = Collections.emptyMap();
+    }
+    else {
+      final Map<Key, Object> exported = scope.exportUserData();
+      if (!exported.isEmpty()) {
+        builderParams = new HashMap<String, String>();
+        for (Map.Entry<Key, Object> entry : exported.entrySet()) {
+          final String _key = entry.getKey().toString();
+          final String _value = entry.getValue().toString();
+          builderParams.put(_key, _value);
+        }
+      }
+      else {
+        builderParams = Collections.emptyMap();
+      }
+    }
+
+    final MessageBus messageBus = myProject.getMessageBus();
+
+    final BuildManager buildManager = BuildManager.getInstance();
+    buildManager.cancelAutoMakeTasks(myProject);
+    return buildManager.scheduleBuild(myProject, compileContext.isRebuild(), compileContext.isMake(), onlyCheckUpToDate, scopes, paths, builderParams, new DefaultMessageHandler(myProject) {
+
+      @Override
+      public void buildStarted(UUID sessionId) {
+      }
+
+      @Override
+      public void sessionTerminated(final UUID sessionId) {
+        if (compileContext.shouldUpdateProblemsView()) {
+          final ProblemsView view = ProblemsViewImpl.SERVICE.getInstance(myProject);
+          view.clearProgress();
+          view.clearOldMessages(compileContext.getCompileScope(), compileContext.getSessionId());
+        }
+      }
+
+      @Override
+      public void handleFailure(UUID sessionId, CmdlineRemoteProto.Message.Failure failure) {
+        compileContext.addMessage(CompilerMessageCategory.ERROR, failure.getDescription(), null, -1, -1);
+        final String trace = failure.getStacktrace();
+        if (trace != null) {
+          LOG.info(trace);
+          System.out.println(trace);
+        }
+        compileContext.putUserData(COMPILE_SERVER_BUILD_STATUS, ExitStatus.ERRORS);
+      }
+
+      @Override
+      protected void handleCompileMessage(UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage.CompileMessage message) {
+        final CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind kind = message.getKind();
+        //System.out.println(compilerMessage.getText());
+        final String messageText = message.getText();
+        if (kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.PROGRESS) {
+          final ProgressIndicator indicator = compileContext.getProgressIndicator();
+          indicator.setText(messageText);
+          if (message.hasDone()) {
+            indicator.setFraction(message.getDone());
+          }
+        }
+        else {
+          final CompilerMessageCategory category = kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.ERROR ? CompilerMessageCategory.ERROR
+            : kind == CmdlineRemoteProto.Message.BuilderMessage.CompileMessage.Kind.WARNING ? CompilerMessageCategory.WARNING : CompilerMessageCategory.INFORMATION;
+
+          String sourceFilePath = message.hasSourceFilePath() ? message.getSourceFilePath() : null;
+          if (sourceFilePath != null) {
+            sourceFilePath = FileUtil.toSystemIndependentName(sourceFilePath);
+          }
+          final long line = message.hasLine() ? message.getLine() : -1;
+          final long column = message.hasColumn() ? message.getColumn() : -1;
+          final String srcUrl = sourceFilePath != null ? VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, sourceFilePath) : null;
+          compileContext.addMessage(category, messageText, srcUrl, (int)line, (int)column);
+        }
+      }
+
+      @Override
+      protected void handleBuildEvent(UUID sessionId, CmdlineRemoteProto.Message.BuilderMessage.BuildEvent event) {
+        final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Type eventType = event.getEventType();
+        switch (eventType) {
+          case FILES_GENERATED:
+            final List<CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile> generated = event.getGeneratedFilesList();
+            final CompilationStatusListener publisher = messageBus.syncPublisher(CompilerTopics.COMPILATION_STATUS);
+            for (CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.GeneratedFile generatedFile : generated) {
+              final String root = FileUtil.toSystemIndependentName(generatedFile.getOutputRoot());
+              final String relativePath = FileUtil.toSystemIndependentName(generatedFile.getRelativePath());
+              publisher.fileGenerated(root, relativePath);
+            }
+            break;
+          case BUILD_COMPLETED:
+            ExitStatus status = ExitStatus.SUCCESS;
+            if (event.hasCompletionStatus()) {
+              final CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status completionStatus = event.getCompletionStatus();
+              switch (completionStatus) {
+                case CANCELED:
+                  status = ExitStatus.CANCELLED;
+                  break;
+                case ERRORS:
+                  status = ExitStatus.ERRORS;
+                  break;
+                case SUCCESS:
+                  status = ExitStatus.SUCCESS;
+                  break;
+                case UP_TO_DATE:
+                  status = ExitStatus.UP_TO_DATE;
+                  break;
+              }
+            }
+            compileContext.putUserDataIfAbsent(COMPILE_SERVER_BUILD_STATUS, status);
+            break;
+          case CUSTOM_BUILDER_MESSAGE:
+            if (event.hasCustomBuilderMessage()) {
+              CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.CustomBuilderMessage message = event.getCustomBuilderMessage();
+              messageBus.syncPublisher(CustomBuilderMessageHandler.TOPIC).messageReceived(message.getBuilderId(), message.getMessageType(),
+                                                                                          message.getMessageText());
+            }
+            break;
+        }
+      }
+    });
+  }
+
+
+  private static final Key<ExitStatus> COMPILE_SERVER_BUILD_STATUS = Key.create("COMPILE_SERVER_BUILD_STATUS");
+
+  private void startup(final CompileScope scope,
+                       final boolean isRebuild,
+                       final boolean forceCompile,
+                       final CompileStatusNotification callback,
+                       final CompilerMessage message,
+                       final boolean checkCachesVersion) {
+    ApplicationManager.getApplication().assertIsDispatchThread();
+
+    final boolean useExtProcessBuild = useOutOfProcessBuild();
+
+    final String contentName =
+      forceCompile ? CompilerBundle.message("compiler.content.name.compile") : CompilerBundle.message("compiler.content.name.make");
+    final CompilerTask compileTask = new CompilerTask(myProject, contentName, ApplicationManager.getApplication().isUnitTestMode(), true);
+
+    StatusBar.Info.set("", myProject, "Compiler");
+    if (useExtProcessBuild) {
+      // ensure the project model seen by build process is up-to-date
+      myProject.save();
+    }
+    PsiDocumentManager.getInstance(myProject).commitAllDocuments();
+    FileDocumentManager.getInstance().saveAllDocuments();
+
+    final DependencyCache dependencyCache = useExtProcessBuild ? null: createDependencyCache();
+    final CompileContextImpl compileContext =
+      new CompileContextImpl(myProject, compileTask, scope, dependencyCache, !isRebuild && !forceCompile, isRebuild);
+
+    if (!useExtProcessBuild) {
+      for (Map.Entry<Pair<IntermediateOutputCompiler, Module>, Pair<VirtualFile, VirtualFile>> entry : myGenerationCompilerModuleToOutputDirMap.entrySet()) {
+        final Pair<VirtualFile, VirtualFile> outputs = entry.getValue();
+        final Pair<IntermediateOutputCompiler, Module> key = entry.getKey();
+        final Module module = key.getSecond();
+        compileContext.assignModule(outputs.getFirst(), module, false, key.getFirst());
+        compileContext.assignModule(outputs.getSecond(), module, true, key.getFirst());
+      }
+      attachAnnotationProcessorsOutputDirectories(compileContext);
+    }
+
+    final Runnable compileWork;
+    if (useExtProcessBuild) {
+      compileWork = new Runnable() {
+        public void run() {
+          final ProgressIndicator indicator = compileContext.getProgressIndicator();
+          if (indicator.isCanceled() || myProject.isDisposed()) {
+            if (callback != null) {
+              callback.finished(true, 0, 0, compileContext);
+            }
+            return;
+          }
+          try {
+            LOG.info("COMPILATION STARTED (BUILD PROCESS)");
+            if (message != null) {
+              compileContext.addMessage(message);
+            }
+            if (!executeCompileTasks(compileContext, true)) {
+              COMPILE_SERVER_BUILD_STATUS.set(compileContext, ExitStatus.CANCELLED);
+              return;
+            }
+
+            final Collection<String> paths = CompileScopeUtil.fetchFiles(compileContext);
+            List<TargetTypeBuildScope> scopes = new ArrayList<TargetTypeBuildScope>();
+            if (paths.isEmpty()) {
+              if (!isRebuild && !CompileScopeUtil.allProjectModulesAffected(compileContext)) {
+                CompileScopeUtil.addScopesForModules(Arrays.asList(compileContext.getCompileScope().getAffectedModules()), scopes);
+              }
+              else {
+                scopes.addAll(CmdlineProtoUtil.createAllModulesScopes());
+              }
+              for (BuildTargetScopeProvider provider : BuildTargetScopeProvider.EP_NAME.getExtensions()) {
+                scopes = CompileScopeUtil.mergeScopes(scopes, provider.getBuildTargetScopes(scope, myCompilerFilter, myProject));
+              }
+            }
+            final RequestFuture future = compileInExternalProcess(compileContext, scopes, paths, false);
+            if (future != null) {
+              while (!future.waitFor(200L , TimeUnit.MILLISECONDS)) {
+                if (indicator.isCanceled()) {
+                  future.cancel(false);
+                }
+              }
+              if (!executeCompileTasks(compileContext, false)) {
+                COMPILE_SERVER_BUILD_STATUS.set(compileContext, ExitStatus.CANCELLED);
+                return;
+              }
+            }
+          }
+          catch (Throwable e) {
+            LOG.error(e); // todo
+          }
+          finally {
+            CompilerCacheManager.getInstance(myProject).flushCaches();
+
+            final long duration = notifyCompilationCompleted(compileContext, callback, COMPILE_SERVER_BUILD_STATUS.get(compileContext));
+            CompilerUtil.logDuration(
+              "\tCOMPILATION FINISHED (BUILD PROCESS); Errors: " +
+              compileContext.getMessageCount(CompilerMessageCategory.ERROR) +
+              "; warnings: " +
+              compileContext.getMessageCount(CompilerMessageCategory.WARNING),
+              duration
+            );
+
+            // refresh on output roots is required in order for the order enumerator to see all roots via VFS
+            final Set<File> outputs = new HashSet<File>();
+            for (final String path : CompilerPathsEx.getOutputPaths(ModuleManager.getInstance(myProject).getModules())) {
+              outputs.add(new File(path));
+            }
+            if (!outputs.isEmpty()) {
+              LocalFileSystem.getInstance().refreshIoFiles(outputs, true, false, null);
+            }
+          }
+        }
+      };
+    }
+    else {
+      compileWork = new Runnable() {
+        public void run() {
+          if (compileContext.getProgressIndicator().isCanceled()) {
+            if (callback != null) {
+              callback.finished(true, 0, 0, compileContext);
+            }
+            return;
+          }
+          try {
+            if (myProject.isDisposed()) {
+              return;
+            }
+            LOG.info("COMPILATION STARTED");
+            if (message != null) {