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;
}
}
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 SwiftcMetadataProvider method parseCompilerOutput.
@Override
protected SwiftcMetadata parseCompilerOutput(String stdout, String stderr, File swiftc, List<File> path) {
BufferedReader reader = new BufferedReader(new StringReader(stdout));
try {
String line;
while ((line = reader.readLine()) != null) {
if (line.contains("Swift version")) {
String[] tokens = line.split(" ");
// Assuming format: 'Swift version 4.0.2 (...)'
int i = 2;
if ("Apple".equals(tokens[0])) {
// Actual format: 'Apple Swift version 4.0.2 (...)'
i++;
}
VersionNumber version = VersionNumber.parse(tokens[i]);
return new DefaultSwiftcMetadata(line, version);
}
}
throw new BrokenResultException(String.format("Could not determine %s metadata: %s produced unexpected output.", getCompilerType().getDescription(), swiftc.getName()));
} catch (IOException e) {
// Should not happen when reading from a StringReader
throw new UncheckedIOException(e);
}
}
use of org.gradle.util.internal.VersionNumber in project gradle by gradle.
the class AvailableToolChains method findXcodes.
static List<InstalledXcode> findXcodes() {
List<InstalledXcode> xcodes = new ArrayList<>();
// On macOS, we assume co-located Xcode is installed into /opt/xcode
File rootXcodeInstall = new File("/opt/xcode");
List<File> xcodeCandidates = Lists.newArrayList(Arrays.asList(GUtil.getOrDefault(rootXcodeInstall.listFiles(File::isDirectory), () -> new File[0])));
// Default Xcode installation
xcodeCandidates.add(new File("/Applications/Xcode.app"));
xcodeCandidates.stream().filter(File::exists).forEach(xcodeInstall -> {
TestFile xcodebuild = new TestFile("/usr/bin/xcodebuild");
String output = xcodebuild.execute(Collections.singletonList("-version"), Collections.singletonList("DEVELOPER_DIR=" + xcodeInstall.getAbsolutePath())).getOut();
Pattern versionRegex = Pattern.compile("Xcode (\\d+\\.\\d+(\\.\\d+)?)");
Matcher matcher = versionRegex.matcher(output);
if (matcher.find()) {
VersionNumber version = VersionNumber.parse(matcher.group(1));
xcodes.add(new InstalledXcode(xcodeInstall, version));
}
});
return xcodes;
}
use of org.gradle.util.internal.VersionNumber in project gradle by gradle.
the class GccMetadataProvider method parseCompilerOutput.
@Override
protected GccMetadata parseCompilerOutput(String output, String error, File gccBinary, List<File> path) {
Map<String, String> defines = parseDefines(output, gccBinary);
VersionNumber scrapedVersion = determineVersion(defines, gccBinary);
ArchitectureInternal architecture = determineArchitecture(defines);
String scrapedVendor = determineVendor(error, scrapedVersion, gccBinary);
ImmutableList<File> systemIncludes = determineSystemIncludes(defines, path, error);
return new DefaultGccMetadata(scrapedVersion, scrapedVendor, architecture, systemIncludes);
}
Aggregations