@Override public void remove(Field field) { Map<String, ClassField> buildConfigFields = productFlavor.getBuildConfigFields(); if (buildConfigFields != null) { buildConfigFields.remove(field.getName()); } }
@Override public String getGroup() { return productFlavor.getDimension(); } };
@Override public String getName() { return productFlavor.getName(); }
/** * Specifies a proguard rule file to be included in the published AAR. * * <p>This proguard rule file will then be used by any application project that consume the AAR * (if proguard is enabled). * * <p>This allows AAR to specify shrinking or obfuscation exclude rules. * * <p>This is only valid for Library project. This is ignored in Application project. */ public void setConsumerProguardFiles(@NonNull Iterable<?> proguardFileIterable) { getConsumerProguardFiles().clear(); consumerProguardFiles(Iterables.toArray(proguardFileIterable, Object.class)); }
@NonNull String name, @NonNull String value) { ClassField alreadyPresent = getBuildConfigFields().get(name); if (alreadyPresent != null) { String flavorName = getName(); if (BuilderConstants.MAIN.equals(flavorName)) { logger.info( addBuildConfigField(new ClassFieldImpl(type, name, value));
/** * Adds a new generated resource. * * <p>This is equivalent to specifying a resource in res/values. * * <p>See <a href="http://developer.android.com/guide/topics/resources/available-resources.html">Resource Types</a>. * * @param type the type of the resource * @param name the name of the resource * @param value the value of the resource */ public void resValue( @NonNull String type, @NonNull String name, @NonNull String value) { ClassField alreadyPresent = getResValues().get(name); if (alreadyPresent != null) { String flavorName = getName(); if (BuilderConstants.MAIN.equals(flavorName)) { logger.info( "DefaultConfig: resValue '{}' value is being replaced: {} -> {}", name, alreadyPresent.getValue(), value); } else { logger.info( "ProductFlavor({}): resValue '{}' value is being replaced: {} -> {}", flavorName, name, alreadyPresent.getValue(), value); } } addResValue(new ClassFieldImpl(type, name, value)); }
/** * Adds several resource configuration filters. * * <p>If a qualifier value is passed, then all other resources using a qualifier of the same * type but of different value will be ignored from the final packaging of the APK. * * <p>For instance, specifying 'hdpi', will ignore all resources using mdpi, xhdpi, etc... * * <p>To package only the localization languages your app includes as string resources, specify * 'auto'. For example, if your app includes string resources for 'values-en' and 'values-fr', * and its dependencies provide 'values-en' and 'values-ja', Gradle packages only the * 'values-en' and 'values-fr' resources from the app and its dependencies. Gradle does not * package 'values-ja' resources in the final APK. */ public void resConfigs(@NonNull String... config) { addResourceConfigurations(config); }
/** * Adds proguard rule files to be included in the published AAR. * * <p>This proguard rule file will then be used by any application project that consume the AAR * (if proguard is enabled). * * <p>This allows AAR to specify shrinking or obfuscation exclude rules. * * <p>This is only valid for Library project. This is ignored in Application project. */ public void consumerProguardFiles(@NonNull Object... proguardFiles) { for (Object proguardFile : proguardFiles) { consumerProguardFile(proguardFile); } }
/** * Adds a resource configuration filter. * * <p>If a qualifier value is passed, then all other resources using a qualifier of the same * type but of different value will be ignored from the final packaging of the APK. * * <p>For instance, specifying 'hdpi', will ignore all resources using mdpi, xhdpi, etc... * * <p>To package only the localization languages your app includes as string resources, specify * 'auto'. For example, if your app includes string resources for 'values-en' and 'values-fr', * and its dependencies provide 'values-en' and 'values-ja', Gradle packages only the * 'values-en' and 'values-fr' resources from the app and its dependencies. Gradle does not * package 'values-ja' resources in the final APK. */ public void resConfig(@NonNull String config) { addResourceConfiguration(config); }
@Override public void add(Field field) { productFlavor.buildConfigField(field.getType(), field.getName(), field.getValue()); }
/** * Adds several resource configuration filters. * * <p>If a qualifier value is passed, then all other resources using a qualifier of the same * type but of different value will be ignored from the final packaging of the APK. * * <p>For instance, specifying 'hdpi', will ignore all resources using mdpi, xhdpi, etc... * * <p>To package only the localization languages your app includes as string resources, specify * 'auto'. For example, if your app includes string resources for 'values-en' and 'values-fr', * and its dependencies provide 'values-en' and 'values-ja', Gradle packages only the * 'values-en' and 'values-fr' resources from the app and its dependencies. Gradle does not * package 'values-ja' resources in the final APK. */ public void resConfigs(@NonNull Collection<String> config) { addResourceConfigurations(config); }
/** * Name of the dimension this product flavor belongs to. Has been replaced by * <code>dimension</code>. */ @Deprecated public String getFlavorDimension() { errorReporter.handleSyncWarning(null, SyncIssue.TYPE_GENERIC, "'flavorDimension' will be removed in a future version of Android Gradle Plugin, " + "it has been replaced by 'dimension'."); return getDimension(); }