-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathbuild.gradle
196 lines (184 loc) · 7.09 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
apply plugin: 'com.android.application'
//获取时间戳
def getDate() {
def date = new Date()
def formattedDate = date.format('yyyyMMddHHmm')
return formattedDate
}
def verCode = 14
android {
compileSdkVersion 22
buildToolsVersion "23.0.3"
signingConfigs {
signingConfig {
keyAlias 'xxx'
keyPassword 'xxx'
storeFile file('xxx')
storePassword 'xxx'
}
}
defaultConfig {
applicationId "com.henanjianye.soon.communityo2o"
minSdkVersion 14
targetSdkVersion 22
multiDexEnabled true
versionCode verCode
versionName APP_VERSION
resValue("string", 'app_version', APP_VERSION)
buildConfigField "boolean", "LEO_DEBUG", "true"
buildConfigField 'String', 'API_SERVER_URL', RELEASE_API_SERVER_URL
buildConfigField 'String', 'API_SERVER_URL_MALL', RELEASE_API_SERVER_URL_MALL
generatedDensities = []
signingConfig signingConfigs.signingConfig
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
lintOptions {
abortOnError false
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
buildTypes {
release {
buildConfigField 'String', 'API_SERVER_URL', RELEASE_API_SERVER_URL
buildConfigField 'String', 'API_SERVER_URL_MALL', RELEASE_API_SERVER_URL_MALL
buildConfigField 'String', 'IM_SERVER_HOST', RELEASE_IM_SERVER_HOST
buildConfigField 'int', 'IM_SERVER_PORT', RELEASE_IM_SERVER_PORT
buildConfigField "boolean", "LEO_DEBUG", RELEASE_LEO_DEBUG
minifyEnabled true
zipAlignEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
ysc {
buildConfigField 'String', 'API_SERVER_URL', YSC_API_SERVER_URL
buildConfigField 'String', 'API_SERVER_URL_MALL', YSC_API_SERVER_URL_MALL
buildConfigField 'String', 'IM_SERVER_HOST', YSC_IM_SERVER_HOST
buildConfigField 'int', 'IM_SERVER_PORT', YSC_IM_SERVER_PORT
buildConfigField "boolean", "LEO_DEBUG", YSC_LEO_DEBUG
minifyEnabled true
zipAlignEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
develop {
buildConfigField 'String', 'API_SERVER_URL', DEVELOP_API_SERVER_URL
buildConfigField 'String', 'API_SERVER_URL_MALL', DEVELOP_API_SERVER_URL_MALL
buildConfigField 'String', 'IM_SERVER_HOST', DEVELOP_IM_SERVER_HOST
buildConfigField 'int', 'IM_SERVER_PORT', DEVELOP_IM_SERVER_PORT
buildConfigField "boolean", "LEO_DEBUG", DEVELOP_LEO_DEBUG
minifyEnabled true
zipAlignEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
inside_test {
buildConfigField 'String', 'API_SERVER_URL', INSIDE_TEST_API_SERVER_URL
buildConfigField 'String', 'API_SERVER_URL_MALL', INSIDE_TEST_API_SERVER_URL_MALL
buildConfigField 'String', 'IM_SERVER_HOST', INSIDE_TEST_IM_SERVER_HOST
buildConfigField 'int', 'IM_SERVER_PORT', INSIDE_TEST_IM_SERVER_PORT
buildConfigField "boolean", "LEO_DEBUG", INSIDE_TEST_LEO_DEBUG
minifyEnabled true
zipAlignEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
buildConfigField 'String', 'API_SERVER_URL', RELEASE_API_SERVER_URL
buildConfigField 'String', 'API_SERVER_URL_MALL', RELEASE_API_SERVER_URL_MALL
buildConfigField 'String', 'IM_SERVER_HOST', RELEASE_IM_SERVER_HOST
buildConfigField 'int', 'IM_SERVER_PORT', RELEASE_IM_SERVER_PORT
buildConfigField "boolean", "LEO_DEBUG", RELEASE_LEO_DEBUG
}
}
dexOptions {
javaMaxHeapSize "2g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
//渠道Flavors,我这里写了一些常用的
productFlavors {
commonsoon {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "commonsoon"]
}
zhushou91 {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "zhushou91"]
}
market360 {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "market360"]
}
xiaomi {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "xiaomi"]
}
wandoujia {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "wandoujia"]
}
marketandroid {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "marketandroid"]
}
yingyonghui {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "yingyonghui"]
}
jifengmarket {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "jifengmarket"]
}
mumayi {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "mumayi"]
}
anzhimarket {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "anzhimarket"]
}
yingyongbao {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "yingyongbao"]
}
huaweimarket {
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "huaweimarket"]
}
}
allprojects {
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
}
//修改生成的apk名字
applicationVariants.all { variant ->
variant.outputs.each { output ->
def newName
def timeNow
def oldFile = output.outputFile
def outDirectory = oldFile.parent
if ("true".equals(IS_JENKINS)) {
timeNow = JENKINS_TIME
outDirectory = 'G:/Tomcat/webapps/jenkins/apk'
newName = 'yj-android-v' +
APP_VERSION + '-' + variant.productFlavors[0].name + timeNow + '-' + variant.buildType.name + '.apk'
} else {
timeNow = getDate()
if (variant.buildType.name.equals('debug')) {
newName = "yj-android-v${APP_VERSION}-debug.apk"
} else {
newName = 'yj-android-v' +
APP_VERSION + '-' + variant.productFlavors[0].name + timeNow + '-' + variant.buildType.name + '.apk'
}
}
output.outputFile = new File(outDirectory, newName)
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
}