本文整理汇总了Java中com.android.build.gradle.api.ApplicationVariant类的典型用法代码示例。如果您正苦于以下问题:Java ApplicationVariant类的具体用法?Java ApplicationVariant怎么用?Java ApplicationVariant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationVariant类属于com.android.build.gradle.api包,在下文中一共展示了ApplicationVariant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LegacyPlaceholderTaskApplicator
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
LegacyPlaceholderTaskApplicator(Project project) throws Exception {
super(project);
method_getOutputs = ApplicationVariant.class.getMethod("getOutputs");
method_getOutputs.setAccessible(true);
method_setResDir = ProcessAndroidResources.class.getMethod("setResDir", File.class);
method_setResDir.setAccessible(true);
}
示例2: writeFeatureFiles
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
private void writeFeatureFiles(final Project project) {
checkProductFlavorsExist(project);
for (ApplicationVariant applicationVariant : getApplicationVariants(project)) {
setupFeaturesSource(project, applicationVariant);
writeFeatureFile(project, applicationVariant);
}
}
示例3: setupFeaturesSource
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
private void setupFeaturesSource(final Project project, final ApplicationVariant applicationVariant) {
final JavaCompile javaCompile = applicationVariant.getJavaCompile();
javaCompile.doFirst(new Action<Task>() {
@Override
public void execute(Task task) {
writeFeatureFile(project, applicationVariant);
}
});
}
示例4: writeFeatureFile
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
private void writeFeatureFile(final Project project, final ApplicationVariant applicationVariant) {
featuresFile(project, applicationVariant).mkdirs();
FeaturesWriter featuresWriter = new FeaturesWriter(getFeatures(project, applicationVariant));
try {
featuresWriter.build().writeTo(featuresFile(project, applicationVariant));
} catch (IOException e) {
throw new GradleException("Failure writing to " + featuresFile(project, applicationVariant), e);
}
}
示例5: getFeatures
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
private Collection<Feature> getFeatures(final Project project, final ApplicationVariant applicationVariant) {
checkOverriddenFeaturesExist(project, applicationVariant);
Collection<Feature> defaultFeatures = new ArrayList<>();
for (FeatureDefinition featureDefinition : getDefaultConfig(project)) {
boolean isEnabled;
if (getOverrides(project, applicationVariant).containsKey(featureDefinition.name())) {
isEnabled = getOverrides(project, applicationVariant).get(featureDefinition.name());
} else {
isEnabled = featureDefinition.enabled();
}
defaultFeatures.add(new Feature(featureDefinition.name(), featureDefinition.description(), isEnabled));
}
return defaultFeatures;
}
示例6: checkOverriddenFeaturesExist
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
private void checkOverriddenFeaturesExist(final Project project, final ApplicationVariant applicationVariant) {
Collection<String> featureNames = getFeatureNames(project);
for (String name : getOverrides(project, applicationVariant).keySet()) {
if (!featureNames.contains(name)) {
throw new GradleException("You cannot have feature overrides for a non-existent feature (" + name +
")");
}
}
}
示例7: getOverrides
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
private Map<String, Boolean> getOverrides(final Project project, final ApplicationVariant applicationVariant) {
ProductFlavorConfig productFlavorConfig = getProductFlavorConfigs(project)
.findByName(applicationVariant.getFlavorName());
if (productFlavorConfig == null) {
return new HashMap<>();
} else {
return getOverrides(productFlavorConfig);
}
}
示例8: getApkFile
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
private File getApkFile(AndroidPublisherExtension publisherExtension) {
String variantName = publisherExtension.getVariantName();
DomainObjectSet<ApplicationVariant> variants = getProject().getExtensions().getByType(AppExtension.class).getApplicationVariants();
ApplicationVariant variant = null;
getLogger().info(String.format("Looking for %s variant in outputs", variantName));
for (ApplicationVariant v : variants) {
getLogger().debug(String.format("Found variant %s", v.getName()));
if (v.getName().equals(variantName)) {
getLogger().debug(String.format("Variant %s will be used", variantName));
variant = v;
break;
}
}
if (variant == null) {
throw new InvalidUserDataException(String.format(
"Cannot find %s variant for android configuration", variantName));
}
for(BaseVariantOutput output : variant.getOutputs()) {
getLogger().debug(String.format("Found output %s (%s)", output.getName(), output.getBaseName()));
if (output!=null) {
getLogger().debug(String.format("Output %s will be used", output.getName()));
return output.getOutputFile();
}
}
throw new InvalidUserDataException(String.format(
"Cannot find APK output file for %s variant", variantName));
}
示例9: getApplicationVariants
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
private Collection<ApplicationVariant> getApplicationVariants(final Project project) {
return findAndroidAppExtension(project).getApplicationVariants();
}
示例10: featuresFile
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
private File featuresFile(final Project project, final ApplicationVariant applicationVariant) {
return new File(project.getBuildDir() + "/generated/source/buildConfig/" + applicationVariant.getDirName());
}
示例11: addVariant
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
@Override
public void addVariant(BaseVariant variant) {
applicationVariantList.add((ApplicationVariant) variant);
}
示例12: apply
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
@Override
public Consumer<BufferedImage> apply(ApplicationVariant variant, File iconFile) {
return new ColorRibbonFilter(variant.getBuildType().getName(), Color.decode(nm));
}
示例13: grayScaleFilter
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
public Consumer<BufferedImage> grayScaleFilter(ApplicationVariant variant, File iconFile) {
return new GrayScaleBuilder().apply(variant, iconFile);
}
示例14: grayRibbonFilter
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
public Consumer<BufferedImage> grayRibbonFilter(ApplicationVariant variant, File iconFile) {
return new GrayRibbonBuilder().apply(variant, iconFile);
}
示例15: yellowRibbonFilter
import com.android.build.gradle.api.ApplicationVariant; //导入依赖的package包/类
public Consumer<BufferedImage> yellowRibbonFilter(ApplicationVariant variant, File iconFile) {
return new YellowRibbonBuilder().apply(variant, iconFile);
}