use of com.google.idea.blaze.base.projectview.ProjectViewSet in project intellij by bazelbuild.
the class BlazeAndroidTestRunConfigurationHandler method createRunner.
@Override
public BlazeCommandRunConfigurationRunner createRunner(Executor executor, ExecutionEnvironment environment) throws ExecutionException {
Project project = environment.getProject();
Module module = getModule();
AndroidFacet facet = module != null ? AndroidFacet.getInstance(module) : null;
ProjectViewSet projectViewSet = ProjectViewManager.getInstance(project).getProjectViewSet();
BlazeAndroidRunConfigurationValidationUtil.validateExecution(module, facet, projectViewSet);
ImmutableList<String> blazeFlags = configState.getCommonState().getExpandedBuildFlags(project, projectViewSet, BlazeCommandName.TEST);
ImmutableList<String> exeFlags = ImmutableList.copyOf(configState.getCommonState().getExeFlagsState().getExpandedFlags());
BlazeAndroidRunContext runContext = createRunContext(project, facet, environment, blazeFlags, exeFlags);
return new BlazeAndroidRunConfigurationRunner(module, runContext, getCommonState().getDeployTargetManager(), getCommonState().getDebuggerManager(), configuration.getUniqueID());
}
use of com.google.idea.blaze.base.projectview.ProjectViewSet in project intellij by bazelbuild.
the class UnpackedAars method onSync.
void onSync(BlazeContext context, ProjectViewSet projectViewSet, BlazeProjectData projectData, BlazeSyncParams.SyncMode syncMode) {
Collection<BlazeLibrary> libraries = BlazeLibraryCollector.getLibraries(projectViewSet, projectData);
boolean fullRefresh = syncMode == SyncMode.FULL;
boolean removeMissingFiles = syncMode == SyncMode.INCREMENTAL;
if (!enabled || fullRefresh) {
clearCache();
}
if (!enabled) {
return;
}
List<AarLibrary> aarLibraries = libraries.stream().filter(library -> library instanceof AarLibrary).map(library -> (AarLibrary) library).collect(Collectors.toList());
ArtifactLocationDecoder artifactLocationDecoder = projectData.artifactLocationDecoder;
BiMap<File, String> sourceAarFileToCacheKey = HashBiMap.create(aarLibraries.size());
BiMap<File, String> sourceJarFileToCacheKey = HashBiMap.create(aarLibraries.size());
for (AarLibrary library : aarLibraries) {
File aarFile = artifactLocationDecoder.decode(library.aarArtifact);
String cacheKey = cacheKeyForAar(aarFile);
sourceAarFileToCacheKey.put(aarFile, cacheKey);
File jarFile = artifactLocationDecoder.decode(library.libraryArtifact.jarForIntellijLibrary());
// Use the aar key for the jar as well.
sourceJarFileToCacheKey.put(jarFile, cacheKey);
}
this.aarTraits = new AarTraits(cacheDir, sourceAarFileToCacheKey);
this.jarTraits = new JarTraits(cacheDir, sourceJarFileToCacheKey);
refresh(context, removeMissingFiles);
}
use of com.google.idea.blaze.base.projectview.ProjectViewSet in project intellij by bazelbuild.
the class ProjectViewParserTest method testRootDirectory.
@Test
public void testRootDirectory() throws Exception {
projectViewStorageManager.add(".blazeproject", "directories:", " .", " -java/com/google/android/notme", "", "targets:", " //java/com/google:all");
projectViewParser.parseProjectView(new File(".blazeproject"));
errorCollector.assertNoIssues();
ProjectViewSet projectViewSet = projectViewParser.getResult();
ProjectViewSet.ProjectViewFile projectViewFile = projectViewSet.getTopLevelProjectViewFile();
assertThat(projectViewFile).isNotNull();
assertThat(projectViewFile.projectViewFile).isEqualTo(new File(".blazeproject"));
assertThat(projectViewSet.getProjectViewFiles()).containsExactly(projectViewFile);
ProjectView projectView = projectViewFile.projectView;
assertThat(projectView.getSectionsOfType(DirectorySection.KEY).get(0).items()).containsExactly(new DirectoryEntry(new WorkspacePath(""), true), new DirectoryEntry(new WorkspacePath("java/com/google/android/notme"), false));
assertThat(projectView.getSectionsOfType(TargetSection.KEY).get(0).items()).containsExactly(TargetExpression.fromStringSafe("//java/com/google:all"));
String text = ProjectViewParser.projectViewToString(projectView);
assertThat(text).isEqualTo(Joiner.on('\n').join("directories:", " .", " -java/com/google/android/notme", "", "targets:", " //java/com/google:all"));
}
use of com.google.idea.blaze.base.projectview.ProjectViewSet in project intellij by bazelbuild.
the class ProjectViewParserTest method testTestSources.
@Test
public void testTestSources() throws Exception {
projectViewStorageManager.add(".blazeproject", "test_sources:", " javatests/com/google", " javatests/com/google/android/*");
projectViewParser.parseProjectView(new File(".blazeproject"));
errorCollector.assertNoIssues();
ProjectViewSet projectViewSet = projectViewParser.getResult();
Collection<Glob> entries = projectViewSet.listItems(TestSourceSection.KEY);
assertThat(entries).containsExactly(new Glob("javatests/com/google"), new Glob("javatests/com/google/android/*")).inOrder();
}
use of com.google.idea.blaze.base.projectview.ProjectViewSet in project intellij by bazelbuild.
the class ProjectViewParserTest method testImport.
@Test
public void testImport() {
projectViewStorageManager.add("/parent.blazeproject", "directories:", " parent", "");
projectViewStorageManager.add(".blazeproject", "import parent.blazeproject", "directories:", " child", "");
projectViewParser.parseProjectView(new File(".blazeproject"));
errorCollector.assertNoIssues();
ProjectViewSet projectViewSet = projectViewParser.getResult();
assertThat(projectViewSet.getProjectViewFiles()).hasSize(2);
Collection<DirectoryEntry> entries = projectViewSet.listItems(DirectorySection.KEY);
assertThat(entries).containsExactly(new DirectoryEntry(new WorkspacePath("parent"), true), new DirectoryEntry(new WorkspacePath("child"), true));
}
Aggregations