-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
executable file
·169 lines (151 loc) · 5.72 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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.3'
classpath 'com.vanniktech:gradle-android-junit-jacoco-plugin:0.5.0'
}
}
plugins {
id "com.github.hierynomus.license" version "0.14.0"
}
apply plugin: 'com.android.library'
apply plugin: 'checkstyle'
apply plugin: 'com.getkeepsafe.dexcount'
ext.disableCov = project.hasProperty('disableCov') ? project.getProperty('disableCov') : 'false'
if(!disableCov.toBoolean()){
apply plugin: 'com.vanniktech.android.junit.jacoco'
junitJacoco {
excludes = ['com/taobao/weex/dom/flex/**','com/taobao/weex/ui/view/refresh/circlebar/**']
}
}
task checkstyle(type: Checkstyle) {
configFile file("${project.rootDir}/config/quality/checkstyle.xml") // Where my checkstyle config is...
// configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath // Where is my suppressions file for checkstyle is...
source 'src'
include '**/*.java'
exclude '**/gen/**'
exclude '**/test/**'
exclude '**/com/taobao/weex/dom/flex/**'
classpath = files()
}
checkstyle {
toolVersion = '6.9'
}
version = "0.18.0"
android {
compileSdkVersion COMPILE_SDK_VERSION as int
buildToolsVersion BUILD_TOOLS_VERSION
resourcePrefix "weex"
useLibrary 'org.apache.http.legacy'
copy {
from '../../pre-build'
into new File(projectDir,"assets")
include 'native-bundle-main.js'
rename('native-bundle-main.js','main.js')
}
def line
new File(projectDir,"assets/main.js").withReader { line = it.readLine() }
def m = line =~ /[A-Z\s]+\s+([0-9\.]+),\s+Build\s+[0-9]+/;
def jsfmVersion = m[0][1]
println jsfmVersion
if(project.hasProperty('asfRelease')){
//download so file if not exist, when compile in source release
download{
src 'https://git-wip-us.apache.org/repos/asf?p=incubator-weex.git;a=blob_plain;f=android/sdk/libs/armeabi/libweexjsc.so;hb=refs/heads/master'
dest "${projectDir}/libs/armeabi/libweexjsc.so"
overwrite false
}
download{
src 'https://git-wip-us.apache.org/repos/asf?p=incubator-weex.git;a=blob_plain;f=android/sdk/libs/x86/libweexjsc.so;hb=refs/heads/master'
dest "${projectDir}/libs/x86/libweexjsc.so"
overwrite false
}
}
def ARMEABI_Size = new File(projectDir,"libs/armeabi/libweexjsc.so").length();
def X86_Size = new File(projectDir,"libs/x86/libweexjsc.so").length();
println "ARMEABI_Size: "+ARMEABI_Size;
println "X86_Size:" + X86_Size;
defaultConfig {
buildConfigField "long", "ARMEABI_Size", "${ARMEABI_Size}"
buildConfigField "long", "X86_Size", "${X86_Size}"
buildConfigField "String", "buildJavascriptFrameworkVersion", "\"${jsfmVersion}\""
buildConfigField "String", "buildVersion", "\"${version}\""
minSdkVersion 14
targetSdkVersion TARGET_SDK_VERSION as int
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi","x86"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "ENABLE_TRACE", "false"
}
debug {
testCoverageEnabled true
buildConfigField "boolean", "ENABLE_TRACE", "true"
}
}
sourceSets {
main {
assets.srcDirs = ['assets']
jniLibs.srcDir(['libs'])
java {
srcDirs = ["src/main/java"];
}
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
compileOptions.encoding = "UTF-8"
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
testOptions {
unitTests.returnDefaultValues = true
unitTests.all {
maxHeapSize = "1024m"
jvmArgs += ['-XX:-UseSplitVerifier', '-noverify','-Xverify:none']/* fix VerifyError */
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
provided "com.android.support:recyclerview-v7:${PROJECT_SUPPORTLIBVERSION}"
provided "com.android.support:support-v4:${PROJECT_SUPPORTLIBVERSION}"
provided "com.android.support:appcompat-v7:${PROJECT_SUPPORTLIBVERSION}"
provided "com.alibaba:fastjson:1.1.46.android"
testCompile "com.alibaba:fastjson:1.1.46.android"
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-core:1.3'
testCompile 'org.javassist:javassist:3.20.0-GA'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'org.objenesis:objenesis:2.1'
testCompile 'org.powermock:powermock-core:1.6.4'
testCompile 'org.powermock:powermock-api-mockito:1.6.4'
testCompile 'org.powermock:powermock-module-junit4-common:1.6.4'
testCompile 'org.powermock:powermock-module-junit4:1.6.4'
testCompile 'org.powermock:powermock-module-junit4-legacy:1.6.4'
testCompile 'org.powermock:powermock-module-testng:1.6.4'
testCompile 'org.powermock:powermock-classloading-xstream:1.6.4'
testCompile "org.powermock:powermock-module-junit4-rule:1.6.4"
testCompile 'org.robolectric:robolectric:3.3.2'
testCompile "org.robolectric:shadows-httpclient:3.3.2"
testCompile 'org.json:json:20160212'
}
if(file('../license/LICENSE').exists()){
license {
header = file('../license/LICENSE')
excludes(["com/taobao/weex/dom/flex/*.java"])
}
preBuild.dependsOn licenseFormat
}