use of com.android.projectmodel.ExternalAndroidLibrary in project intellij by bazelbuild.
the class BlazeModuleSystem method getLibrariesForWorkspaceModule.
private static ImmutableList<ExternalAndroidLibrary> getLibrariesForWorkspaceModule(Project project, BlazeProjectData blazeProjectData) {
ArtifactLocationDecoder decoder = blazeProjectData.getArtifactLocationDecoder();
ExternalLibraryInterner externalLibraryInterner = ExternalLibraryInterner.getInstance(project);
ImmutableList.Builder<ExternalAndroidLibrary> libraries = ImmutableList.builder();
for (BlazeLibrary library : BlazeLibraryCollector.getLibraries(ProjectViewManager.getInstance(project).getProjectViewSet(), blazeProjectData)) {
if (library instanceof AarLibrary) {
ExternalAndroidLibrary externalLibrary = toExternalLibrary(project, (AarLibrary) library, decoder);
if (externalLibrary != null) {
libraries.add(externalLibraryInterner.intern(externalLibrary));
}
}
}
return libraries.build();
}
use of com.android.projectmodel.ExternalAndroidLibrary in project intellij by bazelbuild.
the class BlazeModuleSystem method getDependentLibraries.
public Collection<ExternalAndroidLibrary> getDependentLibraries() {
BlazeProjectData blazeProjectData = BlazeProjectDataManager.getInstance(project).getBlazeProjectData();
if (blazeProjectData == null) {
return ImmutableList.of();
}
if (isWorkspaceModule) {
return SyncCache.getInstance(project).get(BlazeModuleSystem.class, BlazeModuleSystem::getLibrariesForWorkspaceModule);
}
AndroidResourceModuleRegistry registry = AndroidResourceModuleRegistry.getInstance(project);
TargetIdeInfo target = blazeProjectData.getTargetMap().get(registry.getTargetKey(module));
if (target == null) {
// no dependent libraries
return ImmutableList.of();
}
BlazeAndroidSyncData androidSyncData = blazeProjectData.getSyncState().get(BlazeAndroidSyncData.class);
if (androidSyncData == null) {
return ImmutableList.of();
}
ImmutableList.Builder<ExternalAndroidLibrary> libraries = ImmutableList.builder();
ArtifactLocationDecoder decoder = blazeProjectData.getArtifactLocationDecoder();
ExternalLibraryInterner externalLibraryInterner = ExternalLibraryInterner.getInstance(project);
for (String libraryKey : registry.get(module).resourceLibraryKeys) {
ImmutableMap<String, AarLibrary> aarLibraries = androidSyncData.importResult.aarLibraries;
ExternalAndroidLibrary externalLibrary = toExternalLibrary(project, aarLibraries.get(libraryKey), decoder);
if (externalLibrary != null) {
libraries.add(externalLibraryInterner.intern(externalLibrary));
}
}
return libraries.build();
}
use of com.android.projectmodel.ExternalAndroidLibrary in project intellij by bazelbuild.
the class BlazeModuleSystemDependentLibrariesIntegrationTest method getDependencies_workspaceModule.
@Test
public void getDependencies_workspaceModule() {
PathString rootPath = new PathString(workspaceRoot.directory());
Collection<ExternalAndroidLibrary> libraries = workspaceModuleSystem.getDependentLibraries();
assertThat(new ArrayList<>(libraries)).containsExactly(getAarLibrary(rootPath, "third_party/quantum/values-third_party-quantum-res.aar", "third_party.quantum"), getAarLibrary(rootPath, "java/com/google/app-third_party-shared-res.aar", "com.google"), getAarLibrary(rootPath, "third_party/constraint_layout/constraint_layout-third_party-constraint_layout-res.aar", "third_party.constraint_layout"), getAarLibrary(rootPath, "third_party/aar/lib_aar.aar", "third_party.aar"));
}
use of com.android.projectmodel.ExternalAndroidLibrary in project intellij by bazelbuild.
the class BlazeModuleSystemDependentLibrariesIntegrationTest method getDependencies_appModule.
@Test
public void getDependencies_appModule() {
PathString rootPath = new PathString(workspaceRoot.directory());
Collection<ExternalAndroidLibrary> libraries = appModuleSystem.getDependentLibraries();
assertThat(new ArrayList<>(libraries)).containsExactly(getAarLibrary(rootPath, "third_party/aar/lib_aar.aar", "third_party.aar"), getAarLibrary(rootPath, "java/com/google/app-third_party-shared-res.aar", "com.google"), getAarLibrary(rootPath, "third_party/constraint_layout/constraint_layout-third_party-constraint_layout-res.aar", "third_party.constraint_layout"), getAarLibrary(rootPath, "third_party/quantum/values-third_party-quantum-res.aar", "third_party.quantum"));
}
Aggregations