use of com.android.build.gradle.api.ApkVariantOutput in project atlas by alibaba.
the class PreProcessManifestAction method modifyForIncremental.
private void modifyForIncremental(MergeManifests mergeManifests, List<ManifestProvider> allManifest) {
if (appVariantContext.getAtlasExtension().getTBuildConfig().isIncremental()) {
File mainManifest = mergeManifests.getMainManifest();
File baseManifest = appVariantContext.apContext.getBaseModifyManifest();
// allManifest.add(new ManifestHelper.MainManifestProvider(mainManifest, "main-manifest"));
ConventionMappingHelper.map(mergeManifests, "mainManifest", new Callable<File>() {
@Override
public File call() throws Exception {
return baseManifest;
}
});
if (baseVariantOutput instanceof ApkVariantOutput) {
// TODO Improve performance
ApkVariantOutput variantOutputData = (ApkVariantOutput) baseVariantOutput;
DefaultManifestParser manifestParser = new DefaultManifestParser(baseManifest);
String versionNameOverride = variantOutputData.getVersionNameOverride();
if (Strings.isNullOrEmpty(versionNameOverride)) {
variantOutputData.setVersionNameOverride(manifestParser.getVersionName());
GradleVariantConfiguration variantConfiguration = appVariantContext.getScope().getVariantConfiguration();
ProductFlavor mergedFlavor = variantConfiguration.getMergedFlavor();
String versionName = mergedFlavor.getVersionName();
if (versionName == null) {
((DefaultProductFlavor) mergedFlavor).setVersionName(manifestParser.getVersionName());
}
}
int versionCodeOverride = variantOutputData.getVersionCodeOverride();
if (versionCodeOverride == -1) {
variantOutputData.setVersionCodeOverride(manifestParser.getVersionCode());
}
}
}
}
Aggregations