use of com.android.tools.idea.gradle.structure.model.PsProject in project android by JetBrains.
the class PsAndroidModuleTest method testEditableDependenciesWithPlusInVersion.
public void testEditableDependenciesWithPlusInVersion() throws Throwable {
loadProject(PROJECT_WITH_APPAND_LIB);
Project resolvedProject = myFixture.getProject();
PsProject project = new PsProject(resolvedProject);
PsAndroidModule appModule = (PsAndroidModule) project.findModuleByName("app");
assertNotNull(appModule);
List<PsAndroidDependency> declaredDependencies = getDeclaredDependencies(appModule);
assertThat(declaredDependencies).hasSize(1);
// Verify that appcompat is considered a "editable" dependency, and it was matched properly
PsLibraryAndroidDependency appCompatV7 = (PsLibraryAndroidDependency) declaredDependencies.get(0);
assertTrue(appCompatV7.isDeclared());
PsArtifactDependencySpec declaredSpec = appCompatV7.getDeclaredSpec();
assertNotNull(declaredSpec);
assertEquals("com.android.support:appcompat-v7:+", declaredSpec.toString());
PsArtifactDependencySpec resolvedSpec = appCompatV7.getResolvedSpec();
assertEquals("com.android.support", resolvedSpec.group);
assertEquals("appcompat-v7", resolvedSpec.name);
assertThat(resolvedSpec.version).isNotEqualTo("+");
// Verify that the variants where appcompat is are properly registered.
Collection<String> variants = appCompatV7.getVariants();
assertThat(variants).containsExactly("paidDebug", "paidRelease", "basicDebug", "basicRelease");
for (String variant : variants) {
assertNotNull(appModule.findVariant(variant));
}
}
use of com.android.tools.idea.gradle.structure.model.PsProject in project android by JetBrains.
the class PsAndroidModuleTest method testCanDependOnModules.
public void testCanDependOnModules() throws Throwable {
loadProject(PROJECT_WITH_APPAND_LIB);
Project resolvedProject = myFixture.getProject();
PsProject project = new PsProject(resolvedProject);
PsAndroidModule appModule = (PsAndroidModule) project.findModuleByName("app");
assertNotNull(appModule);
PsAndroidModule libModule = (PsAndroidModule) project.findModuleByName("lib");
assertNotNull(libModule);
assertTrue(appModule.canDependOn(libModule));
assertFalse(libModule.canDependOn(appModule));
}
use of com.android.tools.idea.gradle.structure.model.PsProject in project android by JetBrains.
the class PsAndroidModuleTest method testProductFlavors.
public void testProductFlavors() throws Throwable {
loadProject(PROJECT_WITH_APPAND_LIB);
Project resolvedProject = myFixture.getProject();
PsProject project = new PsProject(resolvedProject);
PsAndroidModule appModule = (PsAndroidModule) project.findModuleByName("app");
assertNotNull(appModule);
List<PsProductFlavor> productFlavors = getProductFlavors(appModule);
assertThat(productFlavors).hasSize(2);
PsProductFlavor basic = appModule.findProductFlavor("basic");
assertNotNull(basic);
assertTrue(basic.isDeclared());
PsProductFlavor release = appModule.findProductFlavor("paid");
assertNotNull(release);
assertTrue(release.isDeclared());
}
use of com.android.tools.idea.gradle.structure.model.PsProject in project android by JetBrains.
the class ModuleDependenciesForm method getModuleDependencies.
@NotNull
private static List<PsModule> getModuleDependencies(@NotNull PsModule module) {
PsProject project = module.getParent();
List<PsModule> dependencies = Lists.newArrayList();
if (module instanceof PsAndroidModule) {
((PsAndroidModule) module).forEachModuleDependency(dependency -> {
String name = dependency.getName();
PsModule found = project.findModuleByName(name);
if (found != null) {
dependencies.add(found);
}
});
}
return dependencies;
}
use of com.android.tools.idea.gradle.structure.model.PsProject in project android by JetBrains.
the class DependenciesPerspectiveConfigurable method getExtraTopModules.
@Override
@NotNull
protected List<PsModule> getExtraTopModules() {
if (myExtraTopModules.isEmpty()) {
PsProject project = getContext().getProject();
myExtraTopModules.add(new PsAllModulesFakeModule(project));
}
return myExtraTopModules;
}
Aggregations