use of org.jetbrains.android.facet.AndroidFacet in project android by JetBrains.
the class AndroidCompileUtil method findCircularDependencyOnLibraryWithSamePackage.
@Nullable
public static Module findCircularDependencyOnLibraryWithSamePackage(@NotNull AndroidFacet facet) {
final Manifest manifest = facet.getManifest();
final String aPackage = manifest != null ? manifest.getPackage().getValue() : null;
if (aPackage == null) {
return null;
}
for (AndroidFacet depFacet : AndroidUtils.getAllAndroidDependencies(facet.getModule(), true)) {
final Manifest depManifest = depFacet.getManifest();
final String depPackage = depManifest != null ? depManifest.getPackage().getValue() : null;
if (aPackage.equals(depPackage)) {
final List<AndroidFacet> depDependencies = AndroidUtils.getAllAndroidDependencies(depFacet.getModule(), false);
if (depDependencies.contains(facet)) {
// circular dependency on library with the same package
return depFacet.getModule();
}
}
}
return null;
}
use of org.jetbrains.android.facet.AndroidFacet in project android by JetBrains.
the class AndroidApplicationArtifactType method getNewArtifactTemplates.
@NotNull
@Override
public List<? extends ArtifactTemplate> getNewArtifactTemplates(@NotNull PackagingElementResolvingContext context) {
final List<AndroidFacet> facets = new ArrayList<AndroidFacet>();
for (Module module : context.getModulesProvider().getModules()) {
final FacetModel facetModel = context.getModulesProvider().getFacetModel(module);
final AndroidFacet facet = facetModel.getFacetByType(AndroidFacet.ID);
if (facet != null && facet.isAppProject()) {
facets.add(facet);
}
}
if (facets.size() == 0) {
return Collections.emptyList();
}
return Collections.singletonList(new MyTemplate(context.getProject(), facets));
}
use of org.jetbrains.android.facet.AndroidFacet in project android by JetBrains.
the class ProGuardConfigFilesPanel method getCanonicalSdkHome.
@Nullable
private String getCanonicalSdkHome() {
final AndroidFacet facet = getFacet();
if (facet == null) {
return null;
}
final Sdk sdk = ModuleRootManager.getInstance(facet.getModule()).getSdk();
if (sdk == null) {
return null;
}
final String homePath = sdk.getHomePath();
return homePath != null ? FileUtil.toCanonicalPath(homePath) : null;
}
use of org.jetbrains.android.facet.AndroidFacet in project android by JetBrains.
the class AndroidFindStyleApplicationsAction method createFindStyleApplicationsProcessor.
public static AndroidFindStyleApplicationsProcessor createFindStyleApplicationsProcessor(XmlTag tag, MyStyleData styleData, PsiFile context) {
final ErrorReporter errorReporter = new ProjectBasedErrorReporter(tag.getProject());
final Style style = styleData.getStyle();
final Map<AndroidAttributeInfo, String> attrMap = AndroidRefactoringUtil.computeAttributeMap(style, new ProjectBasedErrorReporter(tag.getProject()), AndroidBundle.message("android.find.style.applications.title"));
if (attrMap == null || attrMap.size() == 0) {
return null;
}
final AndroidFacet facet = styleData.getFacet();
final StyleRefData parentStyleRef = AndroidRefactoringUtil.getParentStyle(style);
PsiElement parentStyleAttrName = null;
if (parentStyleRef != null) {
parentStyleAttrName = resolveStyleRef(parentStyleRef, facet);
if (parentStyleAttrName == null) {
errorReporter.report("Cannot resolve parent style '" + parentStyleRef.getStyleName() + "'", AndroidBundle.message("android.find.style.applications.title"));
return null;
}
}
return new AndroidFindStyleApplicationsProcessor(styleData.getFacet().getModule(), attrMap, styleData.getName(), tag, styleData.getNameAttrValue(), parentStyleAttrName, context);
}
use of org.jetbrains.android.facet.AndroidFacet in project kotlin by JetBrains.
the class IntellijLintProject method addAndroidModules.
private static void addAndroidModules(Set<AndroidFacet> androidFacets, Set<Module> seen, Graph<Module> graph, Module module) {
Iterator<Module> iterator = graph.getOut(module);
while (iterator.hasNext()) {
Module dep = iterator.next();
AndroidFacet facet = AndroidFacet.getInstance(dep);
if (facet != null) {
androidFacets.add(facet);
}
if (!seen.contains(dep)) {
seen.add(dep);
addAndroidModules(androidFacets, seen, graph, dep);
}
}
}
Aggregations