buildscript {
    repositories {
        mavenLocal()
        maven { url "https://repo.grails.org/artifactory/core" }
        maven { url "https://repo.grails.org/grails/core" }
    }
    dependencies {
        classpath "org.grails:grails-gradle-plugin:${grailsVersion}"
    }
}

group(System.getenv('GROUP') ?: 'org.grails.plugins')

apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"org.grails.grails-plugin"
apply plugin:"maven-publish"

ext {
    grailsVersion = project.grailsVersion
    gradleWrapperVersion = project.gradleWrapperVersion
}

repositories {    
    mavenCentral()
    maven { url "https://repo.grails.org/artifactory/core" }
    maven { url "https://repo.grails.org/grails/core" }
}

dependencyManagement {
    imports {
        mavenBom "org.grails:grails-bom:$grailsVersion"
    }
    applyMavenExclusions false
}

dependencies {
    compile "org.springframework.boot:spring-boot-starter-logging"
    compile "org.springframework.boot:spring-boot-autoconfigure"
    compile "org.grails:grails-core"

    compile project (":groovy-aws-sdk-util")

    console "org.grails:grails-console"

    profile "org.grails.profiles:plugin"

    provided "org.grails:grails-plugin-services"
    provided "org.grails:grails-plugin-domain-class"

    testCompile 'org.grails:grails-gorm-testing-support:2.0.0'
    testCompile 'org.grails:grails-web-testing-support:2.0.0'

    testCompile 'net.bytebuddy:byte-buddy:1.9.14'

}

publishing {
    repositories {
        maven {
            name = "GitHubPackages"
            url = uri("https://maven.pkg.github.com/agorapulse/grails-aws-sdk")
            credentials {
                username = System.getenv("GITHUB_ACTOR")
                password = System.getenv("GITHUB_TOKEN")
            }
        }
        if (System.getenv('DEPLOYER_PASSWORD')) {
            maven {
                name = "JFrog"
                credentials {
                    username "deployer"
                    password System.getenv('DEPLOYER_PASSWORD')
                }
                if (project.version.endsWith('-SNAPSHOT')) {
                    url 'https://agorapulse.jfrog.io/agorapulse/plugins-snapshots-local/'
                } else {
                    url 'https://agorapulse.jfrog.io/agorapulse/plugins-releases-local/'
                }
            }
        }
    }
    publications {
        gpr(MavenPublication) {
            from(components.java)
        }
    }
}
