use of org.gradle.util.GradleVersion in project gradle by gradle.
the class WrapperDistributionCleanupAction method determineChecksumDirsByVersion.
private Multimap<GradleVersion, File> determineChecksumDirsByVersion() {
Multimap<GradleVersion, File> result = ArrayListMultimap.create();
for (File dir : listDirs(distsDir)) {
for (File checksumDir : listDirs(dir)) {
try {
GradleVersion gradleVersion = determineGradleVersionFromBuildReceipt(checksumDir);
result.put(gradleVersion, checksumDir);
} catch (Exception e) {
LOGGER.debug("Could not determine Gradle version for {}: {} ({})", checksumDir, e.getMessage(), e.getClass().getName());
}
}
}
return result;
}
use of org.gradle.util.GradleVersion in project gradle by gradle.
the class WrapperDistributionCleanupAction method determineGradleVersionFromDistribution.
@VisibleForTesting
protected GradleVersion determineGradleVersionFromDistribution(File distributionHomeDir) throws Exception {
List<File> checkedJarFiles = new ArrayList<File>();
for (Map.Entry<String, Pattern> entry : JAR_FILE_PATTERNS_BY_PREFIX.entrySet()) {
List<File> jarFiles = listFiles(new File(distributionHomeDir, "lib"), new RegexFileFilter(entry.getValue()));
if (!jarFiles.isEmpty()) {
Preconditions.checkArgument(jarFiles.size() == 1, "A Gradle distribution must contain at most one %s-*.jar: %s", entry.getKey(), jarFiles);
File jarFile = single(jarFiles);
GradleVersion gradleVersion = readGradleVersionFromJarFile(jarFile);
if (gradleVersion != null) {
return gradleVersion;
}
checkedJarFiles.add(jarFile);
}
}
throw new IllegalArgumentException("No checked JAR file contained a build receipt: " + checkedJarFiles);
}
use of org.gradle.util.GradleVersion in project gradle by gradle.
the class VersionSpecificCacheCleanupAction method performCleanup.
private void performCleanup(CleanupProgressMonitor progressMonitor) {
MinimumTimestampProvider minimumTimestampProvider = new MinimumTimestampProvider();
SortedSetMultimap<GradleVersion, VersionSpecificCacheDirectory> cacheDirsByBaseVersion = scanForVersionSpecificCacheDirs();
for (GradleVersion baseVersion : cacheDirsByBaseVersion.keySet()) {
performCleanup(cacheDirsByBaseVersion.get(baseVersion), minimumTimestampProvider, progressMonitor);
}
markCleanedUp();
}
use of org.gradle.util.GradleVersion in project gradle by gradle.
the class CrossVersionResultsStore method resolveGradleVersion.
protected GradleVersion resolveGradleVersion(String version) {
GradleVersion gradleVersion = gradleVersionCache.get(version);
if (gradleVersion == null) {
gradleVersion = GradleVersion.version(version);
gradleVersionCache.put(version, gradleVersion);
}
return gradleVersion;
}
use of org.gradle.util.GradleVersion in project gradle by gradle.
the class AbstractGradleExecuter method cleanupIsolatedDaemons.
private void cleanupIsolatedDaemons() {
List<DaemonLogsAnalyzer> analyzers = new ArrayList<>();
List<GradleVersion> versions = (gradleVersionOverride != null) ? ImmutableList.of(gradleVersion, gradleVersionOverride) : ImmutableList.of(gradleVersion);
for (File dir : isolatedDaemonBaseDirs) {
for (GradleVersion version : versions) {
try {
DaemonLogsAnalyzer analyzer = new DaemonLogsAnalyzer(dir, version.getVersion());
analyzers.add(analyzer);
analyzer.killAll();
} catch (Exception e) {
getLogger().warn("Problem killing isolated daemons of Gradle version " + version + " in " + dir, e);
}
}
}
if (checkDaemonCrash) {
analyzers.forEach(DaemonLogsAnalyzer::assertNoCrashedDaemon);
}
}
Aggregations