buildscript {
    repositories {
        mavenCentral()
        maven { url = uri("https://plugins.gradle.org/m2/") }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")
        classpath "com.avast.gradle:gradle-docker-compose-plugin:0.12.0"
    }
}

apply plugin: 'docker-compose'

allprojects {
    group = "net.chrisrichardson.eventstore.javacustomersandorders"
}

subprojects {
    apply plugin: 'java'
    sourceCompatibility = 1.8
    targetCompatibility = 1.8

    repositories {
        mavenCentral()
        eventuateMavenRepoUrl.split(',').each { repoUrl -> maven { url repoUrl } }
        mavenLocal()
    }

    dependencies {
        implementation(platform("io.eventuate.platform:eventuate-platform-dependencies:$eventuateBomVersion"))

        testImplementation "junit:junit:4.12"

    }
}

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

    if (project.ext.has("envFile")) {
        environment.put "ENV_FILE", project.ext.envFile
    }

    mysqlbinlog {
        projectName = null
        useComposeFiles = ["docker-compose-eventuate-local-mysql-binlog.yml"]
    }

    postgrespolling {
        projectName = null
        useComposeFiles = ["docker-compose-eventuate-local-postgres-polling.yml"]
    }

    postgreswal {
        projectName = null
        useComposeFiles = ["docker-compose-eventuate-local-postgres-wal.yml"]
    }
}
