use of com.android.ide.common.util.PathString in project intellij by bazelbuild.
the class BlazeModuleSystem method toExternalLibrary.
@Nullable
static ExternalAndroidLibrary toExternalLibrary(Project project, @Nullable AarLibrary library, ArtifactLocationDecoder decoder) {
if (library == null) {
return null;
}
UnpackedAars unpackedAars = UnpackedAars.getInstance(project);
File aarFile = unpackedAars.getAarDir(decoder, library);
if (aarFile == null) {
logger.warn(String.format("Fail to locate AAR file %s. Re-sync the project may solve the problem", library.aarArtifact));
return null;
}
File resFolder = unpackedAars.getResourceDirectory(decoder, library);
PathString resFolderPathString = resFolder == null ? null : new PathString(resFolder);
return new ExternalLibraryImpl(library.key.toString()).withLocation(new PathString(aarFile)).withManifestFile(resFolderPathString == null ? null : resFolderPathString.getParentOrRoot().resolve("AndroidManifest.xml")).withResFolder(resFolderPathString == null ? null : new SelectiveResourceFolder(resFolderPathString, null)).withSymbolFile(resFolderPathString == null ? null : resFolderPathString.getParentOrRoot().resolve("R.txt")).withPackageName(library.resourcePackage);
}
use of com.android.ide.common.util.PathString 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.ide.common.util.PathString 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