use of com.android.builder.model.ProductFlavor in project meghanada-server by mopemope.
the class AndroidSupport method getAndroidSources.
private Map<String, Set<File>> getAndroidSources(ProductFlavorContainer defaultConfig) {
Map<String, Set<File>> sources = new HashMap<>();
ProductFlavor productFlavor = defaultConfig.getProductFlavor();
String name = productFlavor.getName();
SourceProvider sourceProvider = defaultConfig.getSourceProvider();
AndroidSupport.setAndroidSources(sources, sourceProvider, false);
// extra
Collection<SourceProviderContainer> extraSourceProviders = defaultConfig.getExtraSourceProviders();
extraSourceProviders.forEach(sourceProviderContainer -> {
String artifactName = sourceProviderContainer.getArtifactName();
SourceProvider provider = sourceProviderContainer.getSourceProvider();
boolean isTest = artifactName.contains(TEST_SUFFIX);
AndroidSupport.setAndroidSources(sources, provider, isTest);
});
return sources;
}
use of com.android.builder.model.ProductFlavor 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