Search in sources :

Example 1 with GccMetadata

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;
}
Also used : GccMetadata(org.gradle.nativeplatform.toolchain.internal.gcc.metadata.GccMetadata) GccMetadataProvider(org.gradle.nativeplatform.toolchain.internal.gcc.metadata.GccMetadataProvider) File(java.io.File) TestFile(org.gradle.test.fixtures.file.TestFile)

Example 2 with GccMetadata

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;
        }
    }
}
Also used : GccMetadata(org.gradle.nativeplatform.toolchain.internal.gcc.metadata.GccMetadata) CommandLineToolSearchResult(org.gradle.nativeplatform.toolchain.internal.tools.CommandLineToolSearchResult) GccCommandLineToolConfigurationInternal(org.gradle.nativeplatform.toolchain.internal.tools.GccCommandLineToolConfigurationInternal)

Aggregations

GccMetadata (org.gradle.nativeplatform.toolchain.internal.gcc.metadata.GccMetadata)2 File (java.io.File)1 GccMetadataProvider (org.gradle.nativeplatform.toolchain.internal.gcc.metadata.GccMetadataProvider)1 CommandLineToolSearchResult (org.gradle.nativeplatform.toolchain.internal.tools.CommandLineToolSearchResult)1 GccCommandLineToolConfigurationInternal (org.gradle.nativeplatform.toolchain.internal.tools.GccCommandLineToolConfigurationInternal)1 TestFile (org.gradle.test.fixtures.file.TestFile)1