Search in sources :

Example 36 with WorkspaceRoot

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

the class BlazeConfigurationResolver method buildBlazeConfigurationData.

private void buildBlazeConfigurationData(BlazeContext parentContext, WorkspaceRoot workspaceRoot, ProjectViewSet projectViewSet, BlazeProjectData blazeProjectData, ImmutableMap<TargetKey, CToolchainIdeInfo> toolchainLookupMap, ImmutableMap<File, VirtualFile> headerRoots, ImmutableMap<CToolchainIdeInfo, BlazeCompilerSettings> compilerSettings, CompilerInfoCache compilerInfoCache, ExecutionRootPathResolver executionRootPathResolver, BlazeConfigurationResolverResult oldConfigurationData, BlazeConfigurationResolverResult.Builder builder) {
    // Type specification needed to avoid incorrect type inference during command line build.
    Scope.push(parentContext, (ScopedOperation) context -> {
        context.push(new TimingScope("Build C configuration map", EventType.Other));
        ProjectViewTargetImportFilter filter = new ProjectViewTargetImportFilter(project, workspaceRoot, projectViewSet);
        ConcurrentMap<TargetKey, BlazeResolveConfigurationData> targetToData = Maps.newConcurrentMap();
        List<ListenableFuture<?>> targetToDataFutures = blazeProjectData.targetMap.targets().stream().filter(target -> target.kind.languageClass == LanguageClass.C).filter(target -> target.kind != Kind.CC_TOOLCHAIN).filter(filter::isSourceTarget).filter(BlazeConfigurationResolver::containsCompiledSources).map(target -> submit(() -> {
            BlazeResolveConfigurationData data = createResolveConfiguration(target, toolchainLookupMap, headerRoots, compilerSettings, compilerInfoCache, executionRootPathResolver);
            if (data != null) {
                targetToData.put(target.key, data);
            }
            return null;
        })).collect(Collectors.toList());
        try {
            Futures.allAsList(targetToDataFutures).get();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            context.setCancelled();
            return;
        } catch (ExecutionException e) {
            IssueOutput.error("Could not build C resolve configurations: " + e).submit(context);
            logger.error("Could not build C resolve configurations", e);
            return;
        }
        findEquivalenceClasses(context, project, blazeProjectData.workspacePathResolver, targetToData, oldConfigurationData, builder);
    });
}
Also used : ArrayListMultimap(com.google.common.collect.ArrayListMultimap) FileUtilRt(com.intellij.openapi.util.io.FileUtilRt) VirtualFile(com.intellij.openapi.vfs.VirtualFile) ScopedFunction(com.google.idea.blaze.base.scope.ScopedFunction) ExecutionRootPathResolver(com.google.idea.blaze.base.sync.workspace.ExecutionRootPathResolver) BlazeProjectData(com.google.idea.blaze.base.model.BlazeProjectData) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) Logger(com.intellij.openapi.diagnostic.Logger) Blaze(com.google.idea.blaze.base.settings.Blaze) ImmutableMap(com.google.common.collect.ImmutableMap) CompilerInfoCache(com.jetbrains.cidr.toolchains.CompilerInfoCache) Predicate(java.util.function.Predicate) Collection(java.util.Collection) Set(java.util.Set) PrintOutput(com.google.idea.blaze.base.scope.output.PrintOutput) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) FileOperationProvider(com.google.idea.blaze.base.io.FileOperationProvider) CIdeInfo(com.google.idea.blaze.base.ideinfo.CIdeInfo) List(java.util.List) ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) BlazeInfo(com.google.idea.blaze.base.command.info.BlazeInfo) TargetKey(com.google.idea.blaze.base.ideinfo.TargetKey) Queue(java.util.Queue) TargetMap(com.google.idea.blaze.base.ideinfo.TargetMap) BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) HashMap(java.util.HashMap) Callable(java.util.concurrent.Callable) Multimap(com.google.common.collect.Multimap) VfsUtils(com.google.idea.blaze.base.io.VfsUtils) ConcurrentMap(java.util.concurrent.ConcurrentMap) Kind(com.google.idea.blaze.base.model.primitives.Kind) Lists(com.google.common.collect.Lists) ImmutableList(com.google.common.collect.ImmutableList) Scope(com.google.idea.blaze.base.scope.Scope) IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) TargetIdeInfo(com.google.idea.blaze.base.ideinfo.TargetIdeInfo) Project(com.intellij.openapi.project.Project) WorkspacePathResolver(com.google.idea.blaze.base.sync.workspace.WorkspacePathResolver) ProjectViewTargetImportFilter(com.google.idea.blaze.base.sync.projectview.ProjectViewTargetImportFilter) LinkedHashSet(java.util.LinkedHashSet) Nullable(javax.annotation.Nullable) LanguageClass(com.google.idea.blaze.base.model.primitives.LanguageClass) ArtifactLocation(com.google.idea.blaze.base.ideinfo.ArtifactLocation) Maps(com.google.common.collect.Maps) File(java.io.File) CToolchainIdeInfo(com.google.idea.blaze.base.ideinfo.CToolchainIdeInfo) ExecutionException(java.util.concurrent.ExecutionException) BlazeExecutor(com.google.idea.blaze.base.async.executor.BlazeExecutor) Futures(com.google.common.util.concurrent.Futures) ExecutionRootPath(com.google.idea.blaze.base.model.primitives.ExecutionRootPath) TimingScope(com.google.idea.blaze.base.scope.scopes.TimingScope) ArrayDeque(java.util.ArrayDeque) ScopedOperation(com.google.idea.blaze.base.scope.ScopedOperation) EventType(com.google.idea.blaze.base.scope.scopes.TimingScope.EventType) TimingScope(com.google.idea.blaze.base.scope.scopes.TimingScope) ProjectViewTargetImportFilter(com.google.idea.blaze.base.sync.projectview.ProjectViewTargetImportFilter) ConcurrentMap(java.util.concurrent.ConcurrentMap) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) ExecutionException(java.util.concurrent.ExecutionException)

Example 37 with WorkspaceRoot

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

the class BlazeCidrLauncher method createDebugProcess.

@Override
public CidrDebugProcess createDebugProcess(CommandLineState state, XDebugSession session) throws ExecutionException {
    TargetExpression target = configuration.getTarget();
    if (target == null) {
        throw new ExecutionException("Cannot parse run configuration target.");
    }
    if (runner.executableToDebug == null) {
        throw new ExecutionException("No debug binary found.");
    }
    WorkspaceRoot workspaceRoot = WorkspaceRoot.fromProject(project);
    GeneralCommandLine commandLine = new GeneralCommandLine(runner.executableToDebug.getPath());
    File workingDir = workspaceRoot.directory();
    commandLine.setWorkDirectory(workingDir);
    commandLine.addParameters(handlerState.getExeFlagsState().getExpandedFlags());
    EnvironmentVariablesData envState = handlerState.getEnvVarsState().getData();
    commandLine.withParentEnvironmentType(envState.isPassParentEnvs() ? ParentEnvironmentType.SYSTEM : ParentEnvironmentType.NONE);
    commandLine.getEnvironment().putAll(envState.getEnvs());
    if (Kind.CC_TEST.equals(configuration.getTargetKind())) {
        convertBlazeTestFilterToExecutableFlag().ifPresent(commandLine::addParameters);
    }
    TrivialInstaller installer = new TrivialInstaller(commandLine);
    ImmutableList<String> startupCommands = getGdbStartupCommands(workingDir);
    CLionRunParameters parameters = new CLionRunParameters(new BlazeGDBDriverConfiguration(project, startupCommands, workspaceRoot), installer);
    state.setConsoleBuilder(createConsoleBuilder(null));
    state.addConsoleFilters(getConsoleFilters().toArray(new Filter[0]));
    return new CidrLocalDebugProcess(parameters, session, state.getConsoleBuilder());
}
Also used : CLionRunParameters(com.jetbrains.cidr.cpp.execution.CLionRunParameters) CidrLocalDebugProcess(com.jetbrains.cidr.execution.debugger.CidrLocalDebugProcess) TrivialInstaller(com.jetbrains.cidr.execution.TrivialInstaller) TargetExpression(com.google.idea.blaze.base.model.primitives.TargetExpression) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) EnvironmentVariablesData(com.intellij.execution.configuration.EnvironmentVariablesData) UrlFilter(com.intellij.execution.filters.UrlFilter) IssueOutputFilter(com.google.idea.blaze.base.issueparser.IssueOutputFilter) Filter(com.intellij.execution.filters.Filter) BlazeTargetFilter(com.google.idea.blaze.base.run.filter.BlazeTargetFilter) GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) ExecutionException(com.intellij.execution.ExecutionException) File(java.io.File)

Example 38 with WorkspaceRoot

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

the class SourceDirectoryCalculator method calculateJavaSourceDirectories.

/**
 * Adds the java source directories.
 */
private void calculateJavaSourceDirectories(BlazeContext context, WorkspaceRoot workspaceRoot, ArtifactLocationDecoder artifactLocationDecoder, WorkspacePath directoryRoot, Collection<SourceArtifact> javaArtifacts, Collection<JavaPackageReader> javaPackageReaders, Collection<BlazeSourceDirectory> result) {
    List<SourceRoot> sourceRootsPerFile = Lists.newArrayList();
    // Get java sources
    List<ListenableFuture<SourceRoot>> sourceRootFutures = Lists.newArrayList();
    for (final SourceArtifact sourceArtifact : javaArtifacts) {
        ListenableFuture<SourceRoot> future = executorService.submit(() -> sourceRootForJavaSource(context, artifactLocationDecoder, sourceArtifact, javaPackageReaders));
        sourceRootFutures.add(future);
    }
    try {
        for (SourceRoot sourceRoot : Futures.allAsList(sourceRootFutures).get()) {
            if (sourceRoot != null) {
                sourceRootsPerFile.add(sourceRoot);
            }
        }
    } catch (ExecutionException | InterruptedException e) {
        logger.error(e);
        throw new IllegalStateException("Could not read sources");
    }
    // Sort source roots into their respective directories
    Map<WorkspacePath, Multiset<SourceRoot>> sourceDirectoryToSourceRoots = new HashMap<>();
    for (SourceRoot sourceRoot : sourceRootsPerFile) {
        sourceDirectoryToSourceRoots.computeIfAbsent(sourceRoot.workspacePath, k -> HashMultiset.create()).add(sourceRoot);
    }
    // Create a mapping from directory to package prefix
    Map<WorkspacePath, SourceRoot> workspacePathToSourceRoot = Maps.newHashMap();
    for (WorkspacePath workspacePath : sourceDirectoryToSourceRoots.keySet()) {
        Multiset<SourceRoot> sources = sourceDirectoryToSourceRoots.get(workspacePath);
        Multiset<String> packages = HashMultiset.create();
        for (Multiset.Entry<SourceRoot> entry : sources.entrySet()) {
            packages.setCount(entry.getElement().packagePrefix, entry.getCount());
        }
        final String directoryPackagePrefix;
        // Common case -- all source files agree on a single package
        if (packages.elementSet().size() == 1) {
            directoryPackagePrefix = packages.elementSet().iterator().next();
        } else {
            String preferredPackagePrefix = PackagePrefixCalculator.packagePrefixOf(workspacePath);
            directoryPackagePrefix = pickMostFrequentlyOccurring(packages, preferredPackagePrefix);
        }
        SourceRoot candidateRoot = new SourceRoot(workspacePath, directoryPackagePrefix);
        workspacePathToSourceRoot.put(workspacePath, candidateRoot);
    }
    // Add content entry base if it doesn't exist
    if (!workspacePathToSourceRoot.containsKey(directoryRoot)) {
        SourceRoot candidateRoot = new SourceRoot(directoryRoot, PackagePrefixCalculator.packagePrefixOf(directoryRoot));
        workspacePathToSourceRoot.put(directoryRoot, candidateRoot);
    }
    // First, create a graph of the directory structure from root to each source file
    Map<WorkspacePath, SourceRootDirectoryNode> sourceRootDirectoryNodeMap = Maps.newHashMap();
    SourceRootDirectoryNode rootNode = new SourceRootDirectoryNode(directoryRoot, null);
    sourceRootDirectoryNodeMap.put(directoryRoot, rootNode);
    for (SourceRoot sourceRoot : workspacePathToSourceRoot.values()) {
        final String sourcePathRelativeToDirectoryRoot = sourcePathRelativeToDirectoryRoot(directoryRoot, sourceRoot.workspacePath);
        List<String> pathComponents = !Strings.isNullOrEmpty(sourcePathRelativeToDirectoryRoot) ? PATH_SPLITTER.splitToList(sourcePathRelativeToDirectoryRoot) : ImmutableList.of();
        SourceRootDirectoryNode previousNode = rootNode;
        for (int i = 0; i < pathComponents.size(); ++i) {
            final WorkspacePath workspacePath = getWorkspacePathFromPathComponents(directoryRoot, pathComponents, i + 1);
            SourceRootDirectoryNode node = sourceRootDirectoryNodeMap.get(workspacePath);
            if (node == null) {
                node = new SourceRootDirectoryNode(workspacePath, pathComponents.get(i));
                sourceRootDirectoryNodeMap.put(workspacePath, node);
                previousNode.children.add(node);
            }
            previousNode = node;
        }
    }
    // Add package prefix votes at each directory node
    for (SourceRoot sourceRoot : workspacePathToSourceRoot.values()) {
        final String sourcePathRelativeToDirectoryRoot = sourcePathRelativeToDirectoryRoot(directoryRoot, sourceRoot.workspacePath);
        List<String> packageComponents = PACKAGE_SPLITTER.splitToList(sourceRoot.packagePrefix);
        List<String> pathComponents = !Strings.isNullOrEmpty(sourcePathRelativeToDirectoryRoot) ? PATH_SPLITTER.splitToList(sourcePathRelativeToDirectoryRoot) : ImmutableList.of();
        int packageIndex = packageComponents.size();
        int pathIndex = pathComponents.size();
        while (pathIndex >= 0 && packageIndex >= 0) {
            final WorkspacePath workspacePath = getWorkspacePathFromPathComponents(directoryRoot, pathComponents, pathIndex);
            SourceRootDirectoryNode node = sourceRootDirectoryNodeMap.get(workspacePath);
            String packagePrefix = PACKAGE_JOINER.join(packageComponents.subList(0, packageIndex));
            // Otherwise just add a vote
            if (sourceRoot.workspacePath.equals(workspacePath)) {
                node.forcedPackagePrefix = packagePrefix;
            } else {
                node.packagePrefixVotes.add(packagePrefix);
            }
            String pathComponent = pathIndex > 0 ? pathComponents.get(pathIndex - 1) : "";
            String packageComponent = packageIndex > 0 ? packageComponents.get(packageIndex - 1) : "";
            if (!pathComponent.equals(packageComponent)) {
                break;
            }
            --packageIndex;
            --pathIndex;
        }
    }
    Map<WorkspacePath, SourceRoot> sourceRoots = Maps.newHashMap();
    SourceRootDirectoryNode root = sourceRootDirectoryNodeMap.get(directoryRoot);
    visitDirectoryNode(sourceRoots, root, null);
    for (SourceRoot sourceRoot : sourceRoots.values()) {
        result.add(BlazeSourceDirectory.builder(workspaceRoot.fileForPath(sourceRoot.workspacePath)).setPackagePrefix(sourceRoot.packagePrefix).setGenerated(false).build());
    }
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) ArrayListMultimap(com.google.common.collect.ArrayListMultimap) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) TransientExecutor(com.google.idea.blaze.base.async.executor.TransientExecutor) BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Multiset(com.google.common.collect.Multiset) HashMap(java.util.HashMap) Multimap(com.google.common.collect.Multimap) Strings(com.google.common.base.Strings) Lists(com.google.common.collect.Lists) ImmutableList(com.google.common.collect.ImmutableList) HashMultiset(com.google.common.collect.HashMultiset) Scope(com.google.idea.blaze.base.scope.Scope) Map(java.util.Map) IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) Project(com.intellij.openapi.project.Project) Objects(com.google.common.base.Objects) Logger(com.intellij.openapi.diagnostic.Logger) Splitter(com.google.common.base.Splitter) Nullable(javax.annotation.Nullable) ImportRoots(com.google.idea.blaze.base.sync.projectview.ImportRoots) ArtifactLocation(com.google.idea.blaze.base.ideinfo.ArtifactLocation) Predicate(java.util.function.Predicate) Collection(java.util.Collection) Set(java.util.Set) Maps(com.google.common.collect.Maps) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) File(java.io.File) ExecutionException(java.util.concurrent.ExecutionException) BlazeContentEntry(com.google.idea.blaze.java.sync.model.BlazeContentEntry) Futures(com.google.common.util.concurrent.Futures) List(java.util.List) TimingScope(com.google.idea.blaze.base.scope.scopes.TimingScope) BlazeSourceDirectory(com.google.idea.blaze.java.sync.model.BlazeSourceDirectory) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) TargetKey(com.google.idea.blaze.base.ideinfo.TargetKey) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) Comparator(java.util.Comparator) ArtifactLocationDecoder(com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder) PackagePrefixCalculator(com.google.idea.blaze.base.util.PackagePrefixCalculator) Collections(java.util.Collections) Joiner(com.google.common.base.Joiner) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) EventType(com.google.idea.blaze.base.scope.scopes.TimingScope.EventType) HashMap(java.util.HashMap) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Multiset(com.google.common.collect.Multiset) HashMultiset(com.google.common.collect.HashMultiset) ExecutionException(java.util.concurrent.ExecutionException)

Example 39 with WorkspaceRoot

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

the class BlazeApkBuildStepMobileInstall method build.

@Override
public boolean build(BlazeContext context, BlazeAndroidDeviceSelector.DeviceSession deviceSession) {
    ScopedTask<Void> buildTask = new ScopedTask<Void>(context) {

        @Override
        protected Void execute(BlazeContext context) {
            DeviceFutures deviceFutures = deviceSession.deviceFutures;
            assert deviceFutures != null;
            IDevice device = resolveDevice(context, deviceFutures);
            if (device == null) {
                return null;
            }
            BlazeCommand.Builder command = BlazeCommand.builder(Blaze.getBuildSystemProvider(project).getBinaryPath(), BlazeCommandName.MOBILE_INSTALL);
            command.addBlazeFlags(BlazeFlags.DEVICE, device.getSerialNumber());
            // Redundant, but we need this to get around bug in bazel.
            // https://github.com/bazelbuild/bazel/issues/4922
            command.addBlazeFlags(BlazeFlags.ADB_ARG + "-s ", BlazeFlags.ADB_ARG + device.getSerialNumber());
            if (USE_SDK_ADB.getValue()) {
                File adb = AndroidSdkUtils.getAdb(project);
                if (adb != null) {
                    command.addBlazeFlags(BlazeFlags.ADB, adb.toString());
                }
            }
            WorkspaceRoot workspaceRoot = WorkspaceRoot.fromProject(project);
            BlazeApkDeployInfoProtoHelper deployInfoHelper = new BlazeApkDeployInfoProtoHelper(project, blazeFlags);
            BuildResultHelper buildResultHelper = deployInfoHelper.getBuildResultHelper();
            command.addTargets(label).addBlazeFlags(blazeFlags).addBlazeFlags(buildResultHelper.getBuildFlags()).addBlazeFlags("--output_groups=android_deploy_info").addExeFlags(exeFlags);
            SaveUtil.saveAllFiles();
            int retVal = ExternalTask.builder(workspaceRoot).addBlazeCommand(command.build()).context(context).stderr(LineProcessingOutputStream.of(BlazeConsoleLineProcessorProvider.getAllStderrLineProcessors(context))).build().run();
            FileCaches.refresh(project);
            if (retVal != 0) {
                context.setHasError();
                return null;
            }
            deployInfo = deployInfoHelper.readDeployInfo(context);
            if (deployInfo == null) {
                IssueOutput.error("Could not read apk deploy info from build").submit(context);
            }
            return null;
        }
    };
    ListenableFuture<Void> buildFuture = ProgressiveTaskWithProgressIndicator.builder(project).setTitle(String.format("Executing %s apk build", Blaze.buildSystemName(project))).submitTaskWithResult(buildTask);
    try {
        Futures.get(buildFuture, ExecutionException.class);
    } catch (ExecutionException e) {
        context.setHasError();
    } catch (CancellationException e) {
        context.setCancelled();
    }
    return context.shouldContinue();
}
Also used : BlazeCommand(com.google.idea.blaze.base.command.BlazeCommand) IDevice(com.android.ddmlib.IDevice) DeviceFutures(com.android.tools.idea.run.DeviceFutures) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) ScopedTask(com.google.idea.blaze.base.scope.ScopedTask) BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) BuildResultHelper(com.google.idea.blaze.base.command.buildresult.BuildResultHelper) BlazeApkDeployInfoProtoHelper(com.google.idea.blaze.android.run.deployinfo.BlazeApkDeployInfoProtoHelper) CancellationException(java.util.concurrent.CancellationException) ExecutionException(com.intellij.execution.ExecutionException) UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException) File(java.io.File)

Example 40 with WorkspaceRoot

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

the class PrefetchServiceImpl method prefetchProjectFiles.

@Override
public ListenableFuture<?> prefetchProjectFiles(Project project, ProjectViewSet projectViewSet, @Nullable BlazeProjectData blazeProjectData) {
    BlazeImportSettings importSettings = BlazeImportSettingsManager.getInstance(project).getImportSettings();
    if (importSettings == null) {
        return Futures.immediateFuture(null);
    }
    WorkspaceRoot workspaceRoot = WorkspaceRoot.fromImportSettings(importSettings);
    if (!FileOperationProvider.getInstance().exists(workspaceRoot.directory())) {
        // quick sanity check before trying to prefetch each individual file
        return Futures.immediateFuture(null);
    }
    ImportRoots importRoots = ImportRoots.builder(workspaceRoot, importSettings.getBuildSystem()).add(projectViewSet).build();
    Set<File> sourceDirectories = new HashSet<>();
    for (WorkspacePath workspacePath : importRoots.rootDirectories()) {
        sourceDirectories.add(workspaceRoot.fileForPath(workspacePath));
    }
    Set<File> excludeDirectories = new HashSet<>();
    for (WorkspacePath workspacePath : importRoots.excludeDirectories()) {
        excludeDirectories.add(workspaceRoot.fileForPath(workspacePath));
    }
    ListenableFuture<?> sourceFilesFuture = prefetchFiles(project, excludeDirectories, sourceDirectories, /* refetchCachedFiles */
    false, /* fetchFileTypes */
    true);
    Set<File> externalFiles = new HashSet<>();
    if (blazeProjectData != null) {
        for (PrefetchFileSource fileSource : PrefetchFileSource.EP_NAME.getExtensions()) {
            fileSource.addFilesToPrefetch(project, projectViewSet, importRoots, blazeProjectData, externalFiles);
        }
    }
    ListenableFuture<?> externalFilesFuture = prefetchFiles(project, externalFiles, false, false);
    return Futures.allAsList(sourceFilesFuture, externalFilesFuture);
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) BlazeImportSettings(com.google.idea.blaze.base.settings.BlazeImportSettings) ImportRoots(com.google.idea.blaze.base.sync.projectview.ImportRoots) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) File(java.io.File) HashSet(java.util.HashSet)

Aggregations

WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)50 File (java.io.File)30 Nullable (javax.annotation.Nullable)23 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)21 BlazeContext (com.google.idea.blaze.base.scope.BlazeContext)19 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)18 ImmutableList (com.google.common.collect.ImmutableList)14 List (java.util.List)13 Project (com.intellij.openapi.project.Project)12 TargetKey (com.google.idea.blaze.base.ideinfo.TargetKey)10 Kind (com.google.idea.blaze.base.model.primitives.Kind)10 VirtualFile (com.intellij.openapi.vfs.VirtualFile)10 Lists (com.google.common.collect.Lists)9 TargetIdeInfo (com.google.idea.blaze.base.ideinfo.TargetIdeInfo)9 ImportRoots (com.google.idea.blaze.base.sync.projectview.ImportRoots)9 Collectors (java.util.stream.Collectors)9 ArtifactLocation (com.google.idea.blaze.base.ideinfo.ArtifactLocation)8 TargetMap (com.google.idea.blaze.base.ideinfo.TargetMap)8 Label (com.google.idea.blaze.base.model.primitives.Label)8 BlazeImportSettings (com.google.idea.blaze.base.settings.BlazeImportSettings)8