forked from qiniu/java-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
executable file
·53 lines (40 loc) · 1.35 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
import java.util.regex.Matcher
apply plugin: 'java'
sourceCompatibility = 1.6
targetCompatibility = 1.6
version = '1.0'
[compileJava,compileTestJava,javadoc]*.options*.encoding = 'UTF-8'
repositories {
mavenCentral()
}
dependencies {
compile group:'com.squareup.okhttp', name:'okhttp', version:'2.3.0'
compile group:'com.google.code.gson', name:'gson', version:'2.3.1'
testCompile group: 'junit', name: 'junit', version: '4.11'
//okhttp jdk 6 version, only for jdk6 test
testRuntime fileTree(dir: 'libs', include: '*.jar')
}
apply plugin: 'checkstyle'
def versionName() {
String config = 'src/main/java/com/qiniu/common/Config.java'
String fileContents = new File(config).text
Matcher myMatcher = fileContents =~ /VERSION = "(.+)";/
String version = myMatcher[0][1]
println(version)
return version
}
def versionNameToCode(String version) {
String v = version.replaceAll(/\./, '')
return v.toLong()
}
String version = versionName()
int code = versionNameToCode(version)
setProperty('VERSION_NAME', version)
setProperty('VERSION_CODE', code)
apply from: 'mvn_push.gradle'
apply plugin: 'eclipse'
task gen_eclipse(dependsOn:[
'cleanEclipseProject', 'cleanEclipseClasspath',
'eclipseProject', 'eclipseClasspath'])
eclipseProject.mustRunAfter cleanEclipseProject
eclipseClasspath.mustRunAfter cleanEclipseClasspath