Unnamed: 0
int64 0
305k
| body
stringlengths 7
52.9k
| name
stringlengths 1
185
|
---|---|---|
2,300 |
boolean (final File file, final Collection<? super String> deletedPaths) { try { Files.walkFileTree(file.toPath(), EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path f, BasicFileAttributes attrs) throws IOException { try { Files.delete(f); } catch (AccessDeniedException e) { if (!f.toFile().delete()) { // fallback throw e; } } deletedPaths.add(FileUtilRt.toSystemIndependentName(f.toString())); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { try { Files.delete(dir); } catch (AccessDeniedException e) { if (!dir.toFile().delete()) { // fallback throw e; } } return FileVisitResult.CONTINUE; } }); return true; } catch (IOException e) { return false; } }
|
deleteRecursively
|
2,301 |
void (String builderName) { myCurrentBuilderName = builderName; }
|
setCurrentBuilderName
|
2,302 |
Collection<CompiledClass> (@NotNull BuildTarget<?> target) { final Collection<CompiledClass> classes = myTargetToClassesMap.get(target); if (classes != null) { return Collections.unmodifiableCollection(classes); } return Collections.emptyList(); }
|
getTargetCompiledClasses
|
2,303 |
void () { for (BuildOutputConsumerImpl consumer : myTarget2Consumer.values()) { consumer.fireFileGeneratedEvent(); } }
|
fireFileGeneratedEvents
|
2,304 |
int () { int total = 0; for (BuildOutputConsumerImpl consumer : myTarget2Consumer.values()) { total += consumer.getNumberOfProcessedSources(); } return total; }
|
getNumberOfProcessedSources
|
2,305 |
void () { myTarget2Consumer.clear(); myClasses.clear(); myTargetToClassesMap.clear(); myOutputToBuilderNameMap.clear(); }
|
clear
|
2,306 |
void (@NotNull PreloadedData data) { final ProjectDescriptor pd = data.getProjectDescriptor(); if (pd != null) { myTask = IncProjectBuilder.startTempDirectoryCleanupTask(pd); } }
|
preloadData
|
2,307 |
void (@NotNull PreloadedData data) { }
|
buildSessionInitialized
|
2,308 |
void (PreloadedData data) { }
|
discardPreloadedData
|
2,309 |
BuilderCategory () { return myCategory; }
|
getCategory
|
2,310 |
void (CompileContext context, ModuleChunk chunk) { }
|
chunkBuildStarted
|
2,311 |
void (CompileContext context, ModuleChunk chunk) { }
|
chunkBuildFinished
|
2,312 |
long () { //temporary workaround until this method is overridden in Kotlin plugin if (getClass().getName().equals("org.jetbrains.kotlin.jps.build.KotlinBuilder")) { return 100; } return super.getExpectedBuildTime(); }
|
getExpectedBuildTime
|
2,313 |
Collection<File> (@NotNull CompileContext context) { Collection<File> result = new SmartList<>(); final File outputDir = getOutputDir(); if (outputDir != null) { result.add(outputDir); } final JpsModule module = getModule(); final JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(module.getProject()); final ProcessorConfigProfile profile = configuration.getAnnotationProcessingProfile(module); if (profile.isEnabled()) { final File annotationOut = ProjectPaths.getAnnotationProcessorGeneratedSourcesOutputDir(module, isTests(), profile); if (annotationOut != null) { result.add(annotationOut); } } return result; }
|
getOutputRoots
|
2,314 |
boolean () { return myTargetType.isTests(); }
|
isTests
|
2,315 |
List<JavaSourceRootDescriptor> (@NotNull JpsModel model, @NotNull ModuleExcludeIndex index, @NotNull IgnoredFileIndex ignoredFileIndex, @NotNull BuildDataPaths dataPaths) { List<JavaSourceRootDescriptor> roots = new ArrayList<>(); JavaSourceRootType type = isTests() ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE; Iterable<ExcludedJavaSourceRootProvider> excludedRootProviders = JpsServiceManager.getInstance().getExtensions(ExcludedJavaSourceRootProvider.class); final JpsJavaCompilerConfiguration compilerConfig = JpsJavaExtensionService.getInstance().getCompilerConfiguration(myModule.getProject()); roots_loop: for (JpsTypedModuleSourceRoot<JavaSourceRootProperties> sourceRoot : myModule.getSourceRoots(type)) { if (index.isExcludedFromModule(sourceRoot.getFile(), myModule)) { continue; } for (ExcludedJavaSourceRootProvider provider : excludedRootProviders) { if (provider.isExcludedFromCompilation(myModule, sourceRoot)) { continue roots_loop; } } final String packagePrefix = sourceRoot.getProperties().getPackagePrefix(); // consider annotation processors output for generated sources, if contained under some source root Set<File> excludes = computeRootExcludes(sourceRoot.getFile(), index); final ProcessorConfigProfile profile = compilerConfig.getAnnotationProcessingProfile(myModule); if (profile.isEnabled()) { final File outputDir = ProjectPaths.getAnnotationProcessorGeneratedSourcesOutputDir(myModule, JavaSourceRootType.TEST_SOURCE == sourceRoot.getRootType(), profile); if (outputDir != null && FileUtil.isAncestor(sourceRoot.getFile(), outputDir, true)) { excludes = FileCollectionFactory.createCanonicalFileSet(excludes); excludes.add(outputDir); } } FileFilter filterForExcludedPatterns = index.getModuleFileFilterHonorExclusionPatterns(myModule); roots.add(new JavaSourceRootDescriptor(sourceRoot.getFile(), this, false, false, packagePrefix, excludes, filterForExcludedPatterns)); } return roots; }
|
computeRootDescriptors
|
2,316 |
String () { return "Module '" + getModule().getName() + "' " + (myTargetType.isTests() ? "tests" : "production"); }
|
getPresentableName
|
2,317 |
void (@NotNull ProjectDescriptor pd, @NotNull PrintWriter out) { final JpsModule module = getModule(); final PathRelativizerService relativizer = pd.dataManager.getRelativizer(); final StringBuilder logBuilder = LOG.isDebugEnabled() ? new StringBuilder() : null; int fingerprint = getDependenciesFingerprint(logBuilder, relativizer); for (JavaSourceRootDescriptor root : pd.getBuildRootIndex().getTargetRoots(this, null)) { final File file = root.getRootFile(); String path = relativizer.toRelative(file.getPath()); if (logBuilder != null) { logBuilder.append(path).append("\n"); } fingerprint += pathHashCode(path); } final LanguageLevel level = JpsJavaExtensionService.getInstance().getLanguageLevel(module); if (level != null) { if (logBuilder != null) { logBuilder.append(level.name()).append("\n"); } fingerprint += level.name().hashCode(); } final JpsJavaCompilerConfiguration config = JpsJavaExtensionService.getInstance().getCompilerConfiguration(module.getProject()); final String bytecodeTarget = config.getByteCodeTargetLevel(module.getName()); if (bytecodeTarget != null) { if (logBuilder != null) { logBuilder.append(bytecodeTarget).append("\n"); } fingerprint += bytecodeTarget.hashCode(); } final CompilerEncodingConfiguration encodingConfig = pd.getEncodingConfiguration(); final String encoding = encodingConfig.getPreferredModuleEncoding(module); if (encoding != null) { if (logBuilder != null) { logBuilder.append(encoding).append("\n"); } fingerprint += encoding.hashCode(); } final String hash = Integer.toHexString(fingerprint); out.write(hash); if (logBuilder != null) { File configurationTextFile = new File(pd.getTargetsState().getDataPaths().getTargetDataRoot(this), "config.dat.debug.txt"); @NonNls String oldText; try { oldText = FileUtil.loadFile(configurationTextFile); } catch (IOException e) { oldText = null; } String newText = logBuilder.toString(); if (!newText.equals(oldText)) { if (oldText != null) { LOG.debug("Configuration differs from the last recorded one for " + getPresentableName() + ".\nRecorded configuration:\n" + oldText + "\nCurrent configuration (hash=" + hash + "):\n" + newText); } try { FileUtil.writeToFile(configurationTextFile, newText); } catch (IOException e) { LOG.debug(e); } } } }
|
writeConfiguration
|
2,318 |
int (@Nullable StringBuilder logBuilder, @NotNull PathRelativizerService relativizer) { int fingerprint = 0; if (!REBUILD_ON_DEPENDENCY_CHANGE) { return fingerprint; } final JpsModule module = getModule(); JpsJavaDependenciesEnumerator enumerator = JpsJavaExtensionService.dependencies(module).compileOnly().recursivelyExportedOnly(); if (!isTests()) { enumerator = enumerator.productionOnly(); } if (ProjectStamps.PORTABLE_CACHES) { enumerator = enumerator.withoutSdk(); } for (File file : enumerator.classes().getRoots()) { String path = relativizer.toRelative(file.getAbsolutePath()); if (logBuilder != null) { logBuilder.append(path).append("\n"); } fingerprint = 31 * fingerprint + pathHashCode(path); } return fingerprint; }
|
getDependenciesFingerprint
|
2,319 |
int (@NotNull String path) { // On case-insensitive OS hash calculated from path converted to lower case if (ProjectStamps.PORTABLE_CACHES) { return StringUtil.isEmpty(path) ? 0 : FileUtil.toCanonicalPath(path).hashCode(); } return FileUtil.pathHashCode(path); }
|
pathHashCode
|
2,320 |
BuilderRegistry () { return Holder.ourInstance; }
|
getInstance
|
2,321 |
FileFilter () { return myModuleBuilderFileFilter; }
|
getModuleBuilderFileFilter
|
2,322 |
int () { int count = 0; for (BuilderCategory category : BuilderCategory.values()) { count += getBuilders(category).size(); } return count; }
|
getModuleLevelBuilderCount
|
2,323 |
List<BuildTask> () { return Collections.emptyList(); // todo }
|
getBeforeTasks
|
2,324 |
List<BuildTask> () { return Collections.emptyList(); // todo }
|
getAfterTasks
|
2,325 |
List<ModuleLevelBuilder> (BuilderCategory category) { return Collections.unmodifiableList(myModuleLevelBuilders.get(category)); }
|
getBuilders
|
2,326 |
List<ModuleLevelBuilder> () { List<ModuleLevelBuilder> result = new ArrayList<>(); for (BuilderCategory category : BuilderCategory.values()) { result.addAll(getBuilders(category)); } return result; }
|
getModuleLevelBuilders
|
2,327 |
long (BuildTargetType<?> targetType) { //it may happen that there is no builders registered for a given type, so it won't be built at all. return myExpectedBuildTime.getLong(targetType); }
|
getExpectedBuildTimeForTarget
|
2,328 |
boolean (CompileContext context, final CompilationRound round, final File file) { final JavaSourceRootDescriptor rd = context.getProjectDescriptor().getBuildRootIndex().findJavaRootDescriptor(context, file); if (rd != null) { final ProjectDescriptor pd = context.getProjectDescriptor(); return pd.fsState.isMarkedForRecompilation(context, round, rd, file); } return false; }
|
isMarkedDirty
|
2,329 |
boolean () { return !dirtyFiles.isEmpty(); }
|
hasDirtyFiles
|
2,330 |
boolean () { return false; }
|
hasRemovedFiles
|
2,331 |
Collection<String> (@NotNull T target) { return Collections.emptyList(); }
|
getRemovedFiles
|
2,332 |
Set<JpsModule> (final JpsModule module, final JpsJavaClasspathKind kind) { return JpsJavaExtensionService.dependencies(module).includedIn(kind).recursivelyExportedOnly().getModules(); }
|
getDependentModulesRecursively
|
2,333 |
FileVisitResult (Path dir, BasicFileAttributes attrs) { return dirFilter.accept(dir.toFile())? FileVisitResult.CONTINUE : FileVisitResult.SKIP_SUBTREE; }
|
preVisitDirectory
|
2,334 |
void (CompileContext context, final @Nullable Set<File> dirsToDelete) { if (dirsToDelete == null || dirsToDelete.isEmpty()) { return; } Set<File> doNotDelete = ALL_OUTPUTS_KEY.get(context); if (doNotDelete == null) { doNotDelete = FileCollectionFactory.createCanonicalFileSet(); 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 = FileCollectionFactory.createCanonicalFileSet(); } additionalDirs.add(parentFile); } } } toDelete = additionalDirs; additionalDirs = null; } }
|
pruneEmptyDirs
|
2,335 |
boolean (CompileContext context, ModuleChunk chunk) { synchronized (TARGETS_COMPLETELY_MARKED_DIRTY) { Set<BuildTarget<?>> marked = TARGETS_COMPLETELY_MARKED_DIRTY.get(context); return marked != null && marked.containsAll(chunk.getTargets()); } }
|
isMarkedDirty
|
2,336 |
long (File file) { return lastModified(file.toPath()); }
|
lastModified
|
2,337 |
long (Path path) { try { return Files.getLastModifiedTime(path).toMillis(); } catch (NoSuchFileException ignored) { } catch (IOException e) { LOG.warn(e); } return 0L; }
|
lastModified
|
2,338 |
boolean (CompileContext context, BuildTarget<?> target) { synchronized (TARGETS_COMPLETELY_MARKED_DIRTY) { Set<BuildTarget<?>> marked = TARGETS_COMPLETELY_MARKED_DIRTY.get(context); return marked != null && marked.contains(target); } }
|
isMarkedDirty
|
2,339 |
void (CompileContext context, BuildTarget<?> target) { synchronized (TARGETS_COMPLETELY_MARKED_DIRTY) { Set<BuildTarget<?>> marked = TARGETS_COMPLETELY_MARKED_DIRTY.get(context); if (marked == null) { marked = new HashSet<>(); TARGETS_COMPLETELY_MARKED_DIRTY.set(context, marked); } marked.add(target); } }
|
addCompletelyMarkedDirtyTarget
|
2,340 |
void (CompileContext context, Set<ModuleBuildTarget> targetsSetToFilter) { synchronized (TARGETS_COMPLETELY_MARKED_DIRTY) { Set<BuildTarget<?>> marked = TARGETS_COMPLETELY_MARKED_DIRTY.get(context); if (marked != null) { targetsSetToFilter.removeAll(marked); } } }
|
removeTargetsAlreadyMarkedDirty
|
2,341 |
Collection<File> (@NotNull CompileContext context) { return ContainerUtil.createMaybeSingletonList(getOutputDir()); }
|
getOutputRoots
|
2,342 |
boolean () { return myTargetType.isTests(); }
|
isTests
|
2,343 |
boolean () { return true; }
|
isCompiledBeforeModuleLevelBuilders
|
2,344 |
List<ResourceRootDescriptor> (@NotNull JpsModel model, @NotNull ModuleExcludeIndex index, @NotNull IgnoredFileIndex ignoredFileIndex, @NotNull BuildDataPaths dataPaths) { List<ResourceRootDescriptor> roots = new ArrayList<>(); JavaSourceRootType type = isTests() ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE; Iterable<ExcludedJavaSourceRootProvider> excludedRootProviders = JpsServiceManager.getInstance().getExtensions(ExcludedJavaSourceRootProvider.class); FileFilter filterForExcludedPatterns = index.getModuleFileFilterHonorExclusionPatterns(myModule); for (JpsTypedModuleSourceRoot<JavaSourceRootProperties> sourceRoot : myModule.getSourceRoots(type)) { if (!isExcludedFromCompilation(excludedRootProviders, sourceRoot)) { final String packagePrefix = sourceRoot.getProperties().getPackagePrefix(); final File rootFile = sourceRoot.getFile(); roots.add(new FilteredResourceRootDescriptor(rootFile, this, packagePrefix, computeRootExcludes(rootFile, index), filterForExcludedPatterns)); } } JavaResourceRootType resourceType = isTests() ? JavaResourceRootType.TEST_RESOURCE : JavaResourceRootType.RESOURCE; for (JpsTypedModuleSourceRoot<JavaResourceRootProperties> root : myModule.getSourceRoots(resourceType)) { if (!isExcludedFromCompilation(excludedRootProviders, root)) { File rootFile = root.getFile(); String relativeOutputPath = root.getProperties().getRelativeOutputPath(); roots.add(new ResourceRootDescriptor(rootFile, this, relativeOutputPath.replace('/', '.'), computeRootExcludes(rootFile, index), filterForExcludedPatterns)); } } return roots; }
|
computeRootDescriptors
|
2,345 |
boolean (Iterable<ExcludedJavaSourceRootProvider> excludedRootProviders, JpsModuleSourceRoot sourceRoot) { for (ExcludedJavaSourceRootProvider provider : excludedRootProviders) { if (provider.isExcludedFromCompilation(myModule, sourceRoot)) { return true; } } return false; }
|
isExcludedFromCompilation
|
2,346 |
String () { return "Resources for '" + getModule().getName() + "' " + (myTargetType.isTests() ? "tests" : "production"); }
|
getPresentableName
|
2,347 |
void (@NotNull ProjectDescriptor pd, @NotNull PrintWriter out) { int fingerprint = 0; final BuildRootIndex rootIndex = pd.getBuildRootIndex(); final PathRelativizerService relativizer = pd.dataManager.getRelativizer(); final List<ResourceRootDescriptor> roots = rootIndex.getTargetRoots(this, null); for (ResourceRootDescriptor root : roots) { String path = relativizer.toRelative(root.getRootFile().getAbsolutePath()); fingerprint += pathHashCode(path); fingerprint += root.getPackagePrefix().hashCode(); } out.write(Integer.toHexString(fingerprint)); }
|
writeConfiguration
|
2,348 |
int (@Nullable String path) { // On case insensitive OS hash calculated from path converted to lower case if (ProjectStamps.PORTABLE_CACHES) { return StringUtil.isEmpty(path) ? 0 : FileUtil.toCanonicalPath(path).hashCode(); } return FileUtil.pathHashCode(path); }
|
pathHashCode
|
2,349 |
CompileContext (@NotNull CompileScope scope, @NotNull ProjectDescriptor descriptor) { return new CompileContextImpl(scope, descriptor, DEAF, Collections.emptyMap(), CanceledStatus.NULL); }
|
createContextForTests
|
2,350 |
long (BuildTarget<?> target) { synchronized (myCompilationStartStamp) { return myCompilationStartStamp.getLong(target); } }
|
getCompilationStartStamp
|
2,351 |
void (@NotNull Collection<? extends BuildTarget<?>> targets, long stamp) { synchronized (myCompilationStartStamp) { for (BuildTarget<?> target : targets) { myCompilationStartStamp.put(target, stamp); } } }
|
setCompilationStartStamp
|
2,352 |
boolean () { return JavaBuilderUtil.isCompileJavaIncrementally(this); }
|
isMake
|
2,353 |
boolean () { return JavaBuilderUtil.isForcedRecompilationAllJavaModules(this); }
|
isProjectRebuild
|
2,354 |
BuildLoggingManager () { return myProjectDescriptor.getLoggingManager(); }
|
getLoggingManager
|
2,355 |
void (@NotNull BuildListener listener) { myListeners.addListener(listener); }
|
addBuildListener
|
2,356 |
void (@NotNull BuildListener listener) { myListeners.removeListener(listener); }
|
removeBuildListener
|
2,357 |
void (@NotNull ModuleBuildTarget target) { if (!target.isTests()) { myNonIncrementalModules.add(new ModuleBuildTarget(target.getModule(), JavaModuleBuildTargetType.TEST)); } myNonIncrementalModules.add(target); }
|
markNonIncremental
|
2,358 |
boolean (@NotNull ModuleChunk chunk) { if (myNonIncrementalModules.isEmpty()) { return true; } for (ModuleBuildTarget target : chunk.getTargets()) { if (myNonIncrementalModules.contains(target)) { return false; } } return true; }
|
shouldDifferentiate
|
2,359 |
CanceledStatus () { return myCancelStatus; }
|
getCancelStatus
|
2,360 |
void (@NotNull ModuleBuildTarget target) { myNonIncrementalModules.remove(target); }
|
clearNonIncrementalMark
|
2,361 |
CompileScope () { return myScope; }
|
getScope
|
2,362 |
void (BuildMessage msg) { if (msg.getKind() == BuildMessage.Kind.ERROR) { Utils.ERRORS_DETECTED_KEY.set(this, Boolean.TRUE); } if (msg instanceof ProgressMessage) { ((ProgressMessage)msg).setDone(myDone); } myDelegateMessageHandler.processMessage(msg); if (msg instanceof FileGeneratedEvent) { myListeners.getMulticaster().filesGenerated((FileGeneratedEvent)msg); } else if (msg instanceof FileDeletedEvent) { myListeners.getMulticaster().filesDeleted((FileDeletedEvent)msg); } }
|
processMessage
|
2,363 |
void (float done) { myDone = done; }
|
setDone
|
2,364 |
ProjectDescriptor () { return myProjectDescriptor; }
|
getProjectDescriptor
|
2,365 |
void (BuildMessage msg) { for (MessageHandler h : myMessageHandlers) { h.processMessage(msg); } }
|
processMessage
|
2,366 |
void (MessageHandler handler) { myMessageHandlers.add(handler); }
|
addMessageHandler
|
2,367 |
void (@NotNull CompileScope scope) { CompileContextImpl context = null; try { context = createContext(scope); final BuildFSState fsState = myProjectDescriptor.fsState; for (BuildTarget<?> target : myProjectDescriptor.getBuildTargetIndex().getAllTargets()) { context.checkCanceled(); if (scope.isAffected(target)) { BuildOperations.ensureFSStateInitialized(context, target, true); final FilesDelta delta = fsState.getEffectiveFilesDelta(context, target); delta.lockData(); try { for (Set<File> files : delta.getSourcesToRecompile().values()) { for (File file : files) { if (scope.isAffected(target, file)) { // this will serve as a marker that compiler has work to do myMessageDispatcher.processMessage(DoneSomethingNotification.INSTANCE); return; } } } } finally { delta.unlockData(); } } } } catch (Exception e) { LOG.info(e); // this will serve as a marker that compiler has work to do myMessageDispatcher.processMessage(DoneSomethingNotification.INSTANCE); } finally { if (context != null) { flushContext(context); } } }
|
checkUpToDate
|
2,368 |
boolean (BuildTarget<?> target) { // optimization, since we know here that all targets of types JavaModuleBuildTargetType are affected return allTargetsAffected.contains(target.getTargetType()) || scope.isAffected(target); }
|
test
|
2,369 |
long (@NotNull ProjectDescriptor projectDescriptor, @NotNull Predicate<BuildTarget<?>> isAffected) { final BuildTargetsState targetsState = projectDescriptor.getTargetsState(); // compute estimated times for dirty targets long estimatedBuildTime = 0L; final BuildTargetIndex targetIndex = projectDescriptor.getBuildTargetIndex(); int affectedTargets = 0; for (BuildTarget<?> target : targetIndex.getAllTargets()) { if (!targetIndex.isDummy(target)) { final long avgTimeToBuild = targetsState.getAverageBuildTime(target.getTargetType()); if (avgTimeToBuild > 0) { // 1. in general case this time should include dependency analysis and cache update times // 2. need to check isAffected() since some targets (like artifacts) may be unaffected even for rebuild if (targetsState.getTargetConfiguration(target).isTargetDirty(projectDescriptor) && isAffected.test(target)) { estimatedBuildTime += avgTimeToBuild; affectedTargets++; } } } } LOG.info("Affected build targets count: " + affectedTargets); return estimatedBuildTime; }
|
calculateEstimatedBuildTime
|
2,370 |
void (@NotNull CanceledStatus status, Future<?> task) { try { while (true) { try { task.get(500L, TimeUnit.MILLISECONDS); break; } catch (TimeoutException ignored) { if (status.isCanceled()) { break; } } } } catch (Throwable th) { LOG.info(th); } }
|
waitForTask
|
2,371 |
void (CompileContextImpl context) { final Set<JpsModule> modules = BuildTargetConfiguration.MODULES_WITH_TARGET_CONFIG_CHANGED_KEY.get(context); if (modules == null || modules.isEmpty()) { return; } int shown = modules.size() == 6 ? 6 : Math.min(5, modules.size()); String modulesText = modules.stream().limit(shown).map(m -> "'" + m.getName() + "'").collect(Collectors.joining(", ")); String text = JpsBuildBundle.message("build.messages.modules.were.fully.rebuilt", modulesText, modules.size(), modules.size() - shown, ModuleBuildTarget.REBUILD_ON_DEPENDENCY_CHANGE ? 1 : 0); context.processMessage(new CompilerMessage("", BuildMessage.Kind.INFO, text)); }
|
reportRebuiltModules
|
2,372 |
void (CompileContextImpl context) { final ProjectDescriptor pd = context.getProjectDescriptor(); final BuildFSState fsState = pd.fsState; for (BuildTarget<?> target : pd.getBuildTargetIndex().getAllTargets()) { if (fsState.hasUnprocessedChanges(context, target)) { context.processMessage(new UnprocessedFSChangesNotification()); break; } } }
|
reportUnprocessedChanges
|
2,373 |
void (CompileContext context) { if (context != null) { final ProjectDescriptor pd = context.getProjectDescriptor(); pd.getProjectStamps().getStampStorage().force(); pd.dataManager.flush(false); } final ExternalJavacManager server = ExternalJavacManager.KEY.get(context); if (server != null) { server.stop(); ExternalJavacManager.KEY.set(context, null); } }
|
flushContext
|
2,374 |
boolean () { return Boolean.parseBoolean(myBuilderParams.get(BuildParametersKeys.IS_AUTOMAKE)); }
|
isAutoBuild
|
2,375 |
boolean () { return isAutoBuild() ? BuildRunner.isParallelBuildAutomakeEnabled() : BuildRunner.isParallelBuildEnabled(); }
|
isParallelBuild
|
2,376 |
void (@NotNull FileGeneratedEvent event) { Collection<Pair<String, String>> paths = event.getPaths(); FileSystem fs = FileSystems.getDefault(); if (paths.size() == 1) { deleteFiles(paths.iterator().next().first, fs); return; } Set<String> outputs = new HashSet<>(); for (Pair<String, String> pair : paths) { String root = pair.getFirst(); if (outputs.add(root)) { deleteFiles(root, fs); } } }
|
filesGenerated
|
2,377 |
void (String rootPath, FileSystem fs) { Path root = fs.getPath(rootPath); try { Files.deleteIfExists(root.resolve(CLASSPATH_INDEX_FILE_NAME)); Files.deleteIfExists(root.resolve(UNMODIFIED_MARK_FILE_NAME)); } catch (IOException ignore) { } }
|
deleteFiles
|
2,378 |
void (CompileContext context) { myElapsedTimeNanosByBuilder.entrySet() .stream() .map(entry -> { AtomicInteger processedSourcesRef = myNumberOfSourcesProcessedByBuilder.get(entry.getKey()); int processedSources = processedSourcesRef != null ? processedSourcesRef.get() : 0; return new BuilderStatisticsMessage(entry.getKey().getPresentableName(), processedSources, entry.getValue().get()/1_000_000); }) .sorted(Comparator.comparing(BuilderStatisticsMessage::getBuilderName)) .forEach(context::processMessage); }
|
sendElapsedTimeMessages
|
2,379 |
CompileContextImpl (@NotNull CompileScope scope) { return new CompileContextImpl(scope, myProjectDescriptor, myMessageDispatcher, myBuilderParams, myCancelStatus); }
|
createContext
|
2,380 |
void (BuildTargetType<?> type, CompileContext context) { List<Pair<String, Integer>> targetIds = myProjectDescriptor.dataManager.getTargetsState().getStaleTargetIds(type); if (targetIds.isEmpty()) return; context.processMessage(new ProgressMessage(JpsBuildBundle.message("progress.message.cleaning.old.output.directories"))); for (Pair<String, Integer> ids : targetIds) { String stringId = ids.first; try { SourceToOutputMappingImpl mapping = null; try { mapping = myProjectDescriptor.dataManager.createSourceToOutputMapForStaleTarget(type, stringId); clearOutputFiles(context, mapping, type, ids.second); } finally { if (mapping != null) { mapping.close(); } } FileUtil.delete(myProjectDescriptor.dataManager.getDataPaths().getTargetDataRoot(type, stringId)); myProjectDescriptor.dataManager.getTargetsState().cleanStaleTarget(type, stringId); } catch (IOException e) { LOG.warn(e); myMessageDispatcher.processMessage(new CompilerMessage("", BuildMessage.Kind.WARNING, JpsBuildBundle.message("build.message.failed.to.delete.output.files.from.obsolete.0.target.1", stringId, e.toString()))); } } }
|
cleanOutputOfStaleTargets
|
2,381 |
void (CompileContext context, Collection<? extends BuildTarget<?>> targets) { synchronized (TARGET_WITH_CLEARED_OUTPUT) { Set<BuildTarget<?>> data = context.getUserData(TARGET_WITH_CLEARED_OUTPUT); if (data == null) { data = new HashSet<>(); context.putUserData(TARGET_WITH_CLEARED_OUTPUT, data); } data.addAll(targets); } }
|
registerTargetsWithClearedOutput
|
2,382 |
boolean (CompileContext context, BuildTarget<?> target) { synchronized (TARGET_WITH_CLEARED_OUTPUT) { Set<BuildTarget<?>> data = context.getUserData(TARGET_WITH_CLEARED_OUTPUT); return data != null && data.contains(target); } }
|
isTargetOutputCleared
|
2,383 |
boolean (File outputRoot) { final String[] files = outputRoot.list(); return files == null || files.length == 0; }
|
isEmpty
|
2,384 |
void (CompileContext context, BuildTarget<?> target) { try { clearOutputFiles(context, target); } catch (Throwable e) { LOG.info(e); String reason = e.getMessage(); if (reason == null) { reason = e.getClass().getName(); } context.processMessage(new CompilerMessage("", BuildMessage.Kind.WARNING, JpsBuildBundle .message("build.message.problems.clearing.output.files.for.target.0.1", target.getPresentableName(), reason))); } }
|
clearOutputFilesUninterruptibly
|
2,385 |
int () { return myDepsScore + mySelfScore; }
|
getScore
|
2,386 |
BuildTargetChunk () { return myChunk; }
|
getChunk
|
2,387 |
boolean () { return myNotBuildDependenciesCount.get() == 0; }
|
isReady
|
2,388 |
void (BuildChunkTask dependency) { if (myNotBuiltDependencies.add(dependency)) { myNotBuildDependenciesCount.incrementAndGet(); dependency.myTasksDependsOnThis.add(this); } }
|
addDependency
|
2,389 |
List<BuildChunkTask> () { List<BuildChunkTask> nextTasks = new SmartList<>(); for (BuildChunkTask task : myTasksDependsOnThis) { int dependenciesCount = task.myNotBuildDependenciesCount.decrementAndGet(); if (dependenciesCount == 0) { nextTasks.add(task); } } return nextTasks; }
|
markAsFinishedAndGetNextReadyTasks
|
2,390 |
void (List<BuildChunkTask> tasks) { if (tasks.isEmpty()) return; ArrayList<BuildChunkTask> sorted = new ArrayList<>(tasks); sorted.sort(Comparator.comparingLong(BuildChunkTask::getScore).reversed()); if (LOG.isDebugEnabled()) { final List<BuildTargetChunk> chunksToLog = new ArrayList<>(); for (BuildChunkTask task : sorted) { chunksToLog.add(task.getChunk()); } final StringBuilder logBuilder = new StringBuilder("Queuing " + chunksToLog.size() + " chunks in parallel: "); chunksToLog.sort(Comparator.comparing(BuildTargetChunk::toString)); for (BuildTargetChunk chunk : chunksToLog) { logBuilder.append(chunk.toString()).append("; "); } LOG.debug(logBuilder.toString()); } for (BuildChunkTask task : sorted) { queueTask(task); } }
|
queueTasks
|
2,391 |
void (final BuildChunkTask task) { final CompileContext chunkLocalContext = createContextWrapper(myContext); myParallelBuildExecutor.execute(new RunnableWithPriority(task.getScore()) { @Override public void run() { try { try { if (myException.get() == null) { buildChunkIfAffected(chunkLocalContext, myContext.getScope(), task.getChunk(), myBuildProgress); } } finally { Tracer.Span flush = Tracer.start("flushing"); myProjectDescriptor.dataManager.closeSourceToOutputStorages(Collections.singletonList(task.getChunk())); myFlushCommand.run(); flush.complete(); } } catch (Throwable e) { myException.compareAndSet(null, e); LOG.info(e); } finally { LOG.debug("Finished compilation of " + task.getChunk().toString()); myTasksCountDown.countDown(); List<BuildChunkTask> nextTasks; nextTasks = task.markAsFinishedAndGetNextReadyTasks(); if (!nextTasks.isEmpty()) { queueTasks(nextTasks); } } } }); }
|
queueTask
|
2,392 |
void () { try { try { if (myException.get() == null) { buildChunkIfAffected(chunkLocalContext, myContext.getScope(), task.getChunk(), myBuildProgress); } } finally { Tracer.Span flush = Tracer.start("flushing"); myProjectDescriptor.dataManager.closeSourceToOutputStorages(Collections.singletonList(task.getChunk())); myFlushCommand.run(); flush.complete(); } } catch (Throwable e) { myException.compareAndSet(null, e); LOG.info(e); } finally { LOG.debug("Finished compilation of " + task.getChunk().toString()); myTasksCountDown.countDown(); List<BuildChunkTask> nextTasks; nextTasks = task.markAsFinishedAndGetNextReadyTasks(); if (!nextTasks.isEmpty()) { queueTasks(nextTasks); } } }
|
run
|
2,393 |
boolean (CompileScope scope, BuildTargetChunk chunk) { for (BuildTarget<?> target : chunk.getTargets()) { if (scope.isAffected(target)) { return true; } } return false; }
|
isAffected
|
2,394 |
CompileContext (CompileContext context, Collection<ModuleBuildTarget> moduleTargets) { final Class<MessageHandler> messageHandlerInterface = MessageHandler.class; return ReflectionUtil.proxy(context.getClass().getClassLoader(), CompileContext.class, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (args != null && args.length > 0 && messageHandlerInterface.equals(method.getDeclaringClass())) { for (Object arg : args) { if (arg instanceof CompilerMessage) { final CompilerMessage compilerMessage = (CompilerMessage)arg; for (ModuleBuildTarget target : moduleTargets) { compilerMessage.addModuleName(target.getModule().getName()); } break; } } } final MethodHandle mh = MethodHandles.lookup().unreflect(method); return args == null? mh.invoke(context) : mh.bindTo(context).asSpreader(Object[].class, args.length).invoke(args); } }); }
|
wrapWithModuleInfoAppender
|
2,395 |
void (@NotNull Set<? extends BuildTarget<?>> targets, @NotNull BuildingTargetProgressMessage.Event event) { myMessageDispatcher.processMessage(new BuildingTargetProgressMessage(targets, event)); }
|
sendBuildingTargetMessages
|
2,396 |
void (CompileContext context, ModuleChunk chunk, ModuleLevelBuilder builder) { String infoMessage = JpsBuildBundle.message("builder.0.requested.rebuild.of.module.chunk.1", builder.getPresentableName(), chunk.getName()); LOG.info(infoMessage); BuildMessage.Kind kind = BuildMessage.Kind.JPS_INFO; final CompileScope scope = context.getScope(); for (ModuleBuildTarget target : chunk.getTargets()) { if (!scope.isWholeTargetAffected(target)) { infoMessage += ".\n"; infoMessage += JpsBuildBundle.message("build.message.consider.building.whole.project.or.rebuilding.the.module"); kind = BuildMessage.Kind.INFO; break; } } context.processMessage(new CompilerMessage("", kind, infoMessage)); }
|
notifyChunkRebuildRequested
|
2,397 |
void (Builder builder, long elapsedTime, int processedFiles) { myElapsedTimeNanosByBuilder.computeIfAbsent(builder, b -> new AtomicLong()).addAndGet(elapsedTime); myNumberOfSourcesProcessedByBuilder.computeIfAbsent(builder, b -> new AtomicInteger()).addAndGet(processedFiles); }
|
storeBuilderStatistics
|
2,398 |
CompileContext (final CompileContext delegate) { final UserDataHolderBase localDataHolder = new UserDataHolderBase(); final Set<Object> deletedKeysSet = ContainerUtil.newConcurrentSet(); final Class<UserDataHolder> dataHolderInterface = UserDataHolder.class; final Class<MessageHandler> messageHandlerInterface = MessageHandler.class; return ReflectionUtil.proxy(delegate.getClass().getClassLoader(), CompileContext.class, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (args != null) { final Class<?> declaringClass = method.getDeclaringClass(); if (dataHolderInterface.equals(declaringClass)) { final Object firstArgument = args[0]; if (!(firstArgument instanceof GlobalContextKey)) { final boolean isWriteOperation = args.length == 2 /*&& void.class.equals(method.getReturnType())*/; if (isWriteOperation) { if (args[1] == null) { deletedKeysSet.add(firstArgument); } else { deletedKeysSet.remove(firstArgument); } } else { if (deletedKeysSet.contains(firstArgument)) { return null; } } final Object result = method.invoke(localDataHolder, args); if (isWriteOperation || result != null) { return result; } } } else if (messageHandlerInterface.equals(declaringClass)) { final BuildMessage msg = (BuildMessage)args[0]; if (msg.getKind() == BuildMessage.Kind.ERROR) { Utils.ERRORS_DETECTED_KEY.set(localDataHolder, Boolean.TRUE); } } return MethodHandles.lookup().unreflect(method).bindTo(delegate).asSpreader(Object[].class, args.length).invoke(args); } return MethodHandles.lookup().unreflect(method).invoke(delegate); } }); }
|
createContextWrapper
|
2,399 |
TargetTypeRegistry () { return Holder.ourInstance; }
|
getInstance
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.