Search in sources :

Example 1 with ExecutionRootPath

use of com.google.idea.blaze.base.model.primitives.ExecutionRootPath in project intellij by bazelbuild.

the class IdeInfoFromProtobuf method makeCToolchainIdeInfo.

private static CToolchainIdeInfo makeCToolchainIdeInfo(IntellijIdeInfo.CToolchainIdeInfo cToolchainIdeInfo) {
    Collection<ExecutionRootPath> builtInIncludeDirectories = makeExecutionRootPathList(cToolchainIdeInfo.getBuiltInIncludeDirectoryList());
    ExecutionRootPath cppExecutable = new ExecutionRootPath(cToolchainIdeInfo.getCppExecutable());
    UnfilteredCompilerOptions compilerOptions = UnfilteredCompilerOptions.builder().registerSingleOrSplitOption("-isystem").build(cToolchainIdeInfo.getUnfilteredCompilerOptionList());
    CToolchainIdeInfo.Builder builder = CToolchainIdeInfo.builder().addBaseCompilerOptions(cToolchainIdeInfo.getBaseCompilerOptionList()).addCCompilerOptions(cToolchainIdeInfo.getCOptionList()).addCppCompilerOptions(cToolchainIdeInfo.getCppOptionList()).addBuiltInIncludeDirectories(builtInIncludeDirectories).setCppExecutable(cppExecutable).setTargetName(cToolchainIdeInfo.getTargetName()).addUnfilteredCompilerOptions(compilerOptions.getUninterpretedOptions()).addUnfilteredToolchainSystemIncludes(makeExecutionRootPathList(compilerOptions.getExtractedOptionValues("-isystem")));
    return builder.build();
}
Also used : CToolchainIdeInfo(com.google.idea.blaze.base.ideinfo.CToolchainIdeInfo) ExecutionRootPath(com.google.idea.blaze.base.model.primitives.ExecutionRootPath)

Example 2 with ExecutionRootPath

use of com.google.idea.blaze.base.model.primitives.ExecutionRootPath in project intellij by bazelbuild.

the class BlazeConfigurationResolver method collectExecutionRootPaths.

private static Set<ExecutionRootPath> collectExecutionRootPaths(TargetMap targetMap, ImmutableMap<TargetKey, CToolchainIdeInfo> toolchainLookupMap) {
    Set<ExecutionRootPath> paths = Sets.newHashSet();
    for (TargetIdeInfo target : targetMap.targets()) {
        if (target.cIdeInfo != null) {
            paths.addAll(target.cIdeInfo.localIncludeDirectories);
            paths.addAll(target.cIdeInfo.transitiveSystemIncludeDirectories);
            paths.addAll(target.cIdeInfo.transitiveIncludeDirectories);
            paths.addAll(target.cIdeInfo.transitiveQuoteIncludeDirectories);
        }
    }
    Set<CToolchainIdeInfo> toolchains = new LinkedHashSet<>(toolchainLookupMap.values());
    for (CToolchainIdeInfo toolchain : toolchains) {
        paths.addAll(toolchain.builtInIncludeDirectories);
        paths.addAll(toolchain.unfilteredToolchainSystemIncludes);
    }
    return paths;
}
Also used : TargetIdeInfo(com.google.idea.blaze.base.ideinfo.TargetIdeInfo) LinkedHashSet(java.util.LinkedHashSet) CToolchainIdeInfo(com.google.idea.blaze.base.ideinfo.CToolchainIdeInfo) ExecutionRootPath(com.google.idea.blaze.base.model.primitives.ExecutionRootPath)

Example 3 with ExecutionRootPath

use of com.google.idea.blaze.base.model.primitives.ExecutionRootPath in project intellij by bazelbuild.

the class ExecutionRootPathResolverTest method testIllegalWorkspacePaths.

@Test
public void testIllegalWorkspacePaths() {
    ImmutableList<File> files = pathResolver.resolveToIncludeDirectories(new ExecutionRootPath("tools/fast/:include"));
    assertThat(files).isEmpty();
}
Also used : ExecutionRootPath(com.google.idea.blaze.base.model.primitives.ExecutionRootPath) File(java.io.File) Test(org.junit.Test)

Example 4 with ExecutionRootPath

use of com.google.idea.blaze.base.model.primitives.ExecutionRootPath in project intellij by bazelbuild.

the class ExecutionRootPathResolverTest method testExternalWorkspacePathRelativeToExecRoot.

@Test
public void testExternalWorkspacePathRelativeToExecRoot() {
    ImmutableList<File> files = pathResolver.resolveToIncludeDirectories(new ExecutionRootPath("external/guava/src"));
    assertThat(files).containsExactly(new File(EXECUTION_ROOT, "external/guava/src"));
}
Also used : ExecutionRootPath(com.google.idea.blaze.base.model.primitives.ExecutionRootPath) File(java.io.File) Test(org.junit.Test)

Example 5 with ExecutionRootPath

use of com.google.idea.blaze.base.model.primitives.ExecutionRootPath in project intellij by bazelbuild.

the class ExecutionRootPathResolverTest method testGenfilesPathRelativeToExecRoot.

@Test
public void testGenfilesPathRelativeToExecRoot() {
    ImmutableList<File> files = pathResolver.resolveToIncludeDirectories(new ExecutionRootPath("bazel-out/crosstool/genfiles/res/normal"));
    assertThat(files).containsExactly(new File(EXECUTION_ROOT, "bazel-out/crosstool/genfiles/res/normal"));
}
Also used : ExecutionRootPath(com.google.idea.blaze.base.model.primitives.ExecutionRootPath) File(java.io.File) Test(org.junit.Test)

Aggregations

ExecutionRootPath (com.google.idea.blaze.base.model.primitives.ExecutionRootPath)10 File (java.io.File)6 Test (org.junit.Test)6 CToolchainIdeInfo (com.google.idea.blaze.base.ideinfo.CToolchainIdeInfo)2 TargetIdeInfo (com.google.idea.blaze.base.ideinfo.TargetIdeInfo)2 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 ImmutableList (com.google.common.collect.ImmutableList)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 TargetMap (com.google.idea.blaze.base.ideinfo.TargetMap)1 BlazeProjectData (com.google.idea.blaze.base.model.BlazeProjectData)1 BlazeSyncParams (com.google.idea.blaze.base.sync.BlazeSyncParams)1 Module (com.intellij.openapi.module.Module)1 OCCompilerSettings (com.jetbrains.cidr.lang.workspace.compiler.OCCompilerSettings)1 LinkedHashSet (java.util.LinkedHashSet)1 ExecutionException (java.util.concurrent.ExecutionException)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1