forked from alibaba/atlas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
224 lines (189 loc) · 7.03 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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
def mini = getEnvValue("mini", 'false')
def commitTag = getEnvValue("commitTag", 'false')
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath "com.github.dcendents:android-maven-gradle-plugin:1.4.1"
}
}
repositories {
mavenCentral()
jcenter()
}
group = 'com.taobao.android'
description = """atlas_core"""
String postFix = mini=='true' ? "-mini" : "";
version "5.0.7.55${postFix}"
String getEnvValue(key, defValue) {
def val = System.getProperty(key);
if (null != val) {
return val;
}
val = System.getenv(key);
if (null != val) {
return val;
}
return defValue;
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
provided ('com.android.support:support-v4:25.3.1'){
transitive = true
}
provided 'com.android.support:support-annotations:24.1.1'
}
tasks.whenTaskAdded {task ->
if (task.name.startsWith("compile") && task.name.endsWith("JavaWithJavac")) {
task.doLast {
new File(task.getDestinationDir(),"android/app/Instrumentation.class").delete()
new File(task.getDestinationDir(),"android/app/Instrumentation.class").delete();
new File(task.getDestinationDir(),"android/app/Instrumentation\$ActivityMonitor.class").delete();
new File(task.getDestinationDir(),"android/app/Instrumentation\$ActivityResult.class").delete();
new File(task.getDestinationDir(),"android/app/PreVerifier.class").delete();
new File(task.getDestinationDir(),"android/app/IActivityManager.class").delete();
new File(task.getDestinationDir(),"android/app/IActivityManager\$1.class").delete();
new File(task.getDestinationDir(),"android/app/IActivityManager\$ContentProviderHolder.class").delete();
new File(task.getDestinationDir(),"android/app/IActivityManager\$ContentProviderHolder\$1.class").delete();
new File(task.getDestinationDir(),"android/app/IActivityManager\$1.class").delete();
new File(task.getDestinationDir(),"android/app/IServiceConnection.class").delete();
new File(task.getDestinationDir(),"android/app/IServiceConnection\$Stub.class").delete();
new File(task.getDestinationDir(),"android/app/IServiceConnection\$Stub\$Proxy.class").delete();
new File(task.getDestinationDir(),"android/content/IContentProvider.class").delete();
new File(task.getDestinationDir(),"android/databinding/DataBindingComponent.class").delete();
new File(task.getDestinationDir(),"android/databinding/ViewDataBinding.class").delete();
new File(task.getDestinationDir(),"android/taobao/atlas/framework/FrameworkProperties.class").delete();
new File(task.getDestinationDir(),"android/taobao/atlas/bundleInfo/AtlasBundleInfoGenerator.class").delete();
}
} else if(task.name.equals('mergeReleaseJniLibFolders')){
task.doLast {
if(mini=='true') {
new File(project.buildDir, "intermediates/jniLibs/release/armeabi-v7a").deleteDir()
new File(project.buildDir, "intermediates/jniLibs/release/mips64").deleteDir()
new File(project.buildDir, "intermediates/jniLibs/release/arm64-v8a").deleteDir()
new File(project.buildDir, "intermediates/jniLibs/release/mips").deleteDir()
new File(project.buildDir, "intermediates/jniLibs/release/x86").deleteDir()
new File(project.buildDir, "intermediates/jniLibs/release/x86_64").deleteDir()
}
}
}
// if(task.name == "bintrayUpload"){
// task.doFirst{
// println "tag has been created!"
// }
//
// task.doLast {
// String newTag = "v${version}"
// println "new Tag is ${newTag}"
// "git tag v${version}".execute()
// "git push origin v${version}".execute()
// println "tag v${version} has been created!"
// }
// }
}
project.gradle.buildFinished{
if(commitTag=='true') {
"git tag v${version}".execute()
"git push origin v${version}".execute()
"git push origin v${version}".execute()
println "tag v${version} has been created!"
}
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
lintOptions {
abortOnError false
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
defaultConfig {
consumerProguardFiles 'proguard.cfg'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
if(mini=='true') {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
}
}
}
}
def siteUrl = 'https://github.com/alibaba/atlas'
// 项目的主页
def gitUrl = 'https://github.com/alibaba/atlas'
// Git仓库的url
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
// Add your description here
name 'atlas' //项目描述
groupId 'com.taobao.android'
artifactId 'atlas_core'
url siteUrl
// Set your license
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'alibabaatlas' //填写的一些基本信息
name 'atlas-framework'
email '[email protected]'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
task sourcesJar(type: Jar) {
from('src/main/java') {
include '**'
}
classifier = 'sources'
}
artifacts {
archives sourcesJar
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = "maven"
name = "atlas" //发布到JCenter上的项目名字
websiteUrl = "https://github.com/alibaba/atlas"
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
}
}