Search in sources :

Example 1 with ScalaModel

use of org.jetbrains.plugins.gradle.model.scala.ScalaModel in project intellij-community by JetBrains.

the class ScalaGradleProjectResolverExtension method populateModuleExtraModels.

@Override
public void populateModuleExtraModels(@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule) {
    ScalaModel scalaModel = resolverCtx.getExtraProject(gradleModule, ScalaModel.class);
    if (scalaModel != null) {
        ScalaModelData scalaModelData = create(scalaModel);
        ideModule.createChild(ScalaModelData.KEY, scalaModelData);
    }
    nextResolver.populateModuleExtraModels(gradleModule, ideModule);
}
Also used : ScalaModel(org.jetbrains.plugins.gradle.model.scala.ScalaModel) ScalaModelData(org.jetbrains.plugins.gradle.model.data.ScalaModelData)

Example 2 with ScalaModel

use of org.jetbrains.plugins.gradle.model.scala.ScalaModel in project intellij-community by JetBrains.

the class ScalaModelBuilderImplTest method testScalaModel.

@Test
public void testScalaModel() throws Exception {
    DomainObjectSet<? extends IdeaModule> ideaModules = allModels.getIdeaProject().getModules();
    List<ScalaModel> scalaModels = ContainerUtil.mapNotNull(ideaModules, new Function<IdeaModule, ScalaModel>() {

        @Override
        public ScalaModel fun(IdeaModule module) {
            return allModels.getExtraProject(module, ScalaModel.class);
        }
    });
    assertEquals(1, scalaModels.size());
    ScalaModel scalaModel = scalaModels.get(0);
    ScalaCompileOptions scalaCompileOptions = scalaModel.getScalaCompileOptions();
    assertNotNull(scalaCompileOptions);
    assertEquals(1, scalaCompileOptions.getAdditionalParameters().size());
    assertEquals("-opt:opt", scalaCompileOptions.getAdditionalParameters().iterator().next());
}
Also used : ScalaCompileOptions(org.jetbrains.plugins.gradle.model.scala.ScalaCompileOptions) IdeaModule(org.gradle.tooling.model.idea.IdeaModule) ScalaModel(org.jetbrains.plugins.gradle.model.scala.ScalaModel) Test(org.junit.Test)

Aggregations

ScalaModel (org.jetbrains.plugins.gradle.model.scala.ScalaModel)2 IdeaModule (org.gradle.tooling.model.idea.IdeaModule)1 ScalaModelData (org.jetbrains.plugins.gradle.model.data.ScalaModelData)1 ScalaCompileOptions (org.jetbrains.plugins.gradle.model.scala.ScalaCompileOptions)1 Test (org.junit.Test)1