diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java index 8a5e94f9cc48..3fb559a29759 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java @@ -11,7 +11,6 @@ import com.intellij.notification.NotificationListener; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.compiler.*; -import com.intellij.openapi.compiler.ex.CompilerPathsEx; import com.intellij.openapi.deployment.DeploymentUtil; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.fileEditor.FileDocumentManager; @@ -473,7 +472,7 @@ public class CompileDriver { if (_status != ExitStatus.UP_TO_DATE && _status != ExitStatus.CANCELLED) { // have to refresh in case of errors too, because run configuration may be set to ignore errors - Collection affectedRoots = ContainerUtil.newHashSet(CompilerPathsEx.getOutputPaths(affectedModules)); + Collection affectedRoots = ContainerUtil.newHashSet(CompilerPaths.getOutputPaths(affectedModules)); if (!affectedRoots.isEmpty()) { ProgressIndicator indicator = compileContext.getProgressIndicator(); indicator.setText("Synchronizing output directories..."); diff --git a/java/compiler/impl/src/com/intellij/ide/macro/OutputPathMacro.java b/java/compiler/impl/src/com/intellij/ide/macro/OutputPathMacro.java index bba7f8737bfc..fd7823a4f30a 100644 --- a/java/compiler/impl/src/com/intellij/ide/macro/OutputPathMacro.java +++ b/java/compiler/impl/src/com/intellij/ide/macro/OutputPathMacro.java @@ -1,24 +1,10 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.macro; import com.intellij.ide.IdeBundle; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.openapi.compiler.ex.CompilerPathsEx; +import com.intellij.openapi.compiler.CompilerPaths; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; import com.intellij.openapi.project.Project; @@ -65,7 +51,7 @@ public final class OutputPathMacro extends Macro { if (allModules.length == 0) { return null; } - String[] paths = CompilerPathsEx.getOutputPaths(allModules); + String[] paths = CompilerPaths.getOutputPaths(allModules); final StringBuilder outputPath = new StringBuilder(); for (int idx = 0; idx < paths.length; idx++) { String path = paths[idx]; diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java index 84946b94fca4..bced9fac95d4 100644 --- a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java +++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.compiler; import com.intellij.compiler.CompilerConfiguration; @@ -25,15 +11,22 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectUtil; import com.intellij.openapi.roots.CompilerModuleExtension; import com.intellij.openapi.roots.ModuleRootManager; +import com.intellij.openapi.roots.OrderEnumerationHandler; +import com.intellij.openapi.roots.OrderRootType; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; +import com.intellij.util.ArrayUtil; +import com.intellij.util.SmartList; +import com.intellij.util.containers.OrderedSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jps.model.java.compiler.AnnotationProcessingConfiguration; import java.io.File; import java.util.Arrays; +import java.util.List; +import java.util.Set; /** * A set of utility methods for working with paths @@ -155,4 +148,35 @@ public class CompilerPaths { return StringUtil.isEmpty(sourceDirName)? path : path + "/" + sourceDirName; } -} + @NotNull + public static String[] getOutputPaths(@NotNull Module[] modules) { + Set outputPaths = new OrderedSet<>(); + for (Module module : modules) { + CompilerModuleExtension compilerModuleExtension = !module.isDisposed()? CompilerModuleExtension.getInstance(module) : null; + if (compilerModuleExtension == null) continue; + + String outputPathUrl = compilerModuleExtension.getCompilerOutputUrl(); + if (outputPathUrl != null) { + outputPaths.add(VirtualFileManager.extractPath(outputPathUrl).replace('/', File.separatorChar)); + } + + String outputPathForTestsUrl = compilerModuleExtension.getCompilerOutputUrlForTests(); + if (outputPathForTestsUrl != null) { + outputPaths.add(VirtualFileManager.extractPath(outputPathForTestsUrl).replace('/', File.separatorChar)); + } + + ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); + for (OrderEnumerationHandler.Factory handlerFactory : OrderEnumerationHandler.EP_NAME.getExtensions()) { + if (handlerFactory.isApplicable(module)) { + OrderEnumerationHandler handler = handlerFactory.createHandler(module); + List outputUrls = new SmartList<>(); + handler.addCustomModuleRoots(OrderRootType.CLASSES, moduleRootManager, outputUrls, true, true); + for (String outputUrl : outputUrls) { + outputPaths.add(VirtualFileManager.extractPath(outputUrl).replace('/', File.separatorChar)); + } + } + } + } + return ArrayUtil.toStringArray(outputPaths); + } +} \ No newline at end of file diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/ex/CompilerPathsEx.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/ex/CompilerPathsEx.java index 0b99bd74d3d3..cd7b8576db5c 100644 --- a/java/compiler/openapi/src/com/intellij/openapi/compiler/ex/CompilerPathsEx.java +++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/ex/CompilerPathsEx.java @@ -1,52 +1,8 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.compiler.ex; import com.intellij.openapi.compiler.CompilerPaths; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.roots.CompilerModuleExtension; -import com.intellij.openapi.roots.ModuleRootManager; -import com.intellij.openapi.roots.OrderEnumerationHandler; -import com.intellij.openapi.roots.OrderRootType; -import com.intellij.openapi.vfs.VirtualFileManager; -import com.intellij.util.ArrayUtil; -import com.intellij.util.SmartList; -import com.intellij.util.containers.OrderedSet; -import org.jetbrains.annotations.NotNull; -import java.io.File; -import java.util.List; -import java.util.Set; - -public class CompilerPathsEx extends CompilerPaths { - @NotNull - public static String[] getOutputPaths(@NotNull Module[] modules) { - Set outputPaths = new OrderedSet<>(); - for (Module module : modules) { - CompilerModuleExtension compilerModuleExtension = !module.isDisposed()? CompilerModuleExtension.getInstance(module) : null; - if (compilerModuleExtension == null) continue; - - String outputPathUrl = compilerModuleExtension.getCompilerOutputUrl(); - if (outputPathUrl != null) { - outputPaths.add(VirtualFileManager.extractPath(outputPathUrl).replace('/', File.separatorChar)); - } - - String outputPathForTestsUrl = compilerModuleExtension.getCompilerOutputUrlForTests(); - if (outputPathForTestsUrl != null) { - outputPaths.add(VirtualFileManager.extractPath(outputPathForTestsUrl).replace('/', File.separatorChar)); - } - - ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); - for (OrderEnumerationHandler.Factory handlerFactory : OrderEnumerationHandler.EP_NAME.getExtensions()) { - if (handlerFactory.isApplicable(module)) { - OrderEnumerationHandler handler = handlerFactory.createHandler(module); - List outputUrls = new SmartList<>(); - handler.addCustomModuleRoots(OrderRootType.CLASSES, moduleRootManager, outputUrls, true, true); - for (String outputUrl : outputUrls) { - outputPaths.add(VirtualFileManager.extractPath(outputUrl).replace('/', File.separatorChar)); - } - } - } - } - return ArrayUtil.toStringArray(outputPaths); - } -} \ No newline at end of file +/** @deprecated use {@link CompilerPaths} */ +@Deprecated +public class CompilerPathsEx extends CompilerPaths { } \ No newline at end of file diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java index 87078ba77bdd..98c795614357 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java @@ -13,7 +13,7 @@ import com.intellij.notification.NotificationType; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; -import com.intellij.openapi.compiler.ex.CompilerPathsEx; +import com.intellij.openapi.compiler.CompilerPaths; import com.intellij.openapi.module.ModuleManager; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; @@ -310,7 +310,7 @@ public class HotSwapUIImpl extends HotSwapUI { private MyCompilationStatusListener() { myOutputRoots = new THashSet<>(FileUtil.FILE_HASHING_STRATEGY); - for (final String path : CompilerPathsEx.getOutputPaths(ModuleManager.getInstance(myProject).getModules())) { + for (final String path : CompilerPaths.getOutputPaths(ModuleManager.getInstance(myProject).getModules())) { myOutputRoots.add(new File(path)); } } diff --git a/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/test/ExternalSystemImportingTestCase.java b/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/test/ExternalSystemImportingTestCase.java index 4652e30d845b..44acb1ff4036 100644 --- a/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/test/ExternalSystemImportingTestCase.java +++ b/platform/external-system-impl/testSrc/com/intellij/openapi/externalSystem/test/ExternalSystemImportingTestCase.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.externalSystem.test; import com.intellij.find.FindManager; @@ -20,7 +6,7 @@ import com.intellij.find.findUsages.FindUsagesHandler; import com.intellij.find.findUsages.FindUsagesManager; import com.intellij.find.findUsages.FindUsagesOptions; import com.intellij.find.impl.FindManagerImpl; -import com.intellij.openapi.compiler.ex.CompilerPathsEx; +import com.intellij.openapi.compiler.CompilerPaths; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.externalSystem.importing.ImportSpec; import com.intellij.openapi.externalSystem.importing.ImportSpecBuilder; @@ -240,7 +226,7 @@ public abstract class ExternalSystemImportingTestCase extends ExternalSystemTest } protected void assertModuleOutputs(String moduleName, String... outputs) { - String[] outputPaths = ContainerUtil.map2Array(CompilerPathsEx.getOutputPaths(new Module[]{getModule(moduleName)}), String.class, + String[] outputPaths = ContainerUtil.map2Array(CompilerPaths.getOutputPaths(new Module[]{getModule(moduleName)}), String.class, s -> getAbsolutePath(s)); assertUnorderedElementsAreEqual(outputPaths, outputs); } diff --git a/plugins/gradle/java/src/execution/build/GradleProjectTaskRunner.java b/plugins/gradle/java/src/execution/build/GradleProjectTaskRunner.java index a6d8322177c5..784173b0cd2d 100644 --- a/plugins/gradle/java/src/execution/build/GradleProjectTaskRunner.java +++ b/plugins/gradle/java/src/execution/build/GradleProjectTaskRunner.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.gradle.execution.build; import com.intellij.build.BuildViewManager; @@ -23,7 +9,7 @@ import com.intellij.execution.configurations.RunConfigurationModule; import com.intellij.execution.configurations.RunProfile; import com.intellij.execution.executors.DefaultRunExecutor; import com.intellij.execution.runners.ExecutionEnvironment; -import com.intellij.openapi.compiler.ex.CompilerPathsEx; +import com.intellij.openapi.compiler.CompilerPaths; import com.intellij.openapi.externalSystem.model.DataNode; import com.intellij.openapi.externalSystem.model.ProjectKeys; import com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings; @@ -124,7 +110,7 @@ public class GradleProjectTaskRunner extends ProjectTaskRunner { final List affectedModules = ContainerUtil.concat(modulesToBuild, modulesOfResourcesToBuild, modulesOfFiles); // have to refresh in case of errors too, because run configuration may be set to ignore errors Collection affectedRoots = ContainerUtil.newHashSet( - CompilerPathsEx.getOutputPaths(affectedModules.toArray(Module.EMPTY_ARRAY))); + CompilerPaths.getOutputPaths(affectedModules.toArray(Module.EMPTY_ARRAY))); if (!affectedRoots.isEmpty()) { CompilerUtil.refreshOutputRoots(affectedRoots); }