Search in sources :

Example 1 with Tool

use of com.google.devtools.build.lib.rules.cpp.CppConfiguration.Tool in project bazel by bazelbuild.

the class NdkPaths method createToolpaths.

public ImmutableList<ToolPath> createToolpaths(String toolchainName, String targetPlatform, CppConfiguration.Tool... excludedTools) {
    ImmutableList.Builder<ToolPath> toolPaths = ImmutableList.builder();
    for (Tool tool : CppConfiguration.Tool.values()) {
        // Some toolchains don't have particular tools.
        if (!Arrays.asList(excludedTools).contains(tool)) {
            String toolPath = createToolPath(toolchainName, targetPlatform + "-" + tool.getNamePart());
            toolPaths.add(ToolPath.newBuilder().setName(tool.getNamePart()).setPath(toolPath).build());
        }
    }
    return toolPaths.build();
}
Also used : ToolPath(com.google.devtools.build.lib.view.config.crosstool.CrosstoolConfig.ToolPath) ImmutableList(com.google.common.collect.ImmutableList) Tool(com.google.devtools.build.lib.rules.cpp.CppConfiguration.Tool)

Example 2 with Tool

use of com.google.devtools.build.lib.rules.cpp.CppConfiguration.Tool in project bazel by bazelbuild.

the class CrosstoolConfigurationLoaderTest method getConfigWithMissingToolDef.

/**
   * Returns a test crosstool config with the specified tool missing from the tool_path
   * set. Also allows injection of custom fields.
   */
private static String getConfigWithMissingToolDef(Tool missingTool, String... customFields) {
    StringBuilder s = new StringBuilder("major_version: \"12\"" + "minor_version: \"0\"" + "default_target_cpu: \"cpu\"" + "default_toolchain {" + "  cpu: \"cpu\"" + "  toolchain_identifier: \"toolchain-identifier\"" + "}" + "toolchain {" + "  toolchain_identifier: \"toolchain-identifier\"" + "  host_system_name: \"host-system-name\"" + "  target_system_name: \"target-system-name\"" + "  target_cpu: \"piii\"" + "  target_libc: \"target-libc\"" + "  compiler: \"compiler\"" + "  abi_version: \"abi-version\"" + "  abi_libc_version: \"abi-libc-version\"");
    for (String customField : customFields) {
        s.append(customField);
    }
    for (Tool tool : Tool.values()) {
        if (tool != missingTool) {
            String toolName = tool.getNamePart();
            s.append("  tool_path { name: \"" + toolName + "\" path: \"path-to-" + toolName + "\" }");
        }
    }
    s.append("}");
    return s.toString();
}
Also used : Tool(com.google.devtools.build.lib.rules.cpp.CppConfiguration.Tool)

Aggregations

Tool (com.google.devtools.build.lib.rules.cpp.CppConfiguration.Tool)2 ImmutableList (com.google.common.collect.ImmutableList)1 ToolPath (com.google.devtools.build.lib.view.config.crosstool.CrosstoolConfig.ToolPath)1