use of org.jetbrains.plugins.gradle.model.ear.EarConfiguration in project intellij-community by JetBrains.
the class JavaEEGradleProjectResolverExtension method populateModuleExtraModels.
@Override
public void populateModuleExtraModels(@NotNull IdeaModule gradleModule, @NotNull final DataNode<ModuleData> ideModule) {
final WebConfiguration webConfiguration = resolverCtx.getExtraProject(gradleModule, WebConfiguration.class);
final NotNullLazyValue<DataNode<? extends ModuleData>> findTargetModuleNode = new NotNullLazyValue<DataNode<? extends ModuleData>>() {
@NotNull
@Override
protected DataNode<? extends ModuleData> compute() {
final String mainSourceSetModuleId = ideModule.getData().getId() + ":main";
DataNode<? extends ModuleData> targetModuleNode = ExternalSystemApiUtil.find(ideModule, GradleSourceSetData.KEY, node -> mainSourceSetModuleId.equals(node.getData().getId()));
if (targetModuleNode == null) {
targetModuleNode = ideModule;
}
return targetModuleNode;
}
};
if (webConfiguration != null) {
final List<War> warModels = ContainerUtil.map(webConfiguration.getWarModels(), new Function<WebConfiguration.WarModel, War>() {
@Override
public War fun(WebConfiguration.WarModel model) {
War war = new War(model.getWarName(), model.getWebAppDirName(), model.getWebAppDir());
war.setWebXml(model.getWebXml());
war.setWebResources(mapWebResources(model.getWebResources()));
war.setClasspath(model.getClasspath());
war.setManifestContent(model.getManifestContent());
war.setArchivePath(model.getArchivePath());
return war;
}
});
findTargetModuleNode.getValue().createChild(WebConfigurationModelData.KEY, new WebConfigurationModelData(GradleConstants.SYSTEM_ID, warModels));
}
final EarConfiguration earConfiguration = resolverCtx.getExtraProject(gradleModule, EarConfiguration.class);
if (earConfiguration != null) {
final List<Ear> warModels = ContainerUtil.map(earConfiguration.getEarModels(), new Function<EarConfiguration.EarModel, Ear>() {
@Override
public Ear fun(EarConfiguration.EarModel model) {
Ear ear = new Ear(model.getEarName(), model.getAppDirName(), model.getLibDirName());
ear.setManifestContent(model.getManifestContent());
ear.setDeploymentDescriptor(model.getDeploymentDescriptor());
ear.setResources(mapEarResources(model.getResources()));
ear.setArchivePath(model.getArchivePath());
return ear;
}
});
final Collection<DependencyData> deployDependencies = GradleProjectResolverUtil.getIdeDependencies(resolverCtx, findTargetModuleNode.getValue(), earConfiguration.getDeployDependencies());
final Collection<DependencyData> earlibDependencies = GradleProjectResolverUtil.getIdeDependencies(resolverCtx, findTargetModuleNode.getValue(), earConfiguration.getEarlibDependencies());
findTargetModuleNode.getValue().createChild(EarConfigurationModelData.KEY, new EarConfigurationModelData(GradleConstants.SYSTEM_ID, warModels, deployDependencies, earlibDependencies));
}
nextResolver.populateModuleExtraModels(gradleModule, ideModule);
}
Aggregations