import io.github.kobylynskyi.graphql.codegen.gradle.GraphQLCodegenGradleTask plugins { id "java" id "idea" id "application" // use the latest available version: // https://plugins.gradle.org/plugin/io.github.kobylynskyi.graphql.codegen id "io.github.kobylynskyi.graphql.codegen" version "2.2.2-SNAPSHOT" } mainClassName = "io.github.kobylynskyi.order.Application" dependencies { implementation "org.springframework.boot:spring-boot-starter-web:2.3.1.RELEASE" implementation "org.springframework.boot:spring-boot-starter-data-mongodb:2.3.1.RELEASE" implementation "com.graphql-java-kickstart:graphql-spring-boot-starter:7.1.0" implementation "com.graphql-java-kickstart:graphiql-spring-boot-starter:7.1.0" // use the latest available version: // https://search.maven.org/artifact/io.github.kobylynskyi/graphql-java-codegen implementation "io.github.kobylynskyi:graphql-java-codegen:2.2.2-SNAPSHOT" implementation "org.apache.httpcomponents:httpclient:4.5.12" implementation "javax.validation:validation-api:2.0.1.Final" implementation "org.mapstruct:mapstruct:1.3.1.Final" annotationProcessor "org.mapstruct:mapstruct-processor:1.3.1.Final" compileOnly "org.projectlombok:lombok:1.18.12" annotationProcessor "org.projectlombok:lombok:1.18.12" testImplementation "io.rest-assured:rest-assured:4.3.1" testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.2" } /** * Generate requests and model from external service */ compileJava.dependsOn "graphqlCodegenProductService" sourceSets.main.java.srcDir "$buildDir/generated-client" task graphqlCodegenProductService(type: GraphQLCodegenGradleTask) { graphqlSchemaPaths = ["$projectDir/src/main/resources/external/schema-product-service.graphqls".toString()] outputDir = new File("$buildDir/generated-client") modelPackageName = "io.github.kobylynskyi.product.graphql.model" customTypesMapping = [ DateTime: "java.util.Date" ] modelNameSuffix = "TO" generateClient = true generateApis = false } /** * Generate apis and model */ compileJava.dependsOn "graphqlCodegenOrderService" sourceSets.main.java.srcDir "$buildDir/generated-server" task graphqlCodegenOrderService(type: GraphQLCodegenGradleTask) { graphqlSchemaPaths = ["$projectDir/src/main/resources/schema.graphqls".toString()] outputDir = new File("$buildDir/generated-server") apiPackageName = "io.github.kobylynskyi.order.graphql.api" modelPackageName = "io.github.kobylynskyi.order.graphql.model" customTypesMapping = [ DateTime: "java.util.Date" ] modelNameSuffix = "TO" } repositories { jcenter() mavenCentral() mavenLocal() }