mirror of
https://github.com/sdkman/sdkman-cli.git
synced 2026-01-31 09:43:04 -05:00
103 lines
2.8 KiB
Groovy
103 lines
2.8 KiB
Groovy
import org.apache.tools.ant.filters.*
|
|
|
|
apply plugin: 'groovy'
|
|
apply plugin: 'idea'
|
|
apply plugin: 'eclipse'
|
|
|
|
defaultTasks 'clean', 'prepareTestScripts', 'prepareScripts', 'prepareServer', 'prepareTemplates', 'assembleArchive', 'test'
|
|
|
|
def userHome = System.getProperty('user.home')
|
|
ext.installBinDir = "${userHome}/.gvm/bin"
|
|
ext.installSrcDir = "${userHome}/.gvm/src"
|
|
|
|
ext.defaultGvmVersion = '1.0.0-SNAPSHOT'
|
|
|
|
loadConfiguration()
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
compile group: 'org.codehaus.groovy', name: 'groovy', version: '2.1.7'
|
|
compile group: 'org.codehaus.groovy', name: 'groovy-templates', version: '2.1.7'
|
|
compile group: 'org.vert-x', name: 'vertx-core', version: '1.3.0.final'
|
|
compile group: 'org.vert-x', name: 'vertx-lang-groovy', version: '1.3.0.final'
|
|
testCompile group: 'junit', name: 'junit', version: '4.11'
|
|
testCompile group: 'info.cukes', name: 'cucumber-groovy', version: '1.1.5'
|
|
testCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.1.5'
|
|
testCompile group: 'org.spockframework', name: 'spock-core', version: '0.7-groovy-2.0'
|
|
}
|
|
|
|
test.testLogging.exceptionFormat = 'full'
|
|
|
|
task wrapper(type: Wrapper) {
|
|
gradleVersion = '1.9'
|
|
}
|
|
|
|
def loadConfiguration() {
|
|
def environment = hasProperty('env') ? env : 'local'
|
|
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/templates"
|
|
into "build/templates"
|
|
include "*.gtpl"
|
|
}
|
|
|
|
task prepareServer(type: Copy){
|
|
from 'src/main/groovy'
|
|
into 'build/server'
|
|
include 'server.groovy'
|
|
filter(ReplaceTokens, tokens: [GVM_VERSION:config.gvmVersion ?: defaultGvmVersion, VERTX_VERSION:config.vertxVersion])
|
|
}
|
|
|
|
task prepareTestScripts(type: Copy) {
|
|
from 'src/main/bash'
|
|
into 'build/testScripts'
|
|
include '**/*'
|
|
filter(ReplaceTokens, tokens: [GVM_VERSION:"x.y.z", GVM_SERVICE:config.gvmService])
|
|
}
|
|
|
|
task prepareScripts(type: Copy) {
|
|
from 'src/main/bash'
|
|
into 'build/scripts'
|
|
include '**/*'
|
|
filter(ReplaceTokens, tokens: [GVM_VERSION:config.gvmVersion ?: defaultGvmVersion, GVM_SERVICE:config.gvmService])
|
|
}
|
|
|
|
task assembleArchive(type: Zip) {
|
|
classifier = 'scripts'
|
|
from "build/scripts"
|
|
include "gvm*"
|
|
}
|
|
|
|
task cleanInstallInit(type: Delete) {
|
|
delete installBinDir
|
|
}
|
|
|
|
task cleanInstallModules(type: Delete) {
|
|
delete installSrcDir
|
|
}
|
|
|
|
task installInit(type: Copy, dependsOn: [cleanInstallInit, prepareScripts]) {
|
|
from "build/scripts"
|
|
into installBinDir
|
|
include "gvm-init.sh"
|
|
}
|
|
|
|
task installModules(type: Copy, dependsOn: [cleanInstallModules, prepareScripts]) {
|
|
from "build/scripts"
|
|
into installSrcDir
|
|
include "gvm-*.sh"
|
|
exclude "gvm-init.sh"
|
|
}
|
|
|
|
task install(dependsOn: [installInit, installModules])
|