-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
executable file
·57 lines (42 loc) · 1.41 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
import java.util.regex.Matcher
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = '1.0'
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
repositories {
mavenCentral()
}
dependencies {
compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.11.0'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
testCompile group: 'com.qiniu', name: 'happy-dns-java', version: '0.1.6'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
task getHomeDir << {
println gradle.gradleHomeDir
}
apply plugin: 'checkstyle'
def versionName() {
String config = 'src/main/java/com/qiniu/common/Constants.java'
String fileContents = new File(config).text
Matcher myMatcher = fileContents =~ /VERSION = "(.+)";/
String version = myMatcher[0][1]
println(version)
return version
}
static 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