use of com.android.tools.idea.gradle.dsl.model.android.sourceSets.SourceDirectoryModel in project android by JetBrains.
the class SourceDirectoryModelTest method testSourceDirectoryEntriesAddAndApply.
public void testSourceDirectoryEntriesAddAndApply() throws Exception {
writeToBuildFile(GRADLE_TEXT);
GradleBuildModel buildModel = getGradleBuildModel();
verifySourceDirectoryEntries(buildModel, 1, 2);
AndroidModel android = buildModel.android();
assertNotNull(android);
SourceSetModel sourceSet = android.sourceSets().get(0);
SourceDirectoryModel java = sourceSet.java();
java.addSrcDir("javaSource3");
java.addInclude("javaInclude3");
java.addExclude("javaExclude3");
SourceDirectoryModel jni = sourceSet.jni();
jni.addSrcDir("jniSource3");
jni.addInclude("jniInclude3");
jni.addExclude("jniExclude3");
verifySourceDirectoryEntries(buildModel, 1, 2, 3);
applyChangesAndReparse(buildModel);
verifySourceDirectoryEntries(buildModel, 1, 2, 3);
}
use of com.android.tools.idea.gradle.dsl.model.android.sourceSets.SourceDirectoryModel 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());
}
Aggregations