本文整理匯總了Java中com.intellij.openapi.util.io.FileUtil.FILE_HASHING_STRATEGY屬性的典型用法代碼示例。如果您正苦於以下問題:Java FileUtil.FILE_HASHING_STRATEGY屬性的具體用法?Java FileUtil.FILE_HASHING_STRATEGY怎麽用?Java FileUtil.FILE_HASHING_STRATEGY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.intellij.openapi.util.io.FileUtil
的用法示例。
在下文中一共展示了FileUtil.FILE_HASHING_STRATEGY屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initTargetFSState
private static void initTargetFSState(CompileContext context, BuildTarget<?> target, final boolean forceMarkDirty) throws IOException {
final ProjectDescriptor pd = context.getProjectDescriptor();
final Timestamps timestamps = pd.timestamps.getStorage();
final THashSet<File> currentFiles = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
FSOperations.markDirtyFiles(context, target, CompilationRound.CURRENT, timestamps, forceMarkDirty, currentFiles, null);
// handle deleted paths
final BuildFSState fsState = pd.fsState;
fsState.clearDeletedPaths(target);
final SourceToOutputMapping sourceToOutputMap = pd.dataManager.getSourceToOutputMap(target);
for (final Iterator<String> it = sourceToOutputMap.getSourcesIterator(); it.hasNext(); ) {
final String path = it.next();
// can check if the file exists
final File file = new File(path);
if (!currentFiles.contains(file)) {
fsState.registerDeleted(target, file, timestamps);
}
}
pd.fsState.markInitialScanPerformed(target);
}
示例2: getOutputRoots
@NotNull
@Override
public Collection<File> getOutputRoots(CompileContext context) {
MavenModuleResourceConfiguration configuration =
getModuleResourcesConfiguration(context.getProjectDescriptor().dataManager.getDataPaths());
if (configuration == null) return Collections.emptyList();
final Set<File> result = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
final File moduleOutput = getModuleOutputDir();
for (ResourceRootConfiguration resConfig : getRootConfigurations(configuration)) {
final File output = getOutputDir(moduleOutput, resConfig, configuration.outputDirectory);
if (output != null) {
result.add(output);
}
}
return result;
}
示例3: computeRootDescriptors
@NotNull
@Override
public List<JavaSourceRootDescriptor> computeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
List<JavaSourceRootDescriptor> roots = new ArrayList<JavaSourceRootDescriptor>();
JavaSourceRootType type = isTests() ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE;
Iterable<ExcludedJavaSourceRootProvider> excludedRootProviders = JpsServiceManager.getInstance().getExtensions(ExcludedJavaSourceRootProvider.class);
final Set<File> moduleExcludes = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
moduleExcludes.addAll(index.getModuleExcludes(myModule));
roots_loop:
for (JpsTypedModuleSourceRoot<JavaSourceRootProperties> sourceRoot : myModule.getSourceRoots(type)) {
if (JpsPathUtil.isUnder(moduleExcludes, sourceRoot.getFile())) {
continue;
}
for (ExcludedJavaSourceRootProvider provider : excludedRootProviders) {
if (provider.isExcludedFromCompilation(myModule, sourceRoot)) {
continue roots_loop;
}
}
final String packagePrefix = sourceRoot.getProperties().getPackagePrefix();
roots.add(new JavaSourceRootDescriptor(sourceRoot.getFile(), this, false, false, packagePrefix,
computeRootExcludes(sourceRoot.getFile(), index)));
}
return roots;
}
示例4: clearOutputFiles
public static void clearOutputFiles(CompileContext context, BuildTarget<?> target) throws IOException {
final SourceToOutputMapping map = context.getProjectDescriptor().dataManager.getSourceToOutputMap(target);
final THashSet<File> dirsToDelete = target instanceof ModuleBasedTarget? new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY) : null;
for (String srcPath : map.getSources()) {
final Collection<String> outs = map.getOutputs(srcPath);
if (outs != null && !outs.isEmpty()) {
List<String> deletedPaths = new ArrayList<String>();
for (String out : outs) {
BuildOperations.deleteRecursively(out, deletedPaths, dirsToDelete);
}
if (!deletedPaths.isEmpty()) {
context.processMessage(new FileDeletedEvent(deletedPaths));
}
}
}
registerTargetsWithClearedOutput(context, Collections.singletonList(target));
if (dirsToDelete != null) {
FSOperations.pruneEmptyDirs(context, dirsToDelete);
}
}
示例5: Mappings
private Mappings(final Mappings base) throws IOException {
myLock = base.myLock;
myIsDelta = true;
myChangedClasses = new TIntHashSet(DEFAULT_SET_CAPACITY, DEFAULT_SET_LOAD_FACTOR);
myChangedFiles = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
myDeletedClasses = new HashSet<Pair<ClassRepr, File>>(DEFAULT_SET_CAPACITY, DEFAULT_SET_LOAD_FACTOR);
myAddedClasses = new HashSet<ClassRepr>(DEFAULT_SET_CAPACITY, DEFAULT_SET_LOAD_FACTOR);
myDeltaIsTransient = base.myDeltaIsTransient;
myRootDir = new File(FileUtil.toSystemIndependentName(base.myRootDir.getAbsolutePath()) + File.separatorChar + "myDelta");
myContext = base.myContext;
myInitName = myContext.get("<init>");
myEmptyName = myContext.get("");
myObjectClassName = myContext.get("java/lang/Object");
myDebugS = base.myDebugS;
createImplementation();
}
示例6: loadModules
private void loadModules(Element root, final @Nullable JpsSdkType<?> projectSdkType) {
Runnable timingLog = TimingLog.startActivity("loading modules");
Element componentRoot = JDomSerializationUtil.findComponent(root, "ProjectModuleManager");
if (componentRoot == null) return;
final Set<File> foundFiles = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
final List<File> moduleFiles = new ArrayList<File>();
for (Element moduleElement : JDOMUtil.getChildren(componentRoot.getChild("modules"), "module")) {
final String path = moduleElement.getAttributeValue("filepath");
final File file = new File(path);
if (foundFiles.add(file) && file.exists()) {
moduleFiles.add(file);
}
else {
LOG.info("Module '" + FileUtil.getNameWithoutExtension(file) + "' is skipped: " + file.getAbsolutePath() + " doesn't exist");
}
}
List<JpsModule> modules = loadModules(moduleFiles, projectSdkType, myPathVariables);
for (JpsModule module : modules) {
myProject.addModule(module);
}
timingLog.run();
}
示例7: _addToRecompiled
private boolean _addToRecompiled(BuildRootDescriptor root, Collection<File> filesToAdd) {
Set<File> files = myFilesToRecompile.get(root);
if (files == null) {
files = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
myFilesToRecompile.put(root, files);
}
return files.addAll(filesToAdd);
}
示例8: pruneEmptyDirs
public static void pruneEmptyDirs(CompileContext context, @Nullable final Set<File> dirsToDelete) {
if (dirsToDelete == null || dirsToDelete.isEmpty()) return;
Set<File> doNotDelete = ALL_OUTPUTS_KEY.get(context);
if (doNotDelete == null) {
doNotDelete = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
for (BuildTarget<?> target : context.getProjectDescriptor().getBuildTargetIndex().getAllTargets()) {
doNotDelete.addAll(target.getOutputRoots(context));
}
ALL_OUTPUTS_KEY.set(context, doNotDelete);
}
Set<File> additionalDirs = null;
Set<File> toDelete = dirsToDelete;
while (toDelete != null) {
for (File file : toDelete) {
// important: do not force deletion if the directory is not empty!
final boolean deleted = !doNotDelete.contains(file) && file.delete();
if (deleted) {
final File parentFile = file.getParentFile();
if (parentFile != null) {
if (additionalDirs == null) {
additionalDirs = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
}
additionalDirs.add(parentFile);
}
}
}
toDelete = additionalDirs;
additionalDirs = null;
}
}
示例9: computeRootExcludes
@NotNull
protected Set<File> computeRootExcludes(File root, ModuleExcludeIndex index) {
final Collection<File> moduleExcludes = index.getModuleExcludes(getModule());
if (moduleExcludes.isEmpty()) {
return Collections.emptySet();
}
final Set<File> excludes = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
for (File excluded : moduleExcludes) {
if (FileUtil.isAncestor(root, excluded, true)) {
excludes.add(excluded);
}
}
return excludes;
}
示例10: outputRootWasDeleted
public boolean outputRootWasDeleted(CompileContext context) throws IOException {
List<String> nonexistentOutputRoots = new SmartList<String>();
final Collection<File> targetRoots = myTarget.getOutputRoots(context);
synchronized (ALL_DELETED_ROOTS_KEY) {
Set<File> allDeletedRoots = ALL_DELETED_ROOTS_KEY.get(context);
for (File outputRoot : targetRoots) {
boolean wasDeleted = allDeletedRoots != null && allDeletedRoots.contains(outputRoot);
if (!wasDeleted) {
wasDeleted = !outputRoot.exists();
if (wasDeleted) {
if (allDeletedRoots == null) { // lazy init
allDeletedRoots = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
ALL_DELETED_ROOTS_KEY.set(context, allDeletedRoots);
}
allDeletedRoots.add(outputRoot);
}
}
if (wasDeleted) {
nonexistentOutputRoots.add(outputRoot.getAbsolutePath());
}
}
}
if (nonexistentOutputRoots.isEmpty()) {
return false;
}
Set<String> storedNonExistentOutputs;
File file = getNonexistentOutputsFile();
if (!file.exists()) {
storedNonExistentOutputs = Collections.emptySet();
}
else {
List<String> lines = StringUtil.split(FileUtil.loadFile(file), "\n");
storedNonExistentOutputs = new THashSet<String>(lines, FileUtil.PATH_HASHING_STRATEGY);
}
return !storedNonExistentOutputs.containsAll(nonexistentOutputRoots);
}
示例11: createImplementation
private void createImplementation() throws IOException {
if (!myIsDelta) {
myContext = new DependencyContext(myRootDir);
myDebugS = myContext.getLogger(LOG);
}
myRemovedSuperClasses = myIsDelta ? new IntIntTransientMultiMaplet() : null;
myAddedSuperClasses = myIsDelta ? new IntIntTransientMultiMaplet() : null;
final CollectionFactory<File> fileCollectionFactory = new CollectionFactory<File>() {
public Collection<File> create() {
return new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY); // todo: do we really need set and not a list here?
}
};
if (myIsDelta && myDeltaIsTransient) {
myClassToSubclasses = new IntIntTransientMultiMaplet();
myClassToClassDependency = new IntIntTransientMultiMaplet();
myShortClassNameIndex = null;
mySourceFileToClasses = new ObjectObjectTransientMultiMaplet<File, ClassRepr>(FileUtil.FILE_HASHING_STRATEGY, ourClassSetConstructor);
myClassToSourceFile = new IntObjectTransientMultiMaplet<File>(fileCollectionFactory);
}
else {
if (myIsDelta) {
myRootDir.mkdirs();
}
myClassToSubclasses = new IntIntPersistentMultiMaplet(DependencyContext.getTableFile(myRootDir, CLASS_TO_SUBCLASSES), INT_KEY_DESCRIPTOR);
myClassToClassDependency = new IntIntPersistentMultiMaplet(DependencyContext.getTableFile(myRootDir, CLASS_TO_CLASS), INT_KEY_DESCRIPTOR);
myShortClassNameIndex = myIsDelta? null : new IntIntPersistentMultiMaplet(DependencyContext.getTableFile(myRootDir, SHORT_NAMES), INT_KEY_DESCRIPTOR);
mySourceFileToClasses = new ObjectObjectPersistentMultiMaplet<File, ClassRepr>(
DependencyContext.getTableFile(myRootDir, SOURCE_TO_CLASS), new FileKeyDescriptor(), ClassRepr.externalizer(myContext),
ourClassSetConstructor
);
myClassToSourceFile = new IntObjectPersistentMultiMaplet<File>(DependencyContext.getTableFile(myRootDir, CLASS_TO_SOURCE), INT_KEY_DESCRIPTOR, new FileKeyDescriptor(), fileCollectionFactory);
}
}
示例12: toFiles
private static Set<File> toFiles(List<String> classpath) {
Set<File> result = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
for (String path : classpath) {
result.add(new File(path));
}
return result;
}
示例13: TargetOutputIndexImpl
public TargetOutputIndexImpl(Collection<? extends BuildTarget<?>> allTargets, CompileContext context) {
myOutputToTargets = new THashMap<File, List<BuildTarget<?>>>(FileUtil.FILE_HASHING_STRATEGY);
for (BuildTarget<?> target : allTargets) {
Collection<File> roots = target.getOutputRoots(context);
for (File root : roots) {
List<BuildTarget<?>> targets = myOutputToTargets.get(root);
if (targets == null) {
targets = new SmartList<BuildTarget<?>>();
myOutputToTargets.put(root, targets);
}
targets.add(target);
}
}
}
示例14: BuildRootIndexImpl
public BuildRootIndexImpl(BuildTargetRegistry targetRegistry, JpsModel model, ModuleExcludeIndex index,
BuildDataPaths dataPaths, final IgnoredFileIndex ignoredFileIndex) {
myIgnoredFileIndex = ignoredFileIndex;
myRootsByTarget = new HashMap<BuildTarget<?>, List<? extends BuildRootDescriptor>>();
myRootToDescriptors = new THashMap<File, List<BuildRootDescriptor>>(FileUtil.FILE_HASHING_STRATEGY);
myFileFilters = new ConcurrentHashMap<BuildRootDescriptor, FileFilter>(16, 0.75f, 1);
final Iterable<AdditionalRootsProviderService> rootsProviders = JpsServiceManager.getInstance().getExtensions(AdditionalRootsProviderService.class);
for (BuildTargetType<?> targetType : TargetTypeRegistry.getInstance().getTargetTypes()) {
for (BuildTarget<?> target : targetRegistry.getAllTargets(targetType)) {
addRoots(dataPaths, rootsProviders, target, model, index, ignoredFileIndex);
}
}
}
示例15: getOutputRoots
@NotNull
@Override
public Collection<File> getOutputRoots(CompileContext context) {
GradleModuleResourceConfiguration configuration =
getModuleResourcesConfiguration(context.getProjectDescriptor().dataManager.getDataPaths());
final Set<File> result = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
final File moduleOutput = getModuleOutputDir();
for (ResourceRootConfiguration resConfig : getRootConfigurations(configuration)) {
final File output = getOutputDir(moduleOutput, resConfig, configuration.outputDirectory);
if (output != null) {
result.add(output);
}
}
return result;
}