use of com.android.tools.idea.gradle.dsl.model.android.externalNativeBuild.NdkBuildModel in project android by JetBrains.
the class ExternalNativeBuildModel method ndkBuild.
@NotNull
public NdkBuildModel ndkBuild() {
NdkBuildDslElement ndkBuildDslElement = myDslElement.getPropertyElement(NDK_BUILD_BLOCK_NAME, NdkBuildDslElement.class);
if (ndkBuildDslElement == null) {
ndkBuildDslElement = new NdkBuildDslElement(myDslElement);
myDslElement.setNewElement(NDK_BUILD_BLOCK_NAME, ndkBuildDslElement);
}
return new NdkBuildModel(ndkBuildDslElement);
}
use of com.android.tools.idea.gradle.dsl.model.android.externalNativeBuild.NdkBuildModel in project android by JetBrains.
the class ExternalNativeBuildModelTest method testAddNdkBuildPathAndReset.
public void testAddNdkBuildPathAndReset() throws Exception {
String text = "android {\n" + "}";
writeToBuildFile(text);
GradleBuildModel buildModel = getGradleBuildModel();
AndroidModel android = buildModel.android();
assertNotNull(android);
NdkBuildModel ndkBuild = android.externalNativeBuild().ndkBuild();
assertNull(ndkBuild.path());
ndkBuild.setPath(new File("foo/Android.mk"));
assertEquals("path", new File("foo/Android.mk"), ndkBuild.path());
buildModel.resetState();
assertNull(ndkBuild.path());
}
use of com.android.tools.idea.gradle.dsl.model.android.externalNativeBuild.NdkBuildModel in project android by JetBrains.
the class ExternalNativeBuildModelTest method testNdkBuildWithNewFilePath.
public void testNdkBuildWithNewFilePath() throws Exception {
String text = "android {\n" + " externalNativeBuild {\n" + " ndkBuild {\n" + " path new File(\"foo\", \"Android.mk\")\n" + " }\n" + " }\n" + "}";
writeToBuildFile(text);
AndroidModel android = getGradleBuildModel().android();
assertNotNull(android);
ExternalNativeBuildModel externalNativeBuild = android.externalNativeBuild();
assertTrue(externalNativeBuild.hasValidPsiElement());
NdkBuildModel ndkBuild = externalNativeBuild.ndkBuild();
assertTrue(ndkBuild.hasValidPsiElement());
assertEquals("path", new File("foo/Android.mk"), ndkBuild.path());
}
use of com.android.tools.idea.gradle.dsl.model.android.externalNativeBuild.NdkBuildModel in project android by JetBrains.
the class ExternalNativeBuildModelTest method testAddNdkBuildPathAndApplyChanges.
public void testAddNdkBuildPathAndApplyChanges() throws Exception {
String text = "android {\n" + "}";
writeToBuildFile(text);
GradleBuildModel buildModel = getGradleBuildModel();
AndroidModel android = buildModel.android();
assertNotNull(android);
NdkBuildModel ndkBuild = android.externalNativeBuild().ndkBuild();
assertNull(ndkBuild.path());
ndkBuild.setPath(new File("foo/Android.mk"));
assertEquals("path", new File("foo/Android.mk"), ndkBuild.path());
applyChanges(buildModel);
assertEquals("path", new File("foo/Android.mk"), ndkBuild.path());
buildModel.reparse();
android = buildModel.android();
assertNotNull(android);
ndkBuild = android.externalNativeBuild().ndkBuild();
assertEquals("path", new File("foo/Android.mk"), ndkBuild.path());
}
use of com.android.tools.idea.gradle.dsl.model.android.externalNativeBuild.NdkBuildModel in project android by JetBrains.
the class ExternalNativeBuildModelTest method testNdkBuild.
public void testNdkBuild() throws Exception {
String text = "android {\n" + " externalNativeBuild {\n" + " ndkBuild {\n" + " path file(\"foo/Android.mk\")\n" + " }\n" + " }\n" + "}";
writeToBuildFile(text);
AndroidModel android = getGradleBuildModel().android();
assertNotNull(android);
ExternalNativeBuildModel externalNativeBuild = android.externalNativeBuild();
assertTrue(externalNativeBuild.hasValidPsiElement());
NdkBuildModel ndkBuild = externalNativeBuild.ndkBuild();
assertTrue(ndkBuild.hasValidPsiElement());
assertEquals("path", new File("foo/Android.mk"), ndkBuild.path());
}
Aggregations