Files
sdkman-cli/build.gradle

75 lines
2.0 KiB
Groovy

import org.apache.tools.ant.filters.*
apply plugin: 'groovy'
apply plugin: 'idea'
defaultTasks 'clean', 'prepareScripts', 'prepareServer', 'prepareTemplates', 'assembleArchive', 'test'
ext.installDir = "${System.getProperty('user.home')}/.gvm/bin"
loadConfiguration()
repositories {
mavenCentral()
}
dependencies {
groovy group: 'org.codehaus.groovy', name: 'groovy', version: '2.0.5'
groovy group: 'org.codehaus.groovy', name: 'groovy-templates', version: '2.0.5'
testCompile group: 'junit', name: 'junit', version: '4.10'
testCompile group: 'info.cukes', name: 'cucumber-groovy', version: '1.0.14'
testCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.0.14'
testCompile group: 'org.vert-x', name: 'vertx-core', version: '1.3.0.final'
testCompile group: 'org.vert-x', name: 'vertx-lang-groovy', version: '1.3.0.final'
}
task wrapper(type: Wrapper) {
gradleVersion = '1.3'
}
def loadConfiguration() {
def environment = hasProperty('env') ? env : 'dev'
ext.environment = environment
println "Environment is set to: $environment"
def configFile = file('config.groovy')
def config = new ConfigSlurper(environment).parse(configFile.toURL())
ext.config = config
}
task prepareTemplates(type: Copy) {
from "src/main/resources/templates"
into "build/templates"
include "*.gtpl"
}
task prepareServer(type: Copy){
from 'src/main/resources'
into 'build/server'
include 'server.groovy'
filter(ReplaceTokens, tokens: [GVM_VERSION:config.gvmVersion, VERTX_VERSION:config.vertxVersion])
}
task prepareScripts(type: Copy) {
from 'src/main/resources/scripts'
into 'build/scripts'
include '**/*'
filter(ReplaceTokens, tokens: [GVM_VERSION:config.gvmVersion, GVM_SERVICE:config.gvmService])
}
task assembleArchive(type: Zip) {
classifier = 'scripts'
from "build/scripts"
include "gvm*"
}
task cleanInstall(type: Delete) {
delete installDir
}
task install(type: Copy, dependsOn: [clean, cleanInstall, prepareScripts]) {
from "build/scripts"
into installDir
include "gvm*"
}