use of com.android.builder.model.SyncIssue in project android by JetBrains.
the class GradleSyncIntegrationTest method testJarsFolderInExplodedAarIsExcluded.
// https://code.google.com/p/android/issues/detail?id=227931
public void testJarsFolderInExplodedAarIsExcluded() throws Exception {
loadSimpleApplication();
Module appModule = myModules.getAppModule();
AndroidModuleModel androidModel = AndroidModuleModel.get(appModule);
assertNotNull(androidModel);
Collection<SyncIssue> issues = androidModel.getSyncIssues();
assertThat(issues).isEmpty();
AndroidPluginInfo pluginInfo = AndroidPluginInfo.find(getProject());
assertNotNull(pluginInfo);
assertEquals(pluginInfo.getPluginGeneration(), ORIGINAL);
GradleVersion pluginVersion = pluginInfo.getPluginVersion();
assertNotNull(pluginVersion);
if (pluginVersion.compareIgnoringQualifiers("2.3.0") >= 0) {
// it is not inside the project.
return;
}
ProjectLibraries libraries = new ProjectLibraries(getProject());
Library appCompat = libraries.findMatchingLibrary("appcompat-v7.*");
assertNotNull(appCompat);
File jarsFolderPath = null;
for (String url : appCompat.getUrls(CLASSES)) {
if (url.startsWith(JAR_PROTOCOL_PREFIX)) {
File jarPath = getJarFromJarUrl(url);
assertNotNull(jarPath);
jarsFolderPath = jarPath.getParentFile();
break;
}
}
assertNotNull(jarsFolderPath);
ContentEntry[] contentEntries = ModuleRootManager.getInstance(appModule).getContentEntries();
assertThat(contentEntries).hasLength(1);
ContentEntry contentEntry = contentEntries[0];
List<String> excludeFolderUrls = contentEntry.getExcludeFolderUrls();
assertThat(excludeFolderUrls).contains(pathToIdeaUrl(jarsFolderPath));
}
Aggregations