use of com.android.manifmerger.ManifestProvider in project atlas by alibaba.
the class AwbBundle method getManifestProviders.
public List<ManifestProvider> getManifestProviders() {
if (null != _cacheManifestProviders) {
return _cacheManifestProviders;
}
_cacheManifestProviders = new ArrayList<>();
List<AndroidLibrary> androidLibraries = new ArrayList<>(getAndroidLibraries());
androidLibraries.add(getAndroidLibrary());
for (AndroidLibrary androidLibrary : androidLibraries) {
_cacheManifestProviders.add(new ManifestProvider() {
@Override
public File getManifest() {
return androidLibrary.getManifest();
}
@Override
public String getName() {
return androidLibrary.getName();
}
});
}
return _cacheManifestProviders;
}
use of com.android.manifmerger.ManifestProvider in project atlas by alibaba.
the class ManifestHelper method convert.
public static List<ManifestProvider> convert(List<ManifestProvider> manifestProviders, AppVariantContext appVariantContext) {
List<ManifestProvider> modifyManifest = new ArrayList<>();
for (ManifestProvider manifestProvider : manifestProviders) {
File manifest = getModifyManifestFile(manifestProvider.getManifest(), appVariantContext);
modifyManifest.add(new MainManifestProvider(manifest, manifestProvider.getName()));
}
return modifyManifest;
}
use of com.android.manifmerger.ManifestProvider in project atlas by alibaba.
the class ManifestHelper method getBundleManifest.
public static List<ManifestProvider> getBundleManifest(AppVariantContext appVariantContext, AtlasDependencyTree dependencyTree, AtlasExtension atlasExtension) {
Set<String> notMergedArtifacts = getNotMergedBundles(atlasExtension);
List<ManifestProvider> bundleProviders = new ArrayList<>();
for (AwbBundle awbBundle : dependencyTree.getAwbBundles()) {
String cord = String.format("%s:%s", awbBundle.getResolvedCoordinates().getGroupId(), awbBundle.getResolvedCoordinates().getArtifactId());
if (null != notMergedArtifacts && notMergedArtifacts.contains(cord)) {
continue;
}
bundleProviders.add(createManifestProvider(awbBundle.getAndroidLibrary(), appVariantContext));
for (AndroidLibrary androidLibrary : awbBundle.getAndroidLibraries()) {
bundleProviders.add(createManifestProvider(androidLibrary, appVariantContext));
}
}
return bundleProviders;
}
use of com.android.manifmerger.ManifestProvider 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.manifmerger.ManifestProvider in project atlas by alibaba.
the class FeatureLibManifestTask method taskAction.
@TaskAction
public void taskAction() throws DocumentException, IOException {
mainManifestFile = variantConfiguration.getMainManifest();
ManifestInfo mainManifestFileObject = getManifestFileObject(mainManifestFile);
final Set<ResolvedArtifactResult> artifacts = manifests.getArtifacts();
List<ManifestProvider> providers = Lists.newArrayListWithCapacity(artifacts.size() + 2);
for (ResolvedArtifactResult artifact : artifacts) {
File manifestFile = artifact.getFile();
File modifyManifest = featureVariantContext.getModifiedManifest(artifact);
ManifestFileUtils.updatePreProcessManifestFile(modifyManifest, manifestFile, mainManifestFileObject, true, featureVariantContext.getAtlasExtension().getTBuildConfig().isIncremental());
providers.add(new MergeManifests.ConfigAction.ManifestProviderImpl(modifyManifest, MergeManifests.getArtifactName(artifact)));
}
if (featureManifests != null) {
final Set<ResolvedArtifactResult> featureArtifacts = featureManifests.getArtifacts();
for (ResolvedArtifactResult artifact : featureArtifacts) {
File directory = artifact.getFile();
File modifyManifest = featureVariantContext.getModifiedManifest(artifact);
Collection<BuildOutput> splitOutputs = BuildOutputs.load(VariantScope.TaskOutputType.MERGED_MANIFESTS, directory);
if (splitOutputs.isEmpty()) {
throw new GradleException("Could not load manifest from " + directory);
}
ManifestFileUtils.updatePreProcessManifestFile(modifyManifest, splitOutputs.iterator().next().getOutputFile(), mainManifestFileObject, true, featureVariantContext.getAtlasExtension().getTBuildConfig().isIncremental());
providers.add(new MergeManifests.ConfigAction.ManifestProviderImpl(modifyManifest, MergeManifests.getArtifactName(artifact)));
}
}
AtlasBuildContext.androidBuilderMap.get(getProject()).manifestProviders = providers;
}
Aggregations