Search in sources :

Example 41 with AndroidModuleModel

use of com.android.tools.idea.gradle.project.model.AndroidModuleModel in project android by JetBrains.

the class LayoutRenderingIssueValidationStrategyTest method mockAndroidModel.

@NotNull
private static AndroidModuleModel mockAndroidModel(@NotNull GradleVersion version, boolean hasLayoutRenderingIssue) {
    AndroidModelFeatures features = mock(AndroidModelFeatures.class);
    when(features.isLayoutRenderingIssuePresent()).thenReturn(hasLayoutRenderingIssue);
    AndroidModuleModel androidModel = mock(AndroidModuleModel.class);
    when(androidModel.getFeatures()).thenReturn(features);
    when(androidModel.getModelVersion()).thenReturn(version);
    return androidModel;
}
Also used : AndroidModelFeatures(com.android.tools.idea.gradle.project.model.AndroidModelFeatures) AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel) NotNull(org.jetbrains.annotations.NotNull)

Example 42 with AndroidModuleModel

use of com.android.tools.idea.gradle.project.model.AndroidModuleModel in project android by JetBrains.

the class AndroidModuleValidatorImplTest method validate.

@Test
public void validate() {
    Module module = mock(Module.class);
    AndroidModuleModel androidModel = mock(AndroidModuleModel.class);
    myValidator.validate(module, androidModel);
    verify(myStrategy1, times(1)).validate(module, androidModel);
    verify(myStrategy2, times(1)).validate(module, androidModel);
}
Also used : AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel) Module(com.intellij.openapi.module.Module) Test(org.junit.Test)

Example 43 with AndroidModuleModel

use of com.android.tools.idea.gradle.project.model.AndroidModuleModel in project android by JetBrains.

the class BuildTools23Rc1ValidationStrategyTest method testValidateWithPlugin1Dot3.

public void testValidateWithPlugin1Dot3() {
    AndroidModuleModel androidModel = mockAndroidModel("1.3", 3);
    Module module = mock(Module.class);
    myStrategy.validate(module, androidModel);
    assertThat(myStrategy.getModules()).isEmpty();
    verify(myBuildToolsVersionReader, never()).getBuildToolsVersion(module);
}
Also used : AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel) Module(com.intellij.openapi.module.Module)

Example 44 with AndroidModuleModel

use of com.android.tools.idea.gradle.project.model.AndroidModuleModel in project android by JetBrains.

the class EncodingValidationStrategyTest method testValidate.

public void testValidate() {
    String modelEncoding = "UTF-8";
    AndroidModuleModel androidModel = mock(AndroidModuleModel.class);
    when(androidModel.getModelVersion()).thenReturn(GradleVersion.parse("1.2.0"));
    AndroidProjectStub androidProject = new AndroidProjectStub("app");
    androidProject.getJavaCompileOptions().setEncoding(modelEncoding);
    when(androidModel.getAndroidProject()).thenReturn(androidProject);
    myStrategy.validate(mock(Module.class), androidModel);
    assertEquals(modelEncoding, myStrategy.getMismatchingEncoding());
}
Also used : AndroidProjectStub(com.android.tools.idea.gradle.stubs.android.AndroidProjectStub) AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel) Module(com.intellij.openapi.module.Module)

Example 45 with AndroidModuleModel

use of com.android.tools.idea.gradle.project.model.AndroidModuleModel in project android by JetBrains.

the class ExtraGeneratedFolderValidationStrategyTest method mockAndroidModel.

@NotNull
private static AndroidModuleModel mockAndroidModel(@NotNull File[] extraFolderPaths) {
    AndroidModuleModel androidModel = mock(AndroidModuleModel.class);
    when(androidModel.getExtraGeneratedSourceFolderPaths()).thenReturn(extraFolderPaths);
    return androidModel;
}
Also used : AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)117 Module (com.intellij.openapi.module.Module)54 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)26 File (java.io.File)24 NotNull (org.jetbrains.annotations.NotNull)21 VirtualFile (com.intellij.openapi.vfs.VirtualFile)19 Nullable (org.jetbrains.annotations.Nullable)18 AndroidProject (com.android.builder.model.AndroidProject)12 GradleVersion (com.android.ide.common.repository.GradleVersion)11 NdkModuleModel (com.android.tools.idea.gradle.project.model.NdkModuleModel)10 Project (com.intellij.openapi.project.Project)9 Variant (com.android.builder.model.Variant)8 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)7 AndroidLibrary (com.android.builder.model.AndroidLibrary)5 PsiFile (com.intellij.psi.PsiFile)5 AndroidArtifact (com.android.builder.model.AndroidArtifact)4 AndroidArtifactOutput (com.android.builder.model.AndroidArtifactOutput)4 NativeAndroidProject (com.android.builder.model.NativeAndroidProject)4 ModuleNodeBuilder (com.android.tools.idea.gradle.AndroidModelView.ModuleNodeBuilder)4 AndroidVersion (com.android.sdklib.AndroidVersion)3