use of org.gradle.internal.jvm.inspection.JvmInstallationMetadata in project gradle by gradle.
the class ToolchainReportRenderer method printInvalidToolchains.
public void printInvalidToolchains(List<ReportableToolchain> invalidToolchains) {
if (!invalidToolchains.isEmpty()) {
StyledTextOutput output = getTextOutput();
output.withStyle(Identifier).println(" + Invalid toolchains");
for (ReportableToolchain toolchain : invalidToolchains) {
JvmInstallationMetadata metadata = toolchain.metadata;
output.withStyle(Identifier).println(" + " + metadata.getJavaHome());
final String paddedErrorType = Strings.padEnd("Error:", 20, ' ');
getTextOutput().withStyle(Normal).format(" | %s", paddedErrorType);
getTextOutput().withStyle(Description).println(metadata.getErrorMessage());
}
output.println();
}
}
use of org.gradle.internal.jvm.inspection.JvmInstallationMetadata in project gradle by gradle.
the class ToolchainReportRenderer method printToolchain.
public void printToolchain(ReportableToolchain toolchain) {
StyledTextOutput output = getTextOutput();
JvmInstallationMetadata metadata = toolchain.metadata;
String displayName = metadata.getDisplayName();
output.withStyle(Identifier).println(" + " + displayName + " " + metadata.getRuntimeVersion());
printAttribute("Location", metadata.getJavaHome().toString());
printAttribute("Language Version", metadata.getLanguageVersion().getMajorVersion());
printAttribute("Vendor", metadata.getVendor().getDisplayName());
printAttribute("Architecture", metadata.getArchitecture());
printAttribute("Is JDK", String.valueOf(metadata.hasCapability(JAVA_COMPILER)));
printAttribute("Detected by", toolchain.location.getSource());
output.println();
}
use of org.gradle.internal.jvm.inspection.JvmInstallationMetadata in project gradle by gradle.
the class AvailableJavaHomes method discoverLocalInstallations.
private static List<JvmInstallationMetadata> discoverLocalInstallations() {
ExecHandleFactory execHandleFactory = TestFiles.execHandleFactory();
TemporaryFileProvider temporaryFileProvider = TestFiles.tmpDirTemporaryFileProvider(new File(SystemProperties.getInstance().getJavaIoTmpDir()));
DefaultJvmMetadataDetector defaultJvmMetadataDetector = new DefaultJvmMetadataDetector(execHandleFactory, temporaryFileProvider);
JvmMetadataDetector metadataDetector = new CachingJvmMetadataDetector(defaultJvmMetadataDetector);
final List<JvmInstallationMetadata> jvms = new JavaInstallationRegistry(defaultInstallationSuppliers(), new TestBuildOperationExecutor(), OperatingSystem.current()).listInstallations().stream().map(InstallationLocation::getLocation).map(metadataDetector::getMetadata).filter(JvmInstallationMetadata::isValidInstallation).sorted(Comparator.comparing(JvmInstallationMetadata::getDisplayName).thenComparing(JvmInstallationMetadata::getLanguageVersion)).collect(Collectors.toList());
System.out.println("Found the following JVMs:");
for (JvmInstallationMetadata jvm : jvms) {
String name = jvm.getDisplayName() + " " + jvm.getImplementationVersion() + " ";
System.out.println(" " + name + " - " + jvm.getJavaHome());
}
return jvms;
}
Aggregations