apply plugin: 'groovy'
apply plugin: 'java'

group 'com.eastwood.tools.plugins'
sourceCompatibility = 1.8

repositories {
    google()
    jcenter()
}

dependencies {
    compile gradleApi()
    compile localGroovy()
    implementation 'com.android.tools.build:gradle:3.1.0'
}

apply plugin: 'maven'

def groupId = 'com.eastwood.tools.plugins'
def artifactId = 'micro-module'
def version = '1.4.0'

def localReleaseDest = "${buildDir}/release/${version}"

uploadArchives {
   repositories {
       mavenDeployer {
           pom.groupId = groupId
           pom.artifactId = artifactId
           pom.version = version
           // Add other pom properties here if you want (developer details / licenses)
           repository(url: "file://${localReleaseDest}")
       }
   }
}


task zipRelease(type: Zip) {
   from localReleaseDest
   destinationDir buildDir
   archiveName "release-${version}.zip"
}

task generateRelease {
   doLast {
       println "Release ${version} can be found at ${localReleaseDest}/"
       println "Release ${version} zipped can be found ${buildDir}/release-${version}.zip"
   }
}

generateRelease.dependsOn(uploadArchives)
generateRelease.dependsOn(zipRelease)