buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "io.spring.gradle:dependency-management-plugin:0.6.0.RELEASE"
        // if using Stub Runner (consumer side) only remove this dependency
        classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:1.1.1.RELEASE"
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
    }
}



apply plugin: "io.spring.dependency-management"
apply plugin: 'docker-compose'

dockerCompose.isRequiredBy(test)

dependencyManagement {
    imports {
            mavenBom 'org.springframework.cloud:spring-cloud-contract-dependencies:2.2.5.RELEASE'
    }
}

apply plugin: 'org.springframework.boot'

dockerCompose {
    environment.put "EVENTUATE_COMMON_VERSION", eventuateCommonImageVersion
    environment.put "EVENTUATE_MESSAGING_KAFKA_IMAGE_VERSION", eventuateMessagingKafkaImageVersion
    environment.put "EVENTUATE_CDC_VERSION", eventuateCdcImageVersion
    environment.put "EVENTUATE_JAVA_BASE_IMAGE_VERSION", eventuateExamplesBaseImageVersion

    projectName = null

    if ("postgres,EventuatePolling".equals(System.getenv("SPRING_PROFILES_ACTIVE")))
        useComposeFiles = ['../docker-compose-eventuate-local-postgres-polling.yml']
    else if ("postgres,PostgresWal".equals(System.getenv("SPRING_PROFILES_ACTIVE")))
        useComposeFiles = ['../docker-compose-eventuate-local-postgres-wal.yml']
    else useComposeFiles = ['../docker-compose-eventuate-local-mysql-binlog.yml']

    startedServices = ['customers-service']
}

dependencies {
    compile project(":orders-service-api-web")
    compile project(":customers-service-api-messaging")
    compile project(":orders-service-api-messaging")
    compile project(":common-swagger")

    compile "org.springframework.boot:spring-boot-starter:$springBootVersion"
    compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
    compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
    compile "io.eventuate.local.java:eventuate-local-java-spring-jdbc-starter"


    testCompile "net.chrisrichardson.eventstore.examples.customersandorders:common-contracts:1.0-SNAPSHOT:stubs"

    testCompile "io.eventuate.local.java:eventuate-client-java-spring-jdbc"
    testCompile project(":customers-service-api-web")
    testCompile "org.springframework.cloud:spring-cloud-contract-wiremock"
    testCompile "org.springframework.cloud:spring-cloud-starter-contract-stub-runner"
    testCompile "junit:junit:4.12"
    testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
    testCompile "io.eventuate.local.java:eventuate-client-java-spring-jdbc"
    testCompile 'com.jayway.restassured:rest-assured:2.3.0'
    testCompile "com.jayway.jsonpath:json-path:2.3.0"
}
