plugins {
    id 'nu.studer.jooq' version '10.1.1'
    id 'java'
}

repositories {
    mavenCentral()
}

dependencies {
    jooqGenerator 'com.h2database:h2:2.4.240'
}

jooq {
    configurations {
        main {
            generationTool {
                logging = org.jooq.meta.jaxb.Logging.WARN
                jdbc {
                    driver = 'org.h2.Driver'
                    url = 'jdbc:h2:~/test;AUTO_SERVER=TRUE'
                    user = 'sa'
                    password = ''
                }
                generator {
                    name = 'org.jooq.codegen.DefaultGenerator'
                    database {
                        name = 'org.jooq.meta.h2.H2Database'
                        includes = '.*'
                        excludes = ''
                    }
                    target {
                        packageName = 'nu.studer.sample'
                    }
                }
            }
        }
    }
}

tasks.named('generateJooq').configure {
    // make jOOQ task participate in incremental builds (which is also a prerequisite for build caching)
    allInputsDeclared = true
}
