mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-77613: all of under the WebContent dir and files to be droped while i rebuild the project
This commit is contained in:
@@ -77,6 +77,7 @@ 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.Navigatable;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
@@ -2474,6 +2475,7 @@ public class CompileDriver {
|
||||
}
|
||||
}
|
||||
}
|
||||
affectedOutputPaths.addAll(ArtifactCompilerUtil.getArtifactOutputsContainingSourceFiles(myProject));
|
||||
|
||||
if (!affectedOutputPaths.isEmpty()) {
|
||||
final StringBuilder paths = new StringBuilder();
|
||||
|
||||
@@ -18,14 +18,32 @@ package com.intellij.packaging.impl.compiler;
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.CompilerMessageCategory;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.artifacts.ArtifactManager;
|
||||
import com.intellij.packaging.elements.ComplexPackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElementResolvingContext;
|
||||
import com.intellij.packaging.impl.artifacts.ArtifactUtil;
|
||||
import com.intellij.packaging.impl.artifacts.PackagingElementPath;
|
||||
import com.intellij.packaging.impl.artifacts.PackagingElementProcessor;
|
||||
import com.intellij.packaging.impl.elements.ArtifactPackagingElement;
|
||||
import com.intellij.packaging.impl.elements.FileOrDirectoryCopyPackagingElement;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
@@ -65,4 +83,40 @@ public class ArtifactCompilerUtil {
|
||||
String fullPath = jarEntry.getPath();
|
||||
return new File(FileUtil.toSystemDependentName(fullPath.substring(fullPath.indexOf(JarFileSystem.JAR_SEPARATOR))));
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public static Set<VirtualFile> getArtifactOutputsContainingSourceFiles(final @NotNull Project project) {
|
||||
final List<VirtualFile> allOutputs = new ArrayList<VirtualFile>();
|
||||
for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
|
||||
ContainerUtil.addIfNotNull(artifact.getOutputFile(), allOutputs);
|
||||
}
|
||||
|
||||
final Set<VirtualFile> affectedOutputPaths = new HashSet<VirtualFile>();
|
||||
final PackagingElementResolvingContext context = ArtifactManager.getInstance(project).getResolvingContext();
|
||||
for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
|
||||
ArtifactUtil.processPackagingElements(artifact, null, new PackagingElementProcessor<PackagingElement<?>>() {
|
||||
@Override
|
||||
public boolean shouldProcessSubstitution(ComplexPackagingElement<?> element) {
|
||||
return !(element instanceof ArtifactPackagingElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean process(@NotNull PackagingElement<?> element, @NotNull PackagingElementPath path) {
|
||||
if (element instanceof FileOrDirectoryCopyPackagingElement<?>) {
|
||||
final VirtualFile file = ((FileOrDirectoryCopyPackagingElement)element).findFile();
|
||||
if (file != null) {
|
||||
for (VirtualFile output : allOutputs) {
|
||||
if (VfsUtilCore.isAncestor(output, file, false)) {
|
||||
affectedOutputPaths.add(output);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, context, true);
|
||||
}
|
||||
return affectedOutputPaths;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user