use of com.android.tools.idea.gradle.stubs.android.AndroidProjectStub in project android by JetBrains.
the class GradleRenderErrorContributorTest method setUpAndroidFacetWithGradleModelWithIssue.
private void setUpAndroidFacetWithGradleModelWithIssue() {
ApplicationManager.getApplication().runWriteAction(() -> {
FacetManager.getInstance(myModule).addFacet(AndroidFacet.getFacetType(), AndroidFacet.NAME, null);
});
AndroidFacet facet = AndroidFacet.getInstance(myModule);
assertThat(facet).isNotNull();
File root = Projects.getBaseDirPath(myProject);
AndroidProjectStub androidProject = TestProjects.createBasicProject();
// The problematic plugin version.
// https://code.google.com/p/android/issues/detail?id=170841
androidProject.setModelVersion("1.2.2");
AndroidModuleModel model = new AndroidModuleModel(androidProject.getName(), root, androidProject, "debug");
facet.setAndroidModel(model);
model = AndroidModuleModel.get(myModule);
assertThat(model).isNotNull();
assertThat(model.getFeatures().isLayoutRenderingIssuePresent()).isTrue();
}
use of com.android.tools.idea.gradle.stubs.android.AndroidProjectStub 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());
}
use of com.android.tools.idea.gradle.stubs.android.AndroidProjectStub in project android by JetBrains.
the class ProjectResourceRepositoryTest method addArchiveLibraries.
private void addArchiveLibraries() {
// Add in some Android projects too
// make it a Gradle project
myFacet.getProperties().ALLOW_USER_CONFIGURATION = false;
AndroidProjectStub androidProject = TestProjects.createFlavorsProject();
VariantStub variant = androidProject.getFirstVariant();
assertNotNull(variant);
File rootDir = androidProject.getRootDir();
AndroidModuleModel androidModel = new AndroidModuleModel(androidProject.getName(), rootDir, androidProject, variant.getName());
myFacet.setAndroidModel(androidModel);
File bundle = new File(rootDir, "bundle.aar");
File libJar = new File(rootDir, "bundle_aar" + File.separatorChar + "library.jar");
AndroidLibraryStub library = new AndroidLibraryStub(bundle, libJar);
variant.getMainArtifact().getDependencies().addLibrary(library);
}
Aggregations