use of com.android.projectmodel.ExternalLibraryImpl in project intellij by bazelbuild.
the class BlazeModuleSystemDependentLibrariesIntegrationTest method getAarLibrary.
private ExternalAndroidLibrary getAarLibrary(PathString rootPath, String aarPath, @Nullable String resourcePackage) {
String path = rootPath.resolve(aarPath).getNativePath();
String name = FileUtil.getNameWithoutExtension(PathUtil.getFileName(path));
String aarDirName = UnpackedAarUtils.generateAarDirectoryName(name, path.hashCode()) + SdkConstants.DOT_AAR;
UnpackedAars unpackedAars = UnpackedAars.getInstance(getProject());
File aarDir = new File(unpackedAars.getCacheDir(), aarDirName);
PathString aarFile = new PathString(aarDir);
PathString resFolder = new PathString(UnpackedAarUtils.getResDir(aarDir));
return new ExternalLibraryImpl(LibraryKey.libraryNameFromArtifactLocation(source(aarPath))).withLocation(aarFile).withManifestFile(resFolder == null ? null : resFolder.getParentOrRoot().resolve("AndroidManifest.xml")).withResFolder(resFolder == null ? null : new SelectiveResourceFolder(resFolder, null)).withSymbolFile(resFolder == null ? null : resFolder.getParentOrRoot().resolve("R.txt")).withPackageName(resourcePackage);
}
use of com.android.projectmodel.ExternalLibraryImpl 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);
}
Aggregations