Example usage for com.google.common.collect ImmutableList toArray

List of usage examples for com.google.common.collect ImmutableList toArray

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableList toArray.

Prototype

<T> T[] toArray(T[] a);

Source Link

Document

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.

Usage

From source file:com.google.devtools.build.lib.rules.objc.ObjcRuleTestCase.java

protected void checkCcDependencyAndJ2objcDependency(BinaryRuleTypePair ruleTypePair,
        ConfigurationDistinguisher configurationDistinguisher) throws Exception {
    MockProtoSupport.setup(mockToolsConfig);
    MockJ2ObjcSupport.setup(mockToolsConfig);
    useConfiguration("--cpu=ios_i386");

    scratch.file("lib/BUILD", "java_library(", "    name = 'javalib',", "    srcs = ['foo.java'],", ")", "",
            "j2objc_library(", "    name = 'j2objclib',", "    deps = [':javalib'],", ")", "", "cc_library(",
            "    name = 'cclib',", "    srcs = ['dep.c'],", ")");
    ruleTypePair.scratchTargets(scratch, "deps", "['//lib:cclib', '//lib:j2objclib']");

    Action appLipoAction = getGeneratingAction(
            getBinArtifact("x_lipobin", getConfiguredTarget("//x:x", targetConfig)));

    CommandAction binBinAction = (CommandAction) getGeneratingAction(
            getFirstArtifactEndingWith(appLipoAction.getInputs(), "bin_bin"));

    String i386Prefix = iosConfigurationCcDepsBin("i386", configurationDistinguisher);
    ImmutableList<String> archiveFilenames = ImmutableList.of(i386Prefix + "lib/libcclib.a",
            i386Prefix + "x/libbin.a", i386Prefix + "lib/libjavalib_j2objc.a",
            i386Prefix + toolsRepoExecPath("third_party/java/j2objc/libjre_core_lib.a"));

    verifyObjlist(binBinAction, "x/bin-linker.objlist",
            archiveFilenames.toArray(new String[archiveFilenames.size()]));

    assertThat(Artifact.toExecPaths(binBinAction.getInputs())).containsAllIn(
            ImmutableList.builder().addAll(archiveFilenames).add(i386Prefix + "x/bin-linker.objlist").build());
}