use of com.android.tools.idea.gradle.eclipse.AdtImportBuilder in project android by JetBrains.
the class AdtModuleImporter method importProjects.
@Override
public void importProjects(Map<String, VirtualFile> projects) {
Project project = myContext.getProject();
assert project != null;
AdtImportBuilder builder = AdtImportBuilder.getBuilder(myContext);
assert builder != null;
GradleImport importer = getGradleImport();
ImmutableMap.Builder<File, String> modules = ImmutableMap.builder();
for (Map.Entry<String, VirtualFile> entry : projects.entrySet()) {
modules.put(virtualToIoFile(entry.getValue()), getDefaultPhysicalPathFromGradlePath(entry.getKey()));
}
importer.setImportModuleNames(modules.build());
if (builder.validate(null, project)) {
builder.commit(project, null, ModulesProvider.EMPTY_MODULES_PROVIDER, null);
builder.cleanup();
}
}
use of com.android.tools.idea.gradle.eclipse.AdtImportBuilder in project android by JetBrains.
the class AdtModuleImporter method findModules.
@Override
@NotNull
public Set<ModuleToImport> findModules(@NotNull VirtualFile importSource) throws IOException {
final AdtImportBuilder builder = (AdtImportBuilder) myContext.getProjectBuilder();
assert builder != null;
builder.setSelectedProject(virtualToIoFile(importSource));
final GradleImport gradleImport = getGradleImport();
gradleImport.importProjects(Collections.singletonList(virtualToIoFile(importSource)));
Map<String, File> adtProjects = gradleImport.getDetectedModuleLocations();
Set<ModuleToImport> modules = Sets.newHashSet();
for (final Map.Entry<String, File> entry : adtProjects.entrySet()) {
VirtualFile location = findFileByIoFile(entry.getValue(), false);
modules.add(new ModuleToImport(entry.getKey(), location, new Supplier<Iterable<String>>() {
@Override
public Iterable<String> get() {
return gradleImport.getProjectDependencies(entry.getKey());
}
}));
}
return modules;
}
use of com.android.tools.idea.gradle.eclipse.AdtImportBuilder in project android by JetBrains.
the class AdtModuleImporter method getGradleImport.
@NotNull
private GradleImport getGradleImport() {
AdtImportBuilder builder = AdtImportBuilder.getBuilder(myContext);
assert builder != null;
GradleImport importer = builder.getImporter();
assert importer != null;
return importer;
}
Aggregations