use of com.android.tools.idea.gradle.project.model.GradleModuleModel in project android by JetBrains.
the class GradleModuleSetup method setUpModule.
public void setUpModule(@NotNull Module module, @NotNull IdeModifiableModelsProvider ideModelsProvider, @NotNull SyncAction.ModuleModels models) {
GradleModuleModel gradleModuleModel = createGradleModel(module, models);
setUpModule(module, ideModelsProvider, gradleModuleModel);
}
use of com.android.tools.idea.gradle.project.model.GradleModuleModel in project android by JetBrains.
the class ModulesToImportDialogTest method createModule.
@NotNull
private static DataNode<ModuleData> createModule(@NotNull String name, boolean isGradleProject) {
String path = "~/project/" + name;
ModuleData data = new ModuleData(name, GradleConstants.SYSTEM_ID, StdModuleTypes.JAVA.getId(), name, path, path);
DataNode<ModuleData> module = new DataNode<>(MODULE, data, null);
if (isGradleProject) {
List<String> taskNames = Collections.emptyList();
module.createChild(GRADLE_MODULE_MODEL, new GradleModuleModel("app", taskNames, ":" + name, null, null));
}
return module;
}
use of com.android.tools.idea.gradle.project.model.GradleModuleModel in project android by JetBrains.
the class AndroidGradleProjectResolverIdeaTest method testPopulateModuleContentRootsWithJavaProject.
public void testPopulateModuleContentRootsWithJavaProject() {
ProjectData project = myProjectResolver.createProject();
DataNode<ProjectData> projectNode = new DataNode<>(PROJECT, project, null);
DataNode<ModuleData> moduleDataNode = myProjectResolver.createModule(myJavaModuleModel, projectNode);
myProjectResolver.populateModuleContentRoots(myJavaModuleModel, moduleDataNode);
// Verify module does not have AndroidGradleModel.
Collection<DataNode<AndroidModuleModel>> androidModelNodes = getChildren(moduleDataNode, ANDROID_MODEL);
assertThat(androidModelNodes).isEmpty();
// Verify module has IdeaGradleProject.
Collection<DataNode<GradleModuleModel>> gradleModelNodes = getChildren(moduleDataNode, GRADLE_MODULE_MODEL);
assertThat(gradleModelNodes).hasSize(1);
DataNode<GradleModuleModel> gradleModelNode = getFirstItem(gradleModelNodes);
assertNotNull(gradleModelNode);
assertEquals(myJavaModuleModel.getGradleProject().getPath(), gradleModelNode.getData().getGradlePath());
}
use of com.android.tools.idea.gradle.project.model.GradleModuleModel in project android by JetBrains.
the class AndroidGradleProjectResolverIdeaTest method testPopulateModuleContentRootsWithNativeAndroidProject.
public void testPopulateModuleContentRootsWithNativeAndroidProject() {
ProjectData project = myProjectResolver.createProject();
DataNode<ProjectData> projectNode = new DataNode<>(PROJECT, project, null);
DataNode<ModuleData> moduleDataNode = myProjectResolver.createModule(myNativeAndroidModuleModel, projectNode);
myProjectResolver.populateModuleContentRoots(myNativeAndroidModuleModel, moduleDataNode);
// Verify module does not have AndroidGradleModel.
Collection<DataNode<AndroidModuleModel>> androidModelNodes = getChildren(moduleDataNode, ANDROID_MODEL);
assertThat(androidModelNodes).isEmpty();
// Verify module has NativeAndroidGradleModel.
Collection<DataNode<NdkModuleModel>> ndkModuleModelNodes = getChildren(moduleDataNode, NDK_MODEL);
assertThat(ndkModuleModelNodes).hasSize(1);
DataNode<NdkModuleModel> nativeAndroidModelNode = getFirstItem(ndkModuleModelNodes);
assertNotNull(nativeAndroidModelNode);
assertSame(myNativeAndroidProject, nativeAndroidModelNode.getData().getAndroidProject());
// Verify module has IdeaGradleProject.
Collection<DataNode<GradleModuleModel>> gradleModelNodes = getChildren(moduleDataNode, GRADLE_MODULE_MODEL);
assertThat(gradleModelNodes).hasSize(1);
DataNode<GradleModuleModel> gradleModelNode = getFirstItem(gradleModelNodes);
assertNotNull(gradleModelNode);
assertEquals(myNativeAndroidModuleModel.getGradleProject().getPath(), gradleModelNode.getData().getGradlePath());
}
use of com.android.tools.idea.gradle.project.model.GradleModuleModel in project android by JetBrains.
the class AndroidGradleProjectResolverIdeaTest method testPopulateModuleContentRootsWithAndroidProject.
public void testPopulateModuleContentRootsWithAndroidProject() {
when(myVariantSelector.findVariantToSelect(myAndroidProject)).thenReturn(myAndroidProject.getFirstVariant());
ProjectData project = myProjectResolver.createProject();
DataNode<ProjectData> projectNode = new DataNode<>(PROJECT, project, null);
DataNode<ModuleData> moduleDataNode = myProjectResolver.createModule(myAndroidModuleModel, projectNode);
myProjectResolver.populateModuleContentRoots(myAndroidModuleModel, moduleDataNode);
// Verify module has AndroidGradleModel.
Collection<DataNode<AndroidModuleModel>> androidModelNodes = getChildren(moduleDataNode, ANDROID_MODEL);
assertThat(androidModelNodes).hasSize(1);
DataNode<AndroidModuleModel> androidModelNode = getFirstItem(androidModelNodes);
assertNotNull(androidModelNode);
assertSame(myAndroidProject, androidModelNode.getData().getAndroidProject());
// Verify module has IdeaGradleProject.
Collection<DataNode<GradleModuleModel>> gradleModelNodes = getChildren(moduleDataNode, GRADLE_MODULE_MODEL);
assertThat(gradleModelNodes).hasSize(1);
DataNode<GradleModuleModel> gradleModelNode = getFirstItem(gradleModelNodes);
assertNotNull(gradleModelNode);
assertEquals(myAndroidModuleModel.getGradleProject().getPath(), gradleModelNode.getData().getGradlePath());
}
Aggregations