Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
1,600
void (Collection<String> paths) { if (paths.isEmpty()) return; final String[] buffer = new String[paths.size()]; int i = 0; for (final String o : paths) { buffer[i++] = o; } Arrays.sort(buffer); logLine("Cleaning output files:"); for (final String o : buffer) { logLine(o); } logLine("End of files"); }
logDeletedFiles
1,601
boolean () { return LOG.isDebugEnabled(); }
isEnabled
1,602
void (final String message) { LOG.debug(message); }
logLine
1,603
ProjectBuilderLogger () { return myProjectLogger; }
getProjectBuilderLogger
1,604
boolean (File root, Set<? extends File> excluded, Set<? super File> notUnderExcludedCache) { File parent = root; List<File> parents = new ArrayList<>(); while (parent != null) { if (notUnderExcludedCache.contains(parent)) { return false; } if (excluded.contains(parent)) { return true; } parents.add(parent); parent = pa...
isUnderExcluded
1,605
boolean (File file) { return determineFileLocation(file, myTopLevelContentRoots, myExcludedRoots) == FileLocation.EXCLUDED; }
isExcluded
1,606
boolean (File file, JpsModule module) { return determineFileLocation(file, myModuleToContentMap.get(module), myModuleToExcludesMap.get(module)) == FileLocation.EXCLUDED; }
isExcludedFromModule
1,607
boolean (File file) { return determineFileLocation(file, myTopLevelContentRoots, myExcludedRoots) == FileLocation.IN_CONTENT; }
isInContent
1,608
FileLocation (File file, Collection<File> roots, Collection<File> excluded) { if (roots.isEmpty() && excluded.isEmpty()) { return FileLocation.NOT_IN_PROJECT; // optimization } File current = file; while (current != null) { if (excluded.contains(current)) { return FileLocation.EXCLUDED; } FileTypeAssocTable<Boolean> ta...
determineFileLocation
1,609
boolean (File file, File root, FileTypeAssocTable<Boolean> table) { File current = file; //noinspection FileEqualsUsage it's ok to compare files by 'equals' here be because these files are produced by the same 'getParentFile' calls while (current != null && !current.equals(root)) { if (table.findAssociatedFileType(curr...
isExcludedByPattern
1,610
Collection<File> (JpsModule module) { return myModuleToExcludesMap.get(module); }
getModuleExcludes
1,611
FileFilter (@NotNull JpsModule module) { List<File> contentRoots = myModuleToContentMap.get(module); if (contentRoots == null || contentRoots.isEmpty() || myExcludeFromContentRootTables.isEmpty()) return FileFilters.EVERYTHING; return file -> determineFileLocation(file, contentRoots, Collections.emptyList()) == FileLoc...
getModuleFileFilterHonorExclusionPatterns
1,612
boolean (String fileName) { return myIgnoredPatterns.isIgnored(fileName); }
isIgnored
1,613
int () { int threadsCount = Runtime.getRuntime().availableProcessors() - 1; LOG.info("Executor service will be configured with " + threadsCount + " threads"); return threadsCount; }
getThreadPoolSize
1,614
void (@NotNull File dir, boolean asynchronously) { if (!asynchronously) { FileUtil.delete(dir); return; } LOG.info("Deleting asynchronously... " + dir.getPath()); try { File temp = getEmptyTempDir(); Path moved = Files.move(dir.toPath(), temp.toPath()); EXECUTOR_SERVICE.execute(() -> delete(moved)); } catch (IOExceptio...
delete
1,615
void () { LOG.info("Running clean-up asynchronously..."); Path pluginTemp = Path.of(PathManager.getPluginTempPath()); try (Stream<Path> stream = Files.list(pluginTemp)) { List<Path> files = stream.filter(file -> file.getFileName().toString().startsWith(getPrefix())).collect(Collectors.toList()); if (!files.isEmpty()) {...
runCleanUpAsynchronously
1,616
void (@NotNull Path dir) { if (SystemInfo.isUnix) { File empty = getEmptyTempDir(); if (empty.mkdir()) { try { // https://unix.stackexchange.com/a/79656/47504 List<String> command = new ArrayList<>(); command.add("rsync"); command.add("-a"); command.add("--delete"); command.add(empty.getPath() + "/"); command.add(dir +...
delete
1,617
File () { File pluginTemp = new File(PathManager.getPluginTempPath()); String prefix = getPrefix() + UUID.randomUUID(); return FileUtil.findSequentNonexistentFile(pluginTemp, prefix, ""); }
getEmptyTempDir
1,618
String () { return LOADER_TMP_FOLDER_NAME + "-"; }
getPrefix
1,619
LoaderStatus (@Nullable Object loadResults) { if (!(loadResults instanceof File)) return LoaderStatus.FAILED; LOG.info("Start extraction of JPS caches"); File zipFile = (File)loadResults; long fileSize = zipFile.length(); File tmpFolder = new File(myBuildCacheFolder.getParentFile(), "tmp"); try { // Start extracting af...
extract
1,620
void () { if (myTmpCacheFolder != null && myTmpCacheFolder.exists()) { FileUtil.delete(myTmpCacheFolder); LOG.debug("JPS cache loader rolled back"); } }
rollback
1,621
void () { if (myTmpCacheFolder == null) { LOG.warn("Nothing to apply, download results are empty"); return; } File newTimestampFolder = new File(myTmpCacheFolder, TIMESTAMPS_FOLDER_NAME); if (newTimestampFolder.exists()) FileUtil.delete(newTimestampFolder); myContext.sendDescriptionStatusMessage(JpsBuildBundle.message(...
apply
1,622
void (@NotNull JpsLoaderContext context) { myContext = context; }
setContext
1,623
void (@NotNull BuildRunner buildRunner, boolean isForceUpdate, @NotNull List<CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope> scopes, @NotNull Runnable beforeDownload) { if (!canRunNewLoading()) return; if (isCleanupAsynchronously) JpsCachesLoaderUtil.runCleanUpAsynchronously(); if (...
load
1,624
void (@NotNull ProjectDescriptor projectDescriptor) { if (isForceCachesDownload) return; if (!hasRunningTask.get() && isCacheDownloaded) { BuildTargetsState targetsState = projectDescriptor.getTargetsState(); myOriginalBuildStatistic.getBuildTargetTypeStatistic().forEach((buildTargetType, originalBuildTime) -> { target...
updateBuildStatistic
1,625
void (@NotNull CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status status, @NotNull Channel channel, @NotNull UUID sessionId) { if (status == CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.CANCELED || status == CmdlineRemoteProto.Message.BuilderMessage.BuildEvent.Status.ERRORS || status == CmdlineR...
saveLatestBuiltCommitId
1,626
boolean (BuildRunner buildRunner, int commitsCountBetweenCompilation, List<CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope> scopes) { SystemOpsStatistic systemOpsStatistic = JpsServerConnectionUtil.measureConnectionSpeed(myNettyClient); if (systemOpsStatistic == null) { LOG.info("Con...
isDownloadQuickerThanLocalBuild
1,627
long (SystemOpsStatistic systemOpsStatistic, int projectModulesCount) { double magicCoefficient = 1.3; long decompressionSpeed; if (JpsCacheLoadingSystemStats.getDecompressionSpeedBytesPesSec() > 0) { decompressionSpeed = JpsCacheLoadingSystemStats.getDecompressionSpeedBytesPesSec(); LOG.info("Using previously saved st...
calculateApproximateDownloadTimeMs
1,628
void (@NotNull String commitId) { long startTime = System.nanoTime(); // Loading metadata for commit Map<String, Map<String, BuildTargetState>> commitSourcesState = myMetadataLoader.loadMetadataForCommit(myNettyClient, commitId); if (commitSourcesState == null) { LOG.warn("Couldn't load metadata for commit: " + commitI...
startLoadingForCommit
1,629
CompletableFuture<Void> (LoaderStatus loaderStatus, JpsOutputLoader<?> loader) { if (loaderStatus == LoaderStatus.FAILED) { myNettyClient.sendDescriptionStatusMessage(JpsBuildBundle.message("progress.text.rolling.back")); return CompletableFuture.runAsync(() -> loader.rollback(), INSTANCE); } return CompletableFuture.r...
applyChanges
1,630
void (LoaderStatus loaderStatus, String commitId, long startTime) { if (loaderStatus == LoaderStatus.FAILED) { onFail(); return; } // Statistic should be available if cache downloaded successfully myNettyClient.sendDownloadStatisticMessage(commitId, JpsCacheLoadingSystemStats.getDecompressionSpeedBytesPesSec(), JpsCach...
saveStateAndNotify
1,631
Void (Void result, Throwable ex) { if (ex != null) { Throwable cause = ex.getCause(); if (cause instanceof ProcessCanceledException) { LOG.info("Jps caches download canceled"); } else { LOG.warn("Couldn't fetch jps compilation caches", ex); onFail(); } getLoaders().forEach(loader -> loader.rollback()); myNettyClient.se...
handleExceptions
1,632
LoaderStatus (LoaderStatus firstStatus, LoaderStatus secondStatus) { if (firstStatus == LoaderStatus.FAILED || secondStatus == LoaderStatus.FAILED) return LoaderStatus.FAILED; return LoaderStatus.COMPLETE; }
combine
1,633
void () { }
onFail
1,634
int (@NotNull Map<String, Map<String, BuildTargetState>> commitSourcesState, @Nullable Map<String, Map<String, BuildTargetState>> currentSourcesState) { return calculateAffectedModules(currentSourcesState, commitSourcesState, true).size(); }
calculateDownloads
1,635
List<OutputLoadResult> () { myOldModulesPaths = null; myTmpFolderToModuleName = null; myContext.sendDescriptionStatusMessage(JpsBuildBundle.message("progress.text.calculating.affected.modules")); List<AffectedModule> affectedModules = calculateAffectedModules(myContext.getCurrentSourcesState(), myContext.getCommitSourc...
load
1,636
LoaderStatus (@Nullable Object loadResults) { if (!(loadResults instanceof List)) return LoaderStatus.FAILED; LOG.info("Start extraction of compilation outputs"); //noinspection unchecked List<OutputLoadResult> outputLoadResults = (List<OutputLoadResult>)loadResults; Map<File, String> result = new ConcurrentHashMap<>()...
extract
1,637
void () { if (myTmpFolderToModuleName == null) return; myTmpFolderToModuleName.forEach((tmpFolder, __) -> { if (tmpFolder.isDirectory() && tmpFolder.exists()) FileUtil.delete(tmpFolder); }); LOG.info("JPS cache loader rolled back"); }
rollback
1,638
void () { long start = System.currentTimeMillis(); if (myOldModulesPaths != null) { LOG.info("Removing old compilation outputs " + myOldModulesPaths.size() + " counts"); myOldModulesPaths.forEach(file -> { if (file.exists()) FileUtil.delete(file); }); } if (myTmpFolderToModuleName == null) { LOG.debug("Nothing to apply...
apply
1,639
void (@NotNull JpsLoaderContext context) { myContext = context; }
setContext
1,640
List<AffectedModule> (@Nullable Map<String, Map<String, BuildTargetState>> currentModulesState, @NotNull Map<String, Map<String, BuildTargetState>> commitModulesState, boolean checkExistance) { long start = System.currentTimeMillis(); List<AffectedModule> affectedModules = new ArrayList<>(); Map<String, String> oldModu...
calculateAffectedModules
1,641
List<AffectedModule> (List<AffectedModule> affectedModules, @NotNull Map<String, Map<String, BuildTargetState>> commitModulesState) { Set<AffectedModule> result = new HashSet<>(); affectedModules.forEach(affectedModule -> { if (affectedModule.getType().equals(JAVA_PRODUCTION)) { BuildTargetState targetState = commitMod...
mergeAffectedModules
1,642
File (String buildDirRelativePath) { return new File(buildDirRelativePath.replace("$BUILD_DIR$", myBuildDirPath)); }
getBuildDirRelativeFile
1,643
String (String content) { return String.valueOf(Xxh3.hash(content)); }
calculateStringHash
1,644
void () { AffectedModule affectedModule = loadResult.getModule(); File outPath = affectedModule.getOutPath(); try { context.checkCanceled(); int expectedDownloads = context.getTotalExpectedDownloads(); context.getNettyClient().sendDescriptionStatusMessage(JpsBuildBundle.message("progress.details.extracting.compilation....
run
1,645
long () { return decompressionSpeedBytesPesSec; }
getDecompressionSpeedBytesPesSec
1,646
void (long fileSize, long duration) { decompressionSpeedBytesPesSec = fileSize / duration * 1000; }
setDecompressionTimeMs
1,647
void (long decompressionSpeed) { if (decompressionSpeed > 0) decompressionSpeedBytesPesSec = decompressionSpeed; }
setDecompressionSpeed
1,648
long () { return deletionSpeedBytesPerSec; }
getDeletionSpeedBytesPerSec
1,649
void (long fileSize, long duration) { deletionSpeedBytesPerSec = fileSize / duration * 1000; }
setDeletionTimeMs
1,650
void (long deletionSpeed) { if (deletionSpeed > 0) deletionSpeedBytesPerSec = deletionSpeed; }
setDeletionSpeed
1,651
Long () { return myProjectRebuildTime; }
getProjectRebuildTime
1,652
long () { return deletionSpeedBytesPerSec; }
getDeletionSpeedBytesPerSec
1,653
long () { return connectionSpeedBytesPerSec; }
getConnectionSpeedBytesPerSec
1,654
long () { return decompressionSpeedBytesPesSec; }
getDecompressionSpeedBytesPesSec
1,655
File () { return zipFile; }
getZipFile
1,656
String () { return downloadUrl; }
getDownloadUrl
1,657
AffectedModule () { return module; }
getModule
1,658
String () { return hash; }
getHash
1,659
String () { return relativePath; }
getRelativePath
1,660
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; BuildTargetState state = (BuildTargetState)o; if (!Objects.equals(hash, state.hash)) return false; if (!Objects.equals(relativePath, state.relativePath)) return false; return true; }
equals
1,661
int () { int result = hash != null ? hash.hashCode() : 0; result = 31 * result + (relativePath != null ? relativePath.hashCode() : 0); return result; }
hashCode
1,662
String () { return type; }
getType
1,663
String () { return name; }
getName
1,664
String () { return hash; }
getHash
1,665
File () { return outPath; }
getOutPath
1,666
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AffectedModule module = (AffectedModule)o; if (type != null ? !type.equals(module.type) : module.type != null) return false; if (name != null ? !name.equals(module.name) : module.name != null) return false; if (h...
equals
1,667
int () { int result = type != null ? type.hashCode() : 0; result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (hash != null ? hash.hashCode() : 0); result = 31 * result + (outPath != null ? outPath.hashCode() : 0); return result; }
hashCode
1,668
String () { return commitId; }
getCommitId
1,669
void (@NotNull String message) { nettyClient.sendDescriptionStatusMessage(message); }
sendDescriptionStatusMessage
1,670
JpsNettyClient () { return nettyClient; }
getNettyClient
1,671
int () { return totalExpectedDownloads; }
getTotalExpectedDownloads
1,672
JpsLoaderContext (int totalExpectedDownloads, @NotNull CanceledStatus canceledStatus, @NotNull String commitId, @NotNull JpsNettyClient nettyClient, @NotNull Map<String, Map<String, BuildTargetState>> commitSourcesState, @Nullable Map<String, Map<String, BuildTargetState>> currentSourcesState) { return new JpsLoaderCon...
createNewContext
1,673
String () { return myDownloadUrl; }
getDownloadUrl
1,674
String () { return myFileName + myFileExtension; }
getPresentableFileName
1,675
String () { return myDownloadUrl; }
getPresentableDownloadUrl
1,676
String () { return generateFileName(Conditions.alwaysTrue()); }
getDefaultFileName
1,677
String (@NotNull Condition<? super String> validator) { return UniqueNameGenerator.generateUniqueName("", myFileName, myFileExtension, "_", "", validator); }
generateFileName
1,678
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DownloadableFileUrl that = (DownloadableFileUrl)o; return myDownloadUrl.equals(that.myDownloadUrl); }
equals
1,679
int () { return myDownloadUrl.hashCode(); }
hashCode
1,680
void (@NotNull Map<String, String> requestHeaders) { JpsServerAuthUtil.requestHeaders = requestHeaders; }
setRequestHeaders
1,681
JpsServerClient (@NotNull String serverUrl) { return new JpsServerClientImpl(serverUrl); }
getServerClient
1,682
void (@NotNull String message) { myChannel.writeAndFlush(CmdlineProtoUtil.toMessage(mySessionId, CmdlineProtoUtil.createCacheDownloadMessage(message))); }
sendDescriptionStatusMessage
1,683
void (@NotNull String message, int expectedDownloads) { int currentDownloads = currentDownloadsCount.incrementAndGet(); if (expectedDownloads == 0) { myChannel.writeAndFlush(CmdlineProtoUtil.toMessage(mySessionId, CmdlineProtoUtil.createCacheDownloadMessage(message))); } else { int doubleExpectedDownloads = expectedDow...
sendDescriptionStatusMessage
1,684
void (@NotNull String latestDownloadCommit, long decompressionTimeBytesPesSec, long deletionTimeBytesPerSec) { myChannel.writeAndFlush(CmdlineProtoUtil.toMessage(mySessionId, CmdlineProtoUtil.createSaveDownloadStatisticMessage(latestDownloadCommit, decompressionTimeBytesPesSec, deletionTimeBytesPerSec))); }
sendDownloadStatisticMessage
1,685
void (@NotNull Channel channel, @NotNull UUID sessionId) { channel.writeAndFlush(CmdlineProtoUtil.toMessage(sessionId, CmdlineProtoUtil.createSaveLatestBuiltCommitMessage())); }
saveLatestBuiltCommit
1,686
String (@NotNull String fileName) { byte[] decodedBytes = Base64.getDecoder().decode("aHR0cHM6Ly9kMWxjNWs5bGVyZzZrbS5jbG91ZGZyb250Lm5ldA=="); return new String(decodedBytes, StandardCharsets.UTF_8) + "/speed-test/" + fileName; }
calculateURL
1,687
boolean () { try { URL url = new URL("https://www.google.com/"); URLConnection connection = url.openConnection(); connection.setConnectTimeout(1000); connection.connect(); return true; } catch (Exception e) { LOG.info("Internet connection is not available"); return false; } }
checkInternetConnectionAvailable
1,688
String (long fileSize) { int rank = (int)((Math.log10(fileSize) + 0.0000021714778384307465) / 3); // (3 - Math.log10(999.995)) double value = fileSize / Math.pow(1000, rank); String[] units = {"Bit", "Kbit", "Mbit", "Gbit"}; return new DecimalFormat("0.##").format(value) + units[rank] + "/s"; }
formatInternetSpeed
1,689
List<OutputLoadResult> (@NotNull JpsLoaderContext context, @NotNull List<AffectedModule> affectedModules) { File targetDir = new File(PathManager.getPluginTempPath(), JpsCachesLoaderUtil.LOADER_TMP_FOLDER_NAME); if (targetDir.exists()) FileUtil.delete(targetDir); targetDir.mkdirs(); Map<String, AffectedModule> urlToMod...
downloadCompiledModules
1,690
void () { try { get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } catch (CancellationException ignored) { } }
waitFor
1,691
boolean (long timeout, TimeUnit unit) { try { get(timeout, unit); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } catch (TimeoutException | CancellationException ignored) { } return isDone(); }
waitFor
1,692
boolean (boolean mayInterruptIfRunning) { return myFuture.cancel(mayInterruptIfRunning); }
cancel
1,693
boolean () { return myFuture.isCancelled(); }
isCancelled
1,694
boolean () { return myFuture.isDone(); }
isDone
1,695
Method () { try { return ReflectionUtil.getDeclaredMethod(ResourceBundle.class, "setParent", ResourceBundle.class); } catch (Throwable e) { return null; } }
getSetParentMethod
1,696
ResourceBundle ( @NotNull @NonNls String pathToBundle, @NotNull ClassLoader loader, @NotNull ResourceBundle.Control control ) { final ResourceBundle base = super.findBundle(pathToBundle, loader, control); final ClassLoader languageBundleLoader = ourLangBundleLoader; if (languageBundleLoader != null) { ResourceBundle la...
findBundle
1,697
UUID () { return myRequestID; }
getRequestID
1,698
T () { return myHandler; }
getMessageHandler
1,699
List<TargetTypeBuildScope> (final boolean forceBuild) { return Arrays.asList( createAllModulesProductionScope(forceBuild), createAllTargetsScope(JavaModuleBuildTargetType.TEST, forceBuild) ); }
createAllModulesScopes