com.apollographql.apollo.gradle.internal.DefaultService.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apollo-gradle-plugin Show documentation
Show all versions of apollo-gradle-plugin Show documentation
Gradle plugin for generating java/kotlin classes for graphql files
package com.apollographql.apollo.gradle.internal
import com.apollographql.apollo.gradle.api.CompilerParams
import com.apollographql.apollo.gradle.api.Introspection
import com.apollographql.apollo.gradle.api.Service
import org.gradle.api.Action
import org.gradle.api.model.ObjectFactory
import javax.inject.Inject
open class DefaultService @Inject constructor(val objects: ObjectFactory, val name: String)
: CompilerParams by objects.newInstance(DefaultCompilerParams::class.java), Service {
override val schemaPath = objects.property(String::class.java)
override val sourceFolder = objects.property(String::class.java)
override val exclude = objects.listProperty(String::class.java)
var introspection: DefaultIntrospection? = null
override fun introspection(configure: Action) {
val introspection = objects.newInstance(DefaultIntrospection::class.java, objects)
if (this.introspection != null) {
throw IllegalArgumentException("there must be only one introspection block")
}
configure.execute(introspection)
if (!introspection.endpointUrl.isPresent) {
throw IllegalArgumentException("introspection must have a url")
}
this.introspection = introspection
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy