use of com.android.tools.idea.gradle.dsl.model.android.externalNativeBuild.CMakeModel in project android by JetBrains.
the class ExternalNativeBuildModel method cmake.
@NotNull
public CMakeModel cmake() {
CMakeDslElement cMakeDslElement = myDslElement.getPropertyElement(CMAKE_BLOCK_NAME, CMakeDslElement.class);
if (cMakeDslElement == null) {
cMakeDslElement = new CMakeDslElement(myDslElement);
myDslElement.setNewElement(CMAKE_BLOCK_NAME, cMakeDslElement);
}
return new CMakeModel(cMakeDslElement);
}
use of com.android.tools.idea.gradle.dsl.model.android.externalNativeBuild.CMakeModel in project android by JetBrains.
the class AndroidModelTest method testAndroidBlockWithExternalNativeBuildBlock.
public void testAndroidBlockWithExternalNativeBuildBlock() throws Exception {
String text = "android {\n" + " externalNativeBuild {\n" + " cmake {\n" + " path file(\"foo/bar\")\n" + " }\n" + " }\n" + "}";
writeToBuildFile(text);
AndroidModel android = getGradleBuildModel().android();
assertNotNull(android);
ExternalNativeBuildModel externalNativeBuild = android.externalNativeBuild();
assertTrue(externalNativeBuild.hasValidPsiElement());
CMakeModel cmake = externalNativeBuild.cmake();
assertTrue(cmake.hasValidPsiElement());
assertEquals("path", new File("foo/bar"), cmake.path());
}
use of com.android.tools.idea.gradle.dsl.model.android.externalNativeBuild.CMakeModel in project android by JetBrains.
the class ExternalNativeBuildModelTest method testAddCMakePathAndReset.
public void testAddCMakePathAndReset() throws Exception {
String text = "android {\n" + "}";
writeToBuildFile(text);
GradleBuildModel buildModel = getGradleBuildModel();
AndroidModel android = buildModel.android();
assertNotNull(android);
ExternalNativeBuildModel externalNativeBuild = android.externalNativeBuild();
CMakeModel cmake = externalNativeBuild.cmake();
assertNull(cmake.path());
cmake.setPath(new File("foo/bar"));
assertEquals("path", new File("foo/bar"), cmake.path());
buildModel.resetState();
assertNull(cmake.path());
}
use of com.android.tools.idea.gradle.dsl.model.android.externalNativeBuild.CMakeModel in project android by JetBrains.
the class ExternalNativeBuildModelTest method testAddCMakePathAndApplyChanges.
public void testAddCMakePathAndApplyChanges() throws Exception {
String text = "android {\n" + "}";
writeToBuildFile(text);
GradleBuildModel buildModel = getGradleBuildModel();
AndroidModel android = buildModel.android();
assertNotNull(android);
CMakeModel cmake = android.externalNativeBuild().cmake();
assertNull(cmake.path());
cmake.setPath(new File("foo/bar"));
assertEquals("path", new File("foo/bar"), cmake.path());
applyChanges(buildModel);
assertEquals("path", new File("foo/bar"), cmake.path());
buildModel.reparse();
android = buildModel.android();
assertNotNull(android);
cmake = android.externalNativeBuild().cmake();
assertEquals("path", new File("foo/bar"), cmake.path());
}
use of com.android.tools.idea.gradle.dsl.model.android.externalNativeBuild.CMakeModel in project android by JetBrains.
the class ExternalNativeBuildModelTest method testCMakeWithNewFilePath.
public void testCMakeWithNewFilePath() throws Exception {
String text = "android {\n" + " externalNativeBuild {\n" + " cmake {\n" + " path new File(\"foo/bar\")\n" + " }\n" + " }\n" + "}";
writeToBuildFile(text);
AndroidModel android = getGradleBuildModel().android();
assertNotNull(android);
ExternalNativeBuildModel externalNativeBuild = android.externalNativeBuild();
assertTrue(externalNativeBuild.hasValidPsiElement());
CMakeModel cmake = externalNativeBuild.cmake();
assertTrue(cmake.hasValidPsiElement());
assertEquals("path", new File("foo/bar"), cmake.path());
}
Aggregations