mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use file hashing strategy for set of files
This commit is contained in:
@@ -3,10 +3,12 @@ package org.jetbrains.jps.incremental;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.jps.builders.java.dependencyView.Callbacks;
|
||||
import org.jetbrains.jps.builders.java.dependencyView.Mappings;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.jps.ModuleChunk;
|
||||
import org.jetbrains.jps.ProjectPaths;
|
||||
import org.jetbrains.jps.builders.java.dependencyView.Callbacks;
|
||||
import org.jetbrains.jps.builders.java.dependencyView.Mappings;
|
||||
import org.jetbrains.jps.incremental.fs.RootDescriptor;
|
||||
import org.jetbrains.jps.incremental.messages.ProgressMessage;
|
||||
import org.jetbrains.jps.incremental.storage.SourceToOutputMapping;
|
||||
@@ -87,7 +89,8 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
// unmark as affected all successfully compiled
|
||||
allAffectedFiles.removeAll(successfullyCompiled);
|
||||
|
||||
final HashSet<File> affectedBeforeDif = new HashSet<File>(allAffectedFiles);
|
||||
final Set<File> affectedBeforeDif = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
affectedBeforeDif.addAll(allAffectedFiles);
|
||||
|
||||
final ModulesBasedFileFilter moduleBasedFilter = new ModulesBasedFileFilter(context, chunk);
|
||||
final boolean incremental = globalMappings.differentiateOnIncrementalMake(
|
||||
@@ -110,8 +113,7 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
if (incremental) {
|
||||
final Set<File> newlyAffectedFiles = new HashSet<File>(allAffectedFiles);
|
||||
newlyAffectedFiles.removeAll(affectedBeforeDif);
|
||||
newlyAffectedFiles
|
||||
.removeAll(allCompiledFiles); // the diff operation may have affected the class already compiled in thic compilation round
|
||||
newlyAffectedFiles.removeAll(allCompiledFiles); // the diff operation may have affected the class already compiled in thic compilation round
|
||||
|
||||
final String infoMessage = "Dependency analysis found " + newlyAffectedFiles.size() + " affected files";
|
||||
LOG.info(infoMessage);
|
||||
@@ -211,7 +213,7 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
private static Set<File> getAllAffectedFilesContainer(CompileContext context) {
|
||||
Set<File> allAffectedFiles = ALL_AFFECTED_FILES_KEY.get(context);
|
||||
if (allAffectedFiles == null) {
|
||||
allAffectedFiles = new HashSet<File>();
|
||||
allAffectedFiles = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
ALL_AFFECTED_FILES_KEY.set(context, allAffectedFiles);
|
||||
}
|
||||
return allAffectedFiles;
|
||||
@@ -220,7 +222,7 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
private static Set<File> getAllCompiledFilesContainer(CompileContext context) {
|
||||
Set<File> allCompiledFiles = ALL_COMPILED_FILES_KEY.get(context);
|
||||
if (allCompiledFiles == null) {
|
||||
allCompiledFiles = new HashSet<File>();
|
||||
allCompiledFiles = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
ALL_COMPILED_FILES_KEY.set(context, allCompiledFiles);
|
||||
}
|
||||
return allCompiledFiles;
|
||||
@@ -231,7 +233,7 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
if (map == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
final Set<String> removed = new HashSet<String>();
|
||||
final Set<String> removed = new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY);
|
||||
for (ModuleBuildTarget target : chunk.getTargets()) {
|
||||
final Collection<String> modulePaths = map.get(target);
|
||||
if (modulePaths != null) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.jetbrains.jps.incremental;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.JpsPathUtil;
|
||||
@@ -23,7 +24,7 @@ import java.util.*;
|
||||
* Date: 1/11/12
|
||||
*/
|
||||
public class ModuleRootsIndex {
|
||||
private final Map<File, RootDescriptor> myRootToDescriptorMap = new HashMap<File, RootDescriptor>();
|
||||
private final THashMap<File, RootDescriptor> myRootToDescriptorMap = new THashMap<File, RootDescriptor>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
private final Map<JpsModule, List<RootDescriptor>> myModuleToRootsMap = new HashMap<JpsModule, List<RootDescriptor>>();
|
||||
private final Map<String, JpsModule> myNameToModuleMap = new HashMap<String, JpsModule>();
|
||||
private final int myTotalModuleCount;
|
||||
@@ -167,7 +168,7 @@ public class ModuleRootsIndex {
|
||||
public RootDescriptor associateRoot(@NotNull CompileContext context, File root, JpsModule module, boolean isTestRoot) {
|
||||
Map<File, RootDescriptor> rootToDescriptorMap = ROOT_DESCRIPTOR_MAP.get(context);
|
||||
if (rootToDescriptorMap == null) {
|
||||
rootToDescriptorMap = new HashMap<File, RootDescriptor>();
|
||||
rootToDescriptorMap = new THashMap<File, RootDescriptor>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
ROOT_DESCRIPTOR_MAP.set(context, rootToDescriptorMap);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.uiDesigner.compiler.AlienFormFileException;
|
||||
@@ -19,6 +20,7 @@ import com.intellij.uiDesigner.lw.CompiledClassPropertiesProvider;
|
||||
import com.intellij.uiDesigner.lw.LwRootContainer;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.concurrency.SequentialTaskExecutor;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.asm4.ClassReader;
|
||||
@@ -82,16 +84,32 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
"-g", "-deprecation", "-nowarn", "-verbose"
|
||||
));
|
||||
|
||||
private static final FileFilter JAVA_SOURCES_FILTER = new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return file.getPath().endsWith(JAVA_EXTENSION);
|
||||
private static final FileFilter JAVA_SOURCES_FILTER =
|
||||
SystemInfo.isFileSystemCaseSensitive?
|
||||
new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return file.getPath().endsWith(JAVA_EXTENSION);
|
||||
}
|
||||
} :
|
||||
new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return StringUtil.endsWithIgnoreCase(file.getPath(), JAVA_EXTENSION);
|
||||
}
|
||||
};
|
||||
|
||||
private static final FileFilter FORM_SOURCES_FILTER =
|
||||
SystemInfo.isFileSystemCaseSensitive?
|
||||
new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return file.getPath().endsWith(FORM_EXTENSION);
|
||||
}
|
||||
} :
|
||||
new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return StringUtil.endsWithIgnoreCase(file.getPath(), FORM_EXTENSION);
|
||||
}
|
||||
}
|
||||
};
|
||||
private static final FileFilter FORM_SOURCES_FILTER = new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
return file.getPath().endsWith(FORM_EXTENSION);
|
||||
}
|
||||
};
|
||||
;
|
||||
|
||||
private static final Key<Callbacks.Backend> DELTA_MAPPINGS_CALLBACK_KEY = Key.create("_dependency_data_");
|
||||
private final Executor myTaskRunner;
|
||||
@@ -153,8 +171,8 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
|
||||
public ExitCode build(final CompileContext context, final ModuleChunk chunk) throws ProjectBuildException {
|
||||
try {
|
||||
final Set<File> filesToCompile = new HashSet<File>();
|
||||
final Set<File> formsToCompile = new HashSet<File>();
|
||||
final Set<File> filesToCompile = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
final Set<File> formsToCompile = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
|
||||
FSOperations.processFilesToRecompile(context, chunk, new FileProcessor() {
|
||||
public boolean apply(ModuleBuildTarget target, File file, String sourceRoot) throws IOException {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.jetbrains.jps.incremental.java;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.incremental.CompileContext;
|
||||
@@ -19,8 +21,8 @@ import java.util.*;
|
||||
*/
|
||||
class OutputFilesSink implements OutputFileConsumer {
|
||||
private final CompileContext myContextI;
|
||||
private final Set<File> mySuccessfullyCompiled = new LinkedHashSet<File>();
|
||||
private final Set<File> myProblematic = new HashSet<File>();
|
||||
private final Set<File> mySuccessfullyCompiled = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
private final Set<File> myProblematic = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
|
||||
private final List<OutputFileObject> myFileObjects = new ArrayList<OutputFileObject>();
|
||||
private final Map<String, OutputFileObject> myCompiledClasses = new HashMap<String, OutputFileObject>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user