use of com.android.tools.idea.gradle.dsl.model.android.sourceSets.SourceDirectoryModel in project android by JetBrains.
the class SourceSetModel method jni.
@NotNull
public SourceDirectoryModel jni() {
SourceDirectoryDslElement jni = myDslElement.getPropertyElement(JNI, SourceDirectoryDslElement.class);
if (jni == null) {
jni = new SourceDirectoryDslElement(myDslElement, JNI);
myDslElement.setNewElement(JNI, jni);
}
return new SourceDirectoryModel(jni);
}
use of com.android.tools.idea.gradle.dsl.model.android.sourceSets.SourceDirectoryModel in project android by JetBrains.
the class SourceDirectoryModelTest method testSourceDirectoryEntriesAddAndReset.
public void testSourceDirectoryEntriesAddAndReset() 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);
buildModel.resetState();
verifySourceDirectoryEntries(buildModel, 1, 2);
}
use of com.android.tools.idea.gradle.dsl.model.android.sourceSets.SourceDirectoryModel in project android by JetBrains.
the class SourceDirectoryModelTest method testSourceDirectoryEntriesRemoveAndApply.
public void testSourceDirectoryEntriesRemoveAndApply() 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.removeSrcDir("javaSource2");
java.removeInclude("javaInclude2");
java.removeExclude("javaExclude2");
SourceDirectoryModel jni = sourceSet.jni();
jni.removeSrcDir("jniSource2");
jni.removeInclude("jniInclude2");
jni.removeExclude("jniExclude2");
verifySourceDirectoryEntries(buildModel, 1);
applyChangesAndReparse(buildModel);
verifySourceDirectoryEntries(buildModel, 1);
}
use of com.android.tools.idea.gradle.dsl.model.android.sourceSets.SourceDirectoryModel in project android by JetBrains.
the class SourceDirectoryModelTest method testSourceDirectoryEntriesReplaceAndReset.
public void testSourceDirectoryEntriesReplaceAndReset() 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.replaceSrcDir("javaSource2", "javaSource3");
java.replaceInclude("javaInclude2", "javaInclude3");
java.replaceExclude("javaExclude2", "javaExclude3");
SourceDirectoryModel jni = sourceSet.jni();
jni.replaceSrcDir("jniSource2", "jniSource3");
jni.replaceInclude("jniInclude2", "jniInclude3");
jni.replaceExclude("jniExclude2", "jniExclude3");
verifySourceDirectoryEntries(buildModel, 1, 3);
buildModel.resetState();
verifySourceDirectoryEntries(buildModel, 1, 2);
}
use of com.android.tools.idea.gradle.dsl.model.android.sourceSets.SourceDirectoryModel in project android by JetBrains.
the class SourceDirectoryModelTest method testSourceDirectoryEntriesRemoveAllAndReset.
public void testSourceDirectoryEntriesRemoveAllAndReset() 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.removeAllSrcDirs();
java.removeAllIncludes();
java.removeAllExcludes();
SourceDirectoryModel jni = sourceSet.jni();
jni.removeAllSrcDirs();
jni.removeAllIncludes();
jni.removeAllExcludes();
verifySourceDirectoryEntries(buildModel);
buildModel.resetState();
verifySourceDirectoryEntries(buildModel, 1, 2);
}
Aggregations