use of com.google.idea.blaze.base.bazel.BuildSystemProvider in project intellij by bazelbuild.
the class BlazePackage method hasBlazePackageChild.
public static boolean hasBlazePackageChild(PsiDirectory directory) {
ProjectFileIndex index = ProjectFileIndex.SERVICE.getInstance(directory.getProject());
BuildSystemProvider buildSystemProvider = Blaze.getBuildSystemProvider(directory.getProject());
return hasBlazePackageChild(index, buildSystemProvider, directory);
}
use of com.google.idea.blaze.base.bazel.BuildSystemProvider in project intellij by bazelbuild.
the class ExecutionRootPathResolverTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
ExtensionPoint<BuildSystemProvider> extensionPoint = registerExtensionPoint(BuildSystemProvider.EP_NAME, BuildSystemProvider.class);
extensionPoint.registerExtension(new BazelBuildSystemProvider());
pathResolver = new ExecutionRootPathResolver(BuildSystem.Bazel, WORKSPACE_ROOT, new File(EXECUTION_ROOT), new WorkspacePathResolverImpl(WORKSPACE_ROOT));
}
use of com.google.idea.blaze.base.bazel.BuildSystemProvider in project intellij by bazelbuild.
the class PackageLister method expandPackageTargets.
/**
* Expands all-in-package-recursive wildcard targets into all-in-single-package targets by
* traversing the file system, looking for child blaze packages.
*
* <p>Returns null if directory traversal failed or was cancelled.
*/
@Nullable
static Map<TargetExpression, List<TargetExpression>> expandPackageTargets(BuildSystemProvider provider, BlazeContext context, WorkspacePathResolver pathResolver, Collection<WildcardTargetPattern> wildcardPatterns) {
List<ListenableFuture<Entry<TargetExpression, List<TargetExpression>>>> futures = Lists.newArrayList();
for (WildcardTargetPattern pattern : wildcardPatterns) {
if (!pattern.isRecursive() || pattern.toString().startsWith("-")) {
continue;
}
File dir = pathResolver.resolveToFile(pattern.getBasePackage());
if (!FileOperationProvider.getInstance().isDirectory(dir)) {
continue;
}
futures.add(FetchExecutor.EXECUTOR.submit(() -> {
List<TargetExpression> expandedTargets = new ArrayList<>();
traversePackageRecursively(provider, pathResolver, dir, expandedTargets);
return Maps.immutableEntry(pattern.originalPattern, expandedTargets);
}));
}
if (futures.isEmpty()) {
return ImmutableMap.of();
}
FutureResult<List<Entry<TargetExpression, List<TargetExpression>>>> result = FutureUtil.waitForFuture(context, Futures.allAsList(futures)).withProgressMessage("Expanding wildcard target patterns...").timed("ExpandWildcardTargets", EventType.Other).onError("Expanding wildcard target patterns failed").run();
if (!result.success()) {
return null;
}
return result.result().stream().collect(Collectors.toMap(Entry::getKey, Entry::getValue, (x, y) -> x));
}
Aggregations