-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
60 lines (51 loc) · 2.13 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
apply plugin: 'groovy'
sourceCompatibility = '1.8'
def moquiDir = file(projectDir.absolutePath + '/../../..')
def frameworkDir = file(moquiDir.absolutePath + '/framework')
def componentNode = parseComponent(project)
version = componentNode.@version
// to run use "gradle dependencyUpdates"
apply plugin: 'com.github.ben-manes.versions'
buildscript {
repositories { jcenter() }
dependencies { classpath 'com.github.ben-manes:gradle-versions-plugin:0.13.0' }
}
dependencyUpdates.resolutionStrategy = {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm'].any { qualifier -> selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/ }
if (rejected) selection.reject('Release candidate')
}
}
}
// maybe in the future: repositories { mavenCentral() }
repositories {
flatDir name: 'frameworkLib', dirs: frameworkDir.absolutePath + '/lib'
//flatDir name: 'localLib', dirs: projectDir.absolutePath + '/lib'
jcenter()
}
dependencies {
compile project(':framework')
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2'
compile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.2'
testCompile project(':framework').configurations.testCompile.allDependencies
}
// by default the Java plugin runs test on build, change to not do that (only run test if explicit task)
check.dependsOn.remove(test)
task cleanLib(type: Delete) { delete fileTree(dir: projectDir.absolutePath + '/lib', include: '*') }
clean.dependsOn cleanLib
jar {
destinationDir = file(projectDir.absolutePath + '/lib')
// this is required to change from the default that includes the path to this module (ie 'runtime/base-componet/example')
baseName = componentNode.@name
}
task copyDependencies {
doLast {
copy {
from(configurations.runtime - project(':framework').configurations.runtime - project(':framework').jar.archivePath)
into file(projectDir.absolutePath + '/lib')
}
}
}
copyDependencies.dependsOn cleanLib
jar.dependsOn copyDependencies