use of org.gradle.nativeplatform.toolchain.internal.gcc.metadata.GccMetadata in project gradle by gradle.
the class AvailableToolChains method findGccs.
private static List<ToolChainCandidate> findGccs(boolean mustFind) {
GccMetadataProvider versionDeterminer = GccMetadataProvider.forGcc(TestFiles.execActionFactory());
Set<File> gppCandidates = ImmutableSet.copyOf(OperatingSystem.current().findAllInPath("g++"));
List<ToolChainCandidate> toolChains = Lists.newArrayList();
if (!gppCandidates.isEmpty()) {
File firstInPath = gppCandidates.iterator().next();
for (File candidate : gppCandidates) {
SearchResult<GccMetadata> version = versionDeterminer.getCompilerMetaData(candidate, Collections.<String>emptyList());
if (version.isAvailable()) {
InstalledGcc gcc = new InstalledGcc("gcc" + " " + version.getComponent().getVersion());
if (!candidate.equals(firstInPath)) {
// Not the first g++ in the path, needs the path variable updated
gcc.inPath(candidate.getParentFile());
}
toolChains.add(gcc);
}
}
}
if (mustFind && toolChains.isEmpty()) {
toolChains.add(new UnavailableToolChain("gcc"));
}
return toolChains;
}
use of org.gradle.nativeplatform.toolchain.internal.gcc.metadata.GccMetadata in project gradle by gradle.
the class AbstractGccCompatibleToolChain method initTools.
protected void initTools(DefaultGccPlatformToolChain platformToolChain, ToolChainAvailability availability) {
// Attempt to determine whether the compiler is the correct implementation
for (GccCommandLineToolConfigurationInternal tool : platformToolChain.getCompilers()) {
CommandLineToolSearchResult compiler = locate(tool);
if (compiler.isAvailable()) {
SearchResult<GccMetadata> gccMetadata = getMetaDataProvider().getCompilerMetaData(compiler.getTool(), platformToolChain.getCompilerProbeArgs());
availability.mustBeAvailable(gccMetadata);
if (!gccMetadata.isAvailable()) {
return;
}
// Assume all the other compilers are ok, if they happen to be installed
LOGGER.debug("Found {} with version {}", tool.getToolType().getToolName(), gccMetadata);
initForImplementation(platformToolChain, gccMetadata.getComponent());
break;
}
}
}
Aggregations