build.gradle 2.7 KB
Newer Older
1
import io.github.kobylynskyi.graphql.codegen.gradle.GraphQLCodegenGradleTask
2 3 4 5 6

plugins {
    id "java"
    id "idea"
    id "application"
7 8 9

    // use the latest available version:
    // https://plugins.gradle.org/plugin/io.github.kobylynskyi.graphql.codegen
10
    id "io.github.kobylynskyi.graphql.codegen" version "2.3.1-SNAPSHOT"
11 12
}

13
mainClassName = "io.github.kobylynskyi.order.Application"
14 15

dependencies {
16
    implementation "org.springframework.boot:spring-boot-starter-web:2.3.1.RELEASE"
17
    implementation "org.springframework.boot:spring-boot-starter-data-mongodb:2.3.1.RELEASE"
18

19
    implementation "com.graphql-java-kickstart:graphql-spring-boot-starter:7.1.0"
20
    implementation "com.graphql-java-kickstart:graphiql-spring-boot-starter:7.1.0"
21

22 23
    // use the latest available version:
    // https://search.maven.org/artifact/io.github.kobylynskyi/graphql-java-codegen
24
    implementation "io.github.kobylynskyi:graphql-java-codegen:2.3.1-SNAPSHOT"
25

26
    implementation "org.apache.httpcomponents:httpclient:4.5.12"
27
    implementation "javax.validation:validation-api:2.0.1.Final"
28

29 30
    implementation "org.mapstruct:mapstruct:1.3.1.Final"
    annotationProcessor "org.mapstruct:mapstruct-processor:1.3.1.Final"
31

32 33
    compileOnly "org.projectlombok:lombok:1.18.12"
    annotationProcessor "org.projectlombok:lombok:1.18.12"
34

35
    testImplementation "io.rest-assured:rest-assured:4.3.1"
36
    testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
37
    testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.6.2"
38 39 40 41 42 43
}

/**
 * Generate requests and model from external service
 */
compileJava.dependsOn "graphqlCodegenProductService"
44
sourceSets.main.java.srcDir "$buildDir/generated-client"
45
task graphqlCodegenProductService(type: GraphQLCodegenGradleTask) {
46 47 48 49 50 51 52
    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"
53
    generateClient = true
54 55 56 57 58 59 60
    generateApis = false
}

/**
 * Generate apis and model
 */
compileJava.dependsOn "graphqlCodegenOrderService"
61
sourceSets.main.java.srcDir "$buildDir/generated-server"
62
task graphqlCodegenOrderService(type: GraphQLCodegenGradleTask) {
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
    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()
}