use of com.android.builder.model.AndroidLibrary in project atlas by alibaba.
the class AwbBundle method getLibraryJars.
public List<File> getLibraryJars() {
List<File> jars = Lists.newArrayList();
File awbJar = this.getJarFile();
jars.add(awbJar);
List<? extends AndroidLibrary> aarBundles = this.getLibraryDependencies();
if (null != aarBundles) {
for (AndroidLibrary aarBundle : aarBundles) {
if (aarBundle.getJarFile().exists()) {
jars.add(aarBundle.getJarFile());
}
//jars.addAll(aarBundle.getLocalJars());
}
}
Collection<? extends JavaLibrary> javaDependencies = this.getJavaDependencies();
if (null != javaDependencies) {
for (JavaLibrary javaLibrary : javaDependencies) {
if (javaLibrary.getJarFile().exists()) {
jars.add(javaLibrary.getJarFile());
}
}
}
Collection<File> localJars = this.getLocalJars();
if (null != localJars) {
jars.addAll(localJars);
}
return jars;
}
use of com.android.builder.model.AndroidLibrary in project atlas by alibaba.
the class PostProcessManifestTask method getLibManifestDepenendyMap.
public 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 PostProcessManifestTask method getLibManifestMap.
public 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;
}
use of com.android.builder.model.AndroidLibrary in project atlas by alibaba.
the class PreProcessManifestTask method addAwbManifest2Merge.
private void addAwbManifest2Merge() {
AtlasExtension atlasExtension = appVariantContext.getAtlasExtension();
for (final BaseVariantOutputData vod : appVariantContext.getVariantData().getOutputs()) {
ManifestProcessorTask manifestProcessorTask = vod.manifestProcessorTask;
Set<String> notMergedArtifacts = Sets.newHashSet();
if (null != atlasExtension.getManifestOptions() && null != atlasExtension.getManifestOptions().getNotMergedBundles()) {
notMergedArtifacts = atlasExtension.getManifestOptions().getNotMergedBundles();
}
if (manifestProcessorTask instanceof MergeManifests) {
MergeManifests mergeManifests = (MergeManifests) manifestProcessorTask;
VariantScope variantScope = appVariantContext.getScope();
GradleVariantConfiguration config = variantScope.getVariantConfiguration();
AndroidDependencyTree dependencyTree = AtlasBuildContext.androidDependencyTrees.get(config.getFullName());
if (null == dependencyTree) {
throw new StopExecutionException("DependencyTree cannot be null!");
}
List<? extends AndroidLibrary> awbManifests = ManifestDependencyUtil.getManifestDependencies(dependencyTree.getAwbBundles(), notMergedArtifacts, getLogger());
for (AndroidLibrary manifest : awbManifests) {
getLogger().info("[MTLPlugin]Add manifest:" + manifest.getName() + ",path is:" + manifest.getManifest().getAbsolutePath());
}
//FIXME 不加这一步,每次的getibraries 都会从mapping里去重新计算
mergeManifests.setLibraries(mergeManifests.getLibraries());
mergeManifests.getLibraries().addAll(awbManifests);
}
}
}
use of com.android.builder.model.AndroidLibrary in project atlas by alibaba.
the class PrepareAwoBundleTask method doFullTaskAction.
@TaskAction
public void doFullTaskAction() throws IOException {
AwbBundle awbBundle = libVariantContext.getAwbBundle();
prepare(awbBundle.getBundle(), awbBundle.getFolder(), true);
List<SoLibrary> soLibraries = awbBundle.getSoLibraries();
for (final SoLibrary soLibrary : soLibraries) {
prepare(soLibrary.getSoLibFile(), soLibrary.getFolder(), false);
}
List<? extends AndroidLibrary> aarBundles = awbBundle.getLibraryDependencies();
for (final AndroidLibrary libraryDependency : aarBundles) {
if (libraryDependency instanceof AarBundle) {
AarBundle aarBundle = (AarBundle) libraryDependency;
prepare(aarBundle.getBundle(), aarBundle.getFolder(), true);
}
}
}
Aggregations