Search in sources :

Example 1 with BuildTypeModel

use of com.android.tools.idea.gradle.dsl.model.android.BuildTypeModel in project android by JetBrains.

the class GradleValueTest method testGradleValuesOfTypeNameValueElements.

public void testGradleValuesOfTypeNameValueElements() throws Exception {
    String text = "android {\n" + "  defaultConfig {\n" + "    resValue \"abcd\", \"efgh\", \"ijkl\"\n" + "  }\n" + "  buildTypes {\n" + "    xyz {\n" + "      buildConfigField \"mnop\", \"qrst\", \"uvwx\"\n" + "    }\n" + "  }\n" + "}";
    writeToBuildFile(text);
    AndroidModel android = getGradleBuildModel().android();
    assertNotNull(android);
    ProductFlavorModel defaultConfig = android.defaultConfig();
    List<GradleNotNullValue<AbstractFlavorTypeModel.ResValue>> resValues = defaultConfig.resValues();
    assertNotNull(resValues);
    assertThat(resValues).hasSize(1);
    verifyGradleValue(resValues.get(0), "android.defaultConfig.resValue", "\"abcd\", \"efgh\", \"ijkl\"");
    List<BuildTypeModel> buildTypes = android.buildTypes();
    assertThat(buildTypes).hasSize(1);
    List<GradleNotNullValue<BuildTypeModel.BuildConfigField>> buildConfigFields = buildTypes.get(0).buildConfigFields();
    assertNotNull(buildConfigFields);
    assertThat(buildConfigFields).hasSize(1);
    verifyGradleValue(buildConfigFields.get(0), "android.buildTypes.xyz.buildConfigField", "\"mnop\", \"qrst\", \"uvwx\"");
}
Also used : AndroidModel(com.android.tools.idea.gradle.dsl.model.android.AndroidModel) ProductFlavorModel(com.android.tools.idea.gradle.dsl.model.android.ProductFlavorModel) AbstractFlavorTypeModel(com.android.tools.idea.gradle.dsl.model.android.AbstractFlavorTypeModel) BuildTypeModel(com.android.tools.idea.gradle.dsl.model.android.BuildTypeModel)

Aggregations

AbstractFlavorTypeModel (com.android.tools.idea.gradle.dsl.model.android.AbstractFlavorTypeModel)1 AndroidModel (com.android.tools.idea.gradle.dsl.model.android.AndroidModel)1 BuildTypeModel (com.android.tools.idea.gradle.dsl.model.android.BuildTypeModel)1 ProductFlavorModel (com.android.tools.idea.gradle.dsl.model.android.ProductFlavorModel)1