use of org.jetbrains.android.facet.AndroidFacet in project android by JetBrains.
the class PostProjectBuildTasksExecutorTest method addAndroidModelToFacet.
private static void addAndroidModelToFacet(@NotNull Module module, @NotNull AndroidModuleModel androidModel) {
AndroidFacet facet = AndroidFacet.getInstance(module);
assert facet != null;
facet.setAndroidModel(androidModel);
}
use of org.jetbrains.android.facet.AndroidFacet 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 org.jetbrains.android.facet.AndroidFacet in project android by JetBrains.
the class ConflictSetTest method createFacet.
@NotNull
private static AndroidFacet createFacet(@NotNull FacetManager facetManager, int projectType) {
AndroidFacet facet = facetManager.createFacet(AndroidFacet.getFacetType(), AndroidFacet.NAME, null);
JpsAndroidModuleProperties facetState = facet.getProperties();
facetState.ALLOW_USER_CONFIGURATION = false;
facetState.PROJECT_TYPE = projectType;
return facet;
}
use of org.jetbrains.android.facet.AndroidFacet in project android by JetBrains.
the class NlComponent method getIds.
/**
* Looks up the existing set of id's reachable from the given module
*/
public static Collection<String> getIds(@NotNull NlModel model) {
AndroidFacet facet = model.getFacet();
AppResourceRepository resources = AppResourceRepository.getAppResources(facet, true);
Collection<String> ids = resources.getItemsOfType(ResourceType.ID);
Set<String> pendingIds = model.getPendingIds();
if (!pendingIds.isEmpty()) {
List<String> all = Lists.newArrayListWithCapacity(pendingIds.size() + ids.size());
all.addAll(ids);
all.addAll(pendingIds);
ids = all;
}
return ids;
}
use of org.jetbrains.android.facet.AndroidFacet in project android by JetBrains.
the class NlProperties method getProperties.
@NotNull
public Table<String, String, NlPropertyItem> getProperties(@NotNull List<NlComponent> components) {
AndroidFacet facet = getFacet(components);
if (facet == null) {
return ImmutableTable.of();
}
GradleDependencyManager dependencyManager = GradleDependencyManager.getInstance(facet.getModule().getProject());
return getProperties(facet, components, dependencyManager);
}
Aggregations