mirror of
https://github.com/sdkman/sdkman-cli.git
synced 2026-01-31 09:43:04 -05:00
118 lines
2.9 KiB
Groovy
118 lines
2.9 KiB
Groovy
import org.apache.tools.ant.filters.*
|
|
|
|
buildscript {
|
|
repositories {
|
|
jcenter()
|
|
}
|
|
}
|
|
|
|
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 {
|
|
jcenter()
|
|
}
|
|
|
|
dependencies {
|
|
compile 'org.codehaus.groovy:groovy:2.3.7'
|
|
compile 'org.codehaus.groovy:groovy-templates:2.3.7'
|
|
testCompile 'junit:junit:4.11'
|
|
testCompile 'info.cukes:cucumber-groovy:1.1.8'
|
|
testCompile 'info.cukes:cucumber-junit:1.1.8'
|
|
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
|
|
testCompile 'com.github.tomakehurst:wiremock:1.46'
|
|
}
|
|
|
|
test.testLogging.exceptionFormat = 'full'
|
|
|
|
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/vertx'
|
|
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,
|
|
GVM_BROKER_SERVICE : config.gvmBrokerService,
|
|
GVM_BROADCAST_SERVICE: config.gvmBroadcastService
|
|
]
|
|
)
|
|
}
|
|
|
|
task prepareScripts(type: Copy) {
|
|
from 'src/main/bash'
|
|
into 'build/scripts'
|
|
include '**/*'
|
|
filter(ReplaceTokens, tokens:
|
|
[
|
|
GVM_VERSION : config.gvmVersion ?: defaultGvmVersion,
|
|
GVM_SERVICE : config.gvmService,
|
|
GVM_BROKER_SERVICE : config.gvmBrokerService,
|
|
GVM_BROADCAST_SERVICE: config.gvmBroadcastService
|
|
]
|
|
)
|
|
}
|
|
|
|
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])
|