use of com.android.builder.model.AndroidLibrary in project atlas by alibaba.
the class ManifestHelper method getManifestDependencies.
public static List<? extends AndroidLibrary> getManifestDependencies(List<AwbBundle> awbBundles, Set<String> notMergedArtifacts, org.gradle.api.logging.Logger logger) {
List<AndroidLibrary> list = new ArrayList<>();
for (AwbBundle lib : awbBundles) {
// get the dependencies
// [vliux] respect manifestOption.notMergedBundle
String cord = String.format("%s:%s", lib.getResolvedCoordinates().getGroupId(), lib.getResolvedCoordinates().getArtifactId());
if (null == notMergedArtifacts || !notMergedArtifacts.contains(cord)) {
list.add(lib.getAndroidLibrary());
list.addAll(lib.getAndroidLibraries());
} else {
logger.info("[NotMergedManifest] " + cord);
}
}
return list;
}
use of com.android.builder.model.AndroidLibrary in project atlas by alibaba.
the class ManifestHelper method getMainDexManifest.
public static List<ManifestProvider> getMainDexManifest(AppVariantContext appVariantContext, AtlasDependencyTree dependencyTree, AtlasExtension atlasExtension) {
Set<String> notMergedArtifacts = getNotMergedBundles(atlasExtension);
List<ManifestProvider> mainProviders = new ArrayList<>();
for (AndroidLibrary androidLibrary : dependencyTree.getMainBundle().getAndroidLibraries()) {
String cord = String.format("%s:%s", androidLibrary.getResolvedCoordinates().getGroupId(), androidLibrary.getResolvedCoordinates().getArtifactId());
if (null != notMergedArtifacts && notMergedArtifacts.contains(cord)) {
continue;
}
mainProviders.add(createManifestProvider(androidLibrary, appVariantContext));
}
return mainProviders;
}
use of com.android.builder.model.AndroidLibrary in project atlas by alibaba.
the class ManifestHelper method collectBundleInfo.
public static void collectBundleInfo(AppVariantContext appVariantContext, BundleInfo bundleInfo, File manifest, List<AndroidLibrary> androidLibraries) throws DocumentException {
SAXReader reader = new SAXReader();
// Read the XML file
Document document = reader.read(getModifyManifestFile(manifest, appVariantContext));
// Get the root node
Element root = document.getRootElement();
List<? extends Node> metadataNodes = root.selectNodes("//meta-data");
for (Node node : metadataNodes) {
Element element = (Element) node;
Attribute attribute = element.attribute("name");
if (attribute.getValue().equals("label")) {
Attribute labelAttribute = element.attribute("value");
bundleInfo.setName(labelAttribute.getValue());
} else if (attribute.getValue().equals("description")) {
Attribute descAttribute = element.attribute("value");
bundleInfo.setDesc(descAttribute.getValue());
} else if (attribute.getValue().startsWith("atlas.fragment.intent.action.")) {
bundleInfo.getRemoteFragments().put(attribute.getValue(), element.attribute("value").getValue());
} else if (attribute.getValue().startsWith("atlas.view.intent.action")) {
bundleInfo.getRemoteViews().put(attribute.getValue(), element.attribute("value").getValue());
} else if (attribute.getValue().startsWith("atlas.transaction.intent.action")) {
bundleInfo.getRemoteTransactors().put(attribute.getValue(), element.attribute("value").getValue());
}
}
addComponents(bundleInfo, root);
if (null != androidLibraries) {
for (AndroidLibrary depLib : androidLibraries) {
SAXReader reader2 = new SAXReader();
Document document2 = reader2.read(// Read the XML file
getModifyManifestFile(depLib.getManifest(), appVariantContext));
// Get the root node
Element root2 = document2.getRootElement();
addComponents(bundleInfo, root2);
}
}
}
use of com.android.builder.model.AndroidLibrary in project atlas by alibaba.
the class PostProcessManifestAction method getLibManifestDepenendyMap.
private Multimap<String, File> getLibManifestDepenendyMap() {
Multimap<String, File> maps = HashMultimap.create();
List<? extends AndroidLibrary> libs = getAwbLibraries();
if (libs == null || libs.isEmpty()) {
return maps;
}
for (AndroidLibrary mdi : libs) {
for (AndroidLibrary childLib : mdi.getLibraryDependencies()) {
((HashMultimap<String, File>) maps).put(mdi.getName(), childLib.getManifest());
}
}
return maps;
}
use of com.android.builder.model.AndroidLibrary in project atlas by alibaba.
the class PostProcessManifestAction method getLibManifestMap.
private Map<String, File> getLibManifestMap() {
Map<String, File> maps = Maps.newHashMap();
List<? extends AndroidLibrary> libs = getAwbLibraries();
if (libs == null || libs.isEmpty()) {
return Collections.emptyMap();
}
for (AndroidLibrary mdi : libs) {
((HashMap<String, File>) maps).put(mdi.getName(), mdi.getManifest());
}
return maps;
}
Aggregations