Permalink
Fetching contributors…
Cannot retrieve contributors at this time
130 lines (106 sloc) 3.15 KB
import org.apache.tools.ant.filters.*
buildscript {
repositories {
jcenter()
}
}
plugins {
id "com.gradle.build-scan" version "1.1.1"
id "com.jfrog.bintray" version "1.7"
}
buildScan {
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
licenseAgree = 'yes'
}
apply plugin: 'groovy'
def userHome = System.getProperty('user.home')
ext.installBinDir = "${userHome}/.sdkman/bin"
ext.installSrcDir = "${userHome}/.sdkman/src"
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
}
loadConfiguration()
ext.buildNumber = System.getenv("TRAVIS_BUILD_NUMBER") ?: '0'
ext.sdkmanCliBuildVersion = "${config.sdkmanCliVersion}+${buildNumber}".toString()
repositories {
jcenter()
}
dependencies {
compile 'org.codehaus.groovy:groovy:2.4.7'
compile 'org.codehaus.groovy:groovy-templates:2.4.7'
compile 'org.codehaus.groovy:groovy-json:2.4.7'
testCompile 'junit:junit:4.11'
testCompile 'info.cukes:cucumber-groovy:1.2.4'
testCompile 'info.cukes:cucumber-junit:1.2.4'
testCompile('org.spockframework:spock-core:0.7-groovy-2.0') {
exclude module: 'groovy-all'
}
testCompile('com.github.tomakehurst:wiremock:2.3.1') {
exclude module: 'junit'
}
}
test.testLogging.exceptionFormat = 'full'
task prepareScripts(type: Copy) {
from 'src/main/bash'
into 'build/scripts'
include '**/*'
filter(ReplaceTokens, tokens:
[
SDKMAN_VERSION : sdkmanCliBuildVersion,
SDKMAN_LEGACY_API : config.sdkmanLegacyApi,
SDKMAN_CURRENT_API: config.sdkmanCurrentApi
]
)
}
test.dependsOn prepareScripts
task assembleArchive(type: Zip, dependsOn: prepareScripts) {
appendix = "cli"
version = sdkmanCliBuildVersion
from "build/scripts"
include "*.sh*"
}
assemble.dependsOn assembleArchive
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 "sdkman-init.sh"
}
task installModules(type: Copy, dependsOn: [cleanInstallModules, prepareScripts]) {
from "build/scripts"
into installSrcDir
include "sdkman-*.sh"
exclude "sdkman-init.sh"
}
task install(dependsOn: [installInit, installModules])
bintray {
user = System.getenv('BINTRAY_USERNAME')
key = System.getenv('BINTRAY_API_KEY')
publish = true
filesSpec {
from 'build/distributions'
into '.'
}
pkg {
repo = 'generic'
name = 'sdkman-cli'
userOrg = 'sdkman'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/sdkman/sdkman-cli.git'
version {
name = sdkmanCliBuildVersion
desc = 'Binary zip distribution of SDKMAN bash client.'
released = new Date()
}
}
}