-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
126 lines (105 loc) · 3.98 KB
/
build.gradle
File metadata and controls
126 lines (105 loc) · 3.98 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import org.apache.tools.ant.taskdefs.condition.Os
buildscript {
repositories {
//mavenCentral()
maven {url "http://nexus.cb.ntent.com/nexus/content/groups/public/"}
}
dependencies {
classpath group: "com.ntent.gradle", name: "gradle-build-utils", version: ntent_gradle_utils_version
classpath group: "gradle.plugin.com.github.maiflai", name: "gradle-scalatest", version: "0.23"
}
}
plugins {
id 'de.undercouch.download' version '4.0.0'
}
def consulDownloadUrl
def consulFile
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
consulFile = "consul.exe"
consulDownloadUrl = "https://releases.hashicorp.com/consul/1.6.2/consul_1.6.2_windows_amd64.zip"
} else if (Os.isFamily(Os.FAMILY_MAC)) {
consulFile = "consul"
consulDownloadUrl = "https://releases.hashicorp.com/consul/1.6.2/consul_1.6.2_darwin_amd64.zip"
} else { // linux
consulFile = "consul"
consulDownloadUrl = "https://releases.hashicorp.com/consul/1.6.2/consul_1.6.2_linux_amd64.zip"
}
def consulExists = rootProject.layout.projectDirectory.file("bin/${consulFile}").asFile.exists()
subprojects {
apply plugin: 'scala'
apply plugin: "com.ntent.gradle.build-utils"
apply plugin: 'com.ntent.gradle.publish-utils'
apply plugin: 'com.github.maiflai.scalatest'
group = 'com.ntent'
project.sourceCompatibility = '1.8'
project.targetCompatibility = '1.8'
compileScala {
scalaCompileOptions.metaClass.useAnt = false
}
repositories {
maven {url "http://nexus.cb.ntent.com/nexus/content/groups/public/"}
}
}
allprojects {
repositories.maven { url "http://nexus.cb.ntent.com/nexus/content/groups/public/" }
configurations.all {resolutionStrategy.cacheChangingModulesFor 0, 'seconds'}
}
project(":consul-client_$scalaVersion") {
sourceSets {
test {
resources {
srcDirs "src/main/resources","src/test/resources"
}
}
}
dependencies {
compile "com.typesafe:config:1.3.0"
compile "org.scala-lang:scala-library:$scala_version"
compile 'org.apache.httpcomponents:fluent-hc:4.2.6'
compile group: 'com.fasterxml.jackson.module', name: "jackson-module-scala_$scalaVersion", version: '2.9.5'
compile group: 'io.reactivex', name: "rxscala_$scalaVersion", version: '0.26.3'
compile group: 'com.typesafe.scala-logging', name: "scala-logging_$scalaVersion", version: '3.9.2'
// test
testCompile 'org.slf4j:slf4j-simple:1.7.14'
testCompile "org.scalamock:scalamock-scalatest-support_$scalaVersion:3.3.0"
testCompile "org.scalatest:scalatest_$scalaVersion:3.0.0"
testCompile 'org.apache.commons:commons-io:1.3.2'
//testCompile "org.slf4j:slf4j-api:$slf4j_version"
testCompile 'junit:junit-dep:4.11'
testRuntime 'org.pegdown:pegdown:1.4.2'
}
task sourceJar(type: Jar) {
from sourceSets.main.allSource
}
publishing {
publications {
mavenPub(MavenPublication) {
from components.java
artifact sourceJar {classifier "sources"}
}
}
}
/*
Get consul for tests
*/
task downloadConsul(type: Download) {
onlyIf { !consulExists }
src consulDownloadUrl
dest new File(rootProject.buildDir, 'consul.zip')
}
task getConsul(type: Copy) {
dependsOn downloadConsul
onlyIf {
// see if we don't already have it.
def exists = consulExists
if (exists)
logger.info "${consulFile} already exists!"
else
logger.info "${consulFile} does not exist!"
return !exists
}
from zipTree(new File(rootProject.buildDir,'consul.zip'))
into rootProject.layout.projectDirectory.dir("bin")
}
project.tasks.test.dependsOn(project.tasks.getConsul)
}