use of org.jetbrains.android.dom.manifest.Manifest in project android by JetBrains.
the class AndroidCompileUtil method isLibraryWithBadCircularDependency.
// support for lib<->lib and app<->lib circular dependencies
// see IDEA-79737 for details
public static boolean isLibraryWithBadCircularDependency(@NotNull AndroidFacet facet) {
if (!facet.canBeDependency()) {
return false;
}
final List<AndroidFacet> dependencies = AndroidUtils.getAllAndroidDependencies(facet.getModule(), false);
final Manifest manifest = facet.getManifest();
if (manifest == null) {
return false;
}
final String aPackage = manifest.getPackage().getValue();
if (aPackage == null || aPackage.length() == 0) {
return false;
}
for (AndroidFacet depFacet : dependencies) {
final List<AndroidFacet> depDependencies = AndroidUtils.getAllAndroidDependencies(depFacet.getModule(), true);
if (depDependencies.contains(facet) && dependencies.contains(depFacet) && (depFacet.getModule().getName().compareTo(facet.getModule().getName()) < 0 || !depFacet.canBeDependency())) {
return true;
}
}
return false;
}
use of org.jetbrains.android.dom.manifest.Manifest 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.dom.manifest.Manifest in project android by JetBrains.
the class AndroidCompileUtil method excludeAllBuildConfigsFromCompilation.
private static void excludeAllBuildConfigsFromCompilation(AndroidFacet facet, VirtualFile sourceRoot) {
final Module module = facet.getModule();
final Project project = module.getProject();
final Set<String> packages = new HashSet<String>();
final Manifest manifest = facet.getManifest();
final String aPackage = manifest != null ? manifest.getPackage().getStringValue() : null;
if (aPackage != null) {
packages.add(aPackage);
}
packages.addAll(AndroidUtils.getDepLibsPackages(module));
for (String p : packages) {
excludeFromCompilation(project, sourceRoot, p);
}
}
use of org.jetbrains.android.dom.manifest.Manifest in project android by JetBrains.
the class MavenDefaultActivityLocator method getQualifiedActivityName.
@NotNull
@Override
public String getQualifiedActivityName(@NotNull IDevice device) throws ActivityLocatorException {
File manifestCopy = null;
try {
Pair<File, String> pair;
try {
pair = ApkProviderUtil.getCopyOfCompilerManifestFile(myFacet);
} catch (IOException e) {
throw new ActivityLocatorException("Error while obtaining compiler manifest file", e);
}
manifestCopy = pair != null ? pair.getFirst() : null;
VirtualFile manifestVFile = manifestCopy != null ? LocalFileSystem.getInstance().findFileByIoFile(manifestCopy) : null;
final Manifest manifest = manifestVFile == null ? null : AndroidUtils.loadDomElement(myFacet.getModule(), manifestVFile, Manifest.class);
if (manifest == null) {
throw new ActivityLocatorException("Cannot find " + SdkConstants.FN_ANDROID_MANIFEST_XML + " file");
}
String defaultLauncherActivityName = DefaultActivityLocator.getDefaultLauncherActivityName(myFacet.getModule().getProject(), manifest);
if (defaultLauncherActivityName == null) {
throw new ActivityLocatorException("Could not locate default activity to launch.");
}
return defaultLauncherActivityName;
} finally {
if (manifestCopy != null) {
FileUtil.delete(manifestCopy.getParentFile());
}
}
}
use of org.jetbrains.android.dom.manifest.Manifest in project android by JetBrains.
the class AndroidProcessChooserDialog method collectAllProcessNames.
@NotNull
private static Set<String> collectAllProcessNames(Project project) {
final List<AndroidFacet> facets = ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID);
final Set<String> result = new HashSet<String>();
for (AndroidFacet facet : facets) {
final String packageName = AndroidCompileUtil.getAaptManifestPackage(facet);
if (packageName != null) {
result.add(packageName.toLowerCase());
}
final Manifest manifest = facet.getManifest();
if (manifest != null) {
final XmlElement xmlElement = manifest.getXmlElement();
if (xmlElement != null) {
collectProcessNames(xmlElement, result);
}
}
final AndroidModel androidModel = facet.getAndroidModel();
if (androidModel != null) {
result.addAll(androidModel.getAllApplicationIds());
}
}
return result;
}
Aggregations