All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.apollographql.apollo.gradle.internal.DefaultApolloExtension.kt Maven / Gradle / Ivy

There is a newer version: 4.1.0
Show newest version
package com.apollographql.apollo.gradle.internal

import com.apollographql.apollo.gradle.api.ApolloExtension
import com.apollographql.apollo.gradle.api.CompilationUnit
import com.apollographql.apollo.gradle.api.CompilerParams
import org.gradle.api.Action
import org.gradle.api.Project

open class DefaultApolloExtension(val project: Project)
  : CompilerParams by project.objects.newInstance(DefaultCompilerParams::class.java)
    , ApolloExtension {
  /**
   * This is the input to the apollo plugin. Users will populate the services from their gradle files
   */
  val services = mutableListOf()

  /**
   * compilationUnits is meant to be consumed by other gradle plugin.
   * The apollo plugin will add the {@link CompilationUnit} as it creates them
   */
  internal val compilationUnits = project.container(DefaultCompilationUnit::class.java)

  override fun onCompilationUnit(action: Action) {
    compilationUnits.all(action)
  }

  override fun service(name: String, action: Action) {
    val service = project.objects.newInstance(DefaultService::class.java, project.objects, name)
    action.execute(service)
    services.add(service)
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy