Search in sources :

Example 1 with SourceFileModel

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

the class SourceSetModel method manifest.

@NotNull
public SourceFileModel manifest() {
    SourceFileDslElement manifest = myDslElement.getPropertyElement(MANIFEST, SourceFileDslElement.class);
    if (manifest == null) {
        manifest = new SourceFileDslElement(myDslElement, MANIFEST);
        myDslElement.setNewElement(MANIFEST, manifest);
    }
    return new SourceFileModel(manifest);
}
Also used : SourceFileModel(com.android.tools.idea.gradle.dsl.model.android.sourceSets.SourceFileModel) SourceFileDslElement(com.android.tools.idea.gradle.dsl.parser.android.sourceSets.SourceFileDslElement) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with SourceFileModel

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

the class SourceFileModelTest method verifySourceFile.

private static void verifySourceFile(@NotNull GradleBuildModel buildModel, @Nullable String srcFile) {
    AndroidModel android = buildModel.android();
    assertNotNull(android);
    assertTrue(android.hasValidPsiElement());
    List<SourceSetModel> sourceSets = android.sourceSets();
    assertThat(sourceSets).hasSize(1);
    SourceSetModel sourceSet = sourceSets.get(0);
    assertEquals("name", "main", sourceSet.name());
    SourceFileModel manifest = sourceSet.manifest();
    assertNotNull(manifest);
    assertEquals("srcFile", srcFile, manifest.srcFile());
}
Also used : SourceFileModel(com.android.tools.idea.gradle.dsl.model.android.sourceSets.SourceFileModel)

Example 3 with SourceFileModel

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

the class SourceSetModelTest method verifySourceSet.

private static void verifySourceSet(SourceSetModel sourceSet, boolean savedToFile) {
    SourceDirectoryModel aidl = sourceSet.aidl();
    assertEquals("name", "aidl", aidl.name());
    assertThat(aidl.srcDirs()).hasSize(1);
    assertEquals(savedToFile, aidl.hasValidPsiElement());
    SourceDirectoryModel assets = sourceSet.assets();
    assertEquals("name", "assets", assets.name());
    assertThat(assets.srcDirs()).hasSize(1);
    assertEquals(savedToFile, aidl.hasValidPsiElement());
    SourceDirectoryModel java = sourceSet.java();
    assertEquals("name", "java", java.name());
    assertThat(java.srcDirs()).hasSize(1);
    assertEquals(savedToFile, java.hasValidPsiElement());
    SourceDirectoryModel jni = sourceSet.jni();
    assertEquals("name", "jni", jni.name());
    assertThat(jni.srcDirs()).hasSize(1);
    assertEquals(savedToFile, java.hasValidPsiElement());
    SourceDirectoryModel jniLibs = sourceSet.jniLibs();
    assertEquals("name", "jniLibs", jniLibs.name());
    assertThat(jniLibs.srcDirs()).hasSize(1);
    assertEquals(savedToFile, jniLibs.hasValidPsiElement());
    SourceFileModel manifest = sourceSet.manifest();
    assertEquals("name", "manifest", manifest.name());
    assertNotNull(manifest.srcFile());
    assertEquals(savedToFile, manifest.hasValidPsiElement());
    SourceDirectoryModel renderscript = sourceSet.renderscript();
    assertEquals("name", "renderscript", renderscript.name());
    assertThat(renderscript.srcDirs()).hasSize(1);
    assertEquals(savedToFile, renderscript.hasValidPsiElement());
    SourceDirectoryModel res = sourceSet.res();
    assertEquals("name", "res", res.name());
    assertThat(res.srcDirs()).hasSize(1);
    assertEquals(savedToFile, res.hasValidPsiElement());
    SourceDirectoryModel resources = sourceSet.resources();
    assertEquals("name", "resources", resources.name());
    assertThat(resources.srcDirs()).hasSize(1);
    assertEquals(savedToFile, resources.hasValidPsiElement());
}
Also used : SourceFileModel(com.android.tools.idea.gradle.dsl.model.android.sourceSets.SourceFileModel) SourceDirectoryModel(com.android.tools.idea.gradle.dsl.model.android.sourceSets.SourceDirectoryModel)

Aggregations

SourceFileModel (com.android.tools.idea.gradle.dsl.model.android.sourceSets.SourceFileModel)3 SourceDirectoryModel (com.android.tools.idea.gradle.dsl.model.android.sourceSets.SourceDirectoryModel)1 SourceFileDslElement (com.android.tools.idea.gradle.dsl.parser.android.sourceSets.SourceFileDslElement)1 NotNull (org.jetbrains.annotations.NotNull)1