-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
76 lines (59 loc) · 2.09 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'application'
mainClassName = "com.thoughtworks.fedex.ConsentServiceMain"
repositories {
mavenCentral()
}
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
project.ext {
dropwizardVersion = '0.6.2'
chefDir = "$projectDir/chef"
chefFilesDir = "$chefDir/cookbooks/consent_service/files/default"
knifeConfigFile = "$chefDir/.chef/knife.rb"
knifeRoleFile = "$chefDir/roles/consent_service_server.rb"
}
run {
args 'server', 'src/main/resources/consent.yaml'
}
dependencies {
compile 'com.google.guava:guava:14.0.1'
compile 'org.slf4j:slf4j-api:1.7.5'
compile "com.yammer.dropwizard:dropwizard-core:$dropwizardVersion"
compile "com.yammer.dropwizard:dropwizard-db:$dropwizardVersion"
compile "com.yammer.dropwizard:dropwizard-hibernate:$dropwizardVersion"
compile "com.yammer.dropwizard:dropwizard-migrations:$dropwizardVersion"
compile "org.hibernate:hibernate-core:4.2.4.Final"
compile 'org.liquibase:liquibase-core:3.0.2'
runtime 'com.h2database:h2:1.3.173'
testCompile "junit:junit:4.11"
}
task uberjar(type: Jar, dependsOn: jar) {
classifier = "standalone"
from files(sourceSets.main.output.classesDir)
from files(sourceSets.main.output.resourcesDir)
from configurations.runtime.asFileTree.files.collect { zipTree(it) }
exclude("META-INF/*.SF")
exclude("META-INF/*.DSA")
exclude("META-INF/*.RSA")
manifest {
attributes 'Main-Class': mainClassName
}
}
task cleanChef() << {
file("$chefFilesDir/consent.yaml").delete()
file("$chefFilesDir/consent_service-standalone.jar").delete()
}
task generateChef(type: Copy, dependsOn: [cleanChef, uberjar]) {
from('src/main/resources/consent.yaml')
from("$buildDir/libs/consent_service-standalone.jar")
into chefFilesDir
}
private void chefExecute(String command) {
println command.execute(null, new File(chefDir)).text
}
task uploadChef(dependsOn: generateChef) << {
chefExecute("knife cookbook upload --all -c $knifeConfigFile")
chefExecute("knife role from file $knifeRoleFile")
}