use of org.gradle.util.internal.VersionNumber in project gradle by gradle.
the class IdeaScalaConfigurer method findIdeaTargetVersion.
private VersionNumber findIdeaTargetVersion() {
VersionNumber targetVersion = null;
String targetVersionString = rootProject.getExtensions().getByType(IdeaModel.class).getTargetVersion();
if (targetVersionString != null) {
targetVersion = VersionNumber.parse(targetVersionString);
if (targetVersion.equals(VersionNumber.UNKNOWN)) {
throw new GradleScriptException("String '" + targetVersionString + "' is not a valid value for IdeaModel.targetVersion.", null);
}
}
return targetVersion;
}
use of org.gradle.util.internal.VersionNumber in project gradle by gradle.
the class DefaultGradleApiSourcesResolver method resolveLocalGroovySources.
@Override
public File resolveLocalGroovySources(String jarName) {
Matcher matcher = FILE_NAME_PATTERN.matcher(jarName);
if (!matcher.matches()) {
return null;
}
VersionNumber version = VersionNumber.parse(matcher.group(3));
final String artifactName = matcher.group(1);
return downloadLocalGroovySources(artifactName, version);
}
use of org.gradle.util.internal.VersionNumber in project gradle by gradle.
the class UpgradeCapabilityResolver method resolve.
@Override
public void resolve(CapabilitiesConflictHandler.ResolutionDetails details) {
Collection<? extends Capability> capabilityVersions = details.getCapabilityVersions();
if (capabilityVersions.size() > 1) {
Set<Capability> sorted = Sets.newTreeSet((o1, o2) -> {
VersionNumber v1 = VersionNumber.parse(o1.getVersion());
VersionNumber v2 = VersionNumber.parse(o2.getVersion());
return v2.compareTo(v1);
});
sorted.addAll(capabilityVersions);
boolean first = true;
for (Capability capability : sorted) {
DisplayName reason = Describables.of("latest version of capability", ((CapabilityInternal) capability).getCapabilityId());
boolean isFirst = first;
details.getCandidates(capability).forEach(cand -> {
cand.byReason(reason);
if (!isFirst) {
cand.evict();
}
});
first = false;
}
}
}
use of org.gradle.util.internal.VersionNumber in project gradle by gradle.
the class WindowsRegistryVersionLocator method locateInstallsInRegistry.
private void locateInstallsInRegistry(List<VisualStudioInstallCandidate> installs, String baseKey) {
List<String> visualCppVersions;
try {
visualCppVersions = windowsRegistry.getValueNames(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, baseKey + REGISTRY_ROOTPATH_VC);
} catch (MissingRegistryEntryException e) {
// No Visual Studio information available in the registry
return;
}
for (String versionString : visualCppVersions) {
if (!versionString.matches("\\d+\\.\\d+")) {
// Ignore the other values
continue;
}
File visualCppDir = new File(windowsRegistry.getStringValue(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, baseKey + REGISTRY_ROOTPATH_VC, versionString));
visualCppDir = FileUtils.canonicalize(visualCppDir);
File visualStudioDir = visualCppDir.getParentFile();
VersionNumber version = VersionNumber.parse(versionString);
installs.add(new VisualStudioMetadataBuilder().installDir(visualStudioDir).visualCppDir(visualCppDir).version(version).visualCppVersion(version).build());
}
}
use of org.gradle.util.internal.VersionNumber in project gradle by gradle.
the class DefaultVisualStudioLocator method addInstallIfValid.
private boolean addInstallIfValid(VisualStudioInstallCandidate install, String source) {
File visualCppDir = install.getVisualCppDir();
File visualStudioDir = install.getInstallDir();
if (foundInstalls.containsKey(visualStudioDir)) {
return true;
}
if (brokenInstalls.contains(visualStudioDir)) {
return false;
}
if (isValidInstall(install) && install.getVisualCppVersion() != VersionNumber.UNKNOWN) {
LOGGER.debug("Found Visual C++ {} at {}", install.getVisualCppVersion(), visualCppDir);
VersionNumber visualStudioVersion = install.getVersion();
String visualStudioDisplayVersion = install.getVersion() == VersionNumber.UNKNOWN ? "from " + source : install.getVersion().toString();
VisualCppInstall visualCpp = buildVisualCppInstall("Visual C++ " + install.getVisualCppVersion(), visualStudioDir, visualCppDir, install.getVisualCppVersion(), install.getCompatibility());
VisualStudioInstall visualStudio = new VisualStudioInstall("Visual Studio " + visualStudioDisplayVersion, visualStudioDir, visualStudioVersion, visualCpp);
foundInstalls.put(visualStudioDir, visualStudio);
return true;
} else {
LOGGER.debug("Ignoring candidate Visual C++ directory {} as it does not look like a Visual C++ installation.", visualCppDir);
brokenInstalls.add(visualStudioDir);
return false;
}
}
Aggregations