Skip to content

Commit 31630ce

Browse files
committed
统一管理gradle
1 parent 88fcdc5 commit 31630ce

File tree

5 files changed

+316
-84
lines changed

5 files changed

+316
-84
lines changed

AndroidExecLibrary/bintray.gradle

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*********************上传jCenter依赖*********************/
2+
apply plugin: 'com.novoda.bintray-release'
3+
4+
/**避免中文注释:编码GBK的不可映射字符**/
5+
tasks.withType(Javadoc) {
6+
options {
7+
encoding "UTF-8"
8+
charSet 'UTF-8'
9+
links "http://docs.oracle.com/javase/7/docs/api"
10+
}
11+
}
12+
13+
/**避免Javadocs错误:找不到引用**/
14+
tasks.withType(Javadoc) {
15+
options.addStringOption('Xdoclint:none', '-quiet')
16+
options.addStringOption('encoding', 'UTF-8')
17+
}
18+
19+
/**发布到我的Bintray仓库**/
20+
def user = getPropertyValue('bintrayUser')
21+
def key = getPropertyValue('bintrayKey')
22+
def org = getPropertyValue('userOrg')
23+
24+
publish {
25+
bintrayUser = user
26+
bintrayKey = key
27+
dryRun = false
28+
userOrg = org
29+
groupId = 'com.excellence'
30+
artifactId = 'exec'
31+
publishVersion = '1.1.1'
32+
desc = 'android命令执行'
33+
website = 'https://github.com/VeiZhang/AndroidExec'
34+
licences = ['Apache-2.0']
35+
}
36+
37+
/**读取bintray.key文件的key**/
38+
def getPropertyValue(String key) {
39+
if (key == null || key.length() == 0)
40+
return null
41+
42+
File file = project.rootProject.file('../../bintray.key')
43+
if (!file.exists())
44+
return null
45+
46+
InputStream inputStream = file.newDataInputStream()
47+
Properties properties = new Properties()
48+
properties.load(inputStream)
49+
50+
//读取Key
51+
return properties.getProperty(key)
52+
}

AndroidExecLibrary/build.gradle

Lines changed: 14 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
apply plugin: 'com.android.library'
1+
def plugins = rootProject.ext.plugins
2+
def cfg = rootProject.ext.android
3+
def libs = rootProject.ext.dependencies
4+
5+
apply plugin: plugins.library
26

37
android {
4-
compileSdkVersion 25
8+
compileSdkVersion cfg.compileSdkVersion
59

610
defaultConfig {
7-
minSdkVersion 15
8-
targetSdkVersion 25
9-
versionCode 1
10-
versionName "1.0"
11+
minSdkVersion cfg.minSdkVersion
12+
targetSdkVersion cfg.targetSdkVersion
13+
versionCode cfg.versionCode
14+
versionName cfg.versionName
1115

1216
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1317

@@ -25,75 +29,12 @@ android {
2529
dependencies {
2630
implementation fileTree(dir: 'libs', include: ['*.jar'])
2731

28-
implementation 'com.android.support:appcompat-v7:25.0.0'
2932
testImplementation 'junit:junit:4.12'
3033
androidTestImplementation 'com.android.support.test:runner:1.0.2'
3134
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
32-
implementation 'io.reactivex.rxjava2:rxjava:2.2.3'
33-
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
34-
}
35-
36-
/*********************上传jCenter依赖*********************/
37-
apply plugin: 'com.novoda.bintray-release'
38-
39-
buildscript {
40-
repositories {
41-
jcenter()
42-
}
43-
dependencies {
44-
classpath 'com.android.tools.build:gradle:2.3.3'
45-
classpath 'com.novoda:bintray-release:0.8.0'
46-
// NOTE: Do not place your application dependencies here; they belong
47-
// in the individual module build.gradle files
48-
}
49-
}
50-
51-
/**避免中文注释:编码GBK的不可映射字符**/
52-
tasks.withType(Javadoc) {
53-
options {
54-
encoding "UTF-8"
55-
charSet 'UTF-8'
56-
links "http://docs.oracle.com/javase/7/docs/api"
57-
}
35+
implementation libs["appcompat-v7"]
36+
implementation libs["rxjava2"]
37+
implementation libs["rxandroid2"]
5838
}
5939

60-
/**避免Javadocs错误:找不到引用**/
61-
tasks.withType(Javadoc) {
62-
options.addStringOption('Xdoclint:none', '-quiet')
63-
options.addStringOption('encoding', 'UTF-8')
64-
}
65-
66-
/**发布到我的Bintray仓库**/
67-
def user = getPropertyValue('bintrayUser')
68-
def key = getPropertyValue('bintrayKey')
69-
def org = getPropertyValue('userOrg')
70-
71-
publish {
72-
bintrayUser = user
73-
bintrayKey = key
74-
dryRun = false
75-
userOrg = org
76-
groupId = 'com.excellence'
77-
artifactId = 'exec'
78-
publishVersion = '1.1.1'
79-
desc = 'android命令执行'
80-
website = 'https://github.com/VeiZhang/AndroidExec'
81-
licences = ['Apache-2.0']
82-
}
83-
84-
/**读取bintray.key文件的key**/
85-
def getPropertyValue(String key) {
86-
if (key == null || key.length() == 0)
87-
return null
88-
89-
File file = project.rootProject.file('../../bintray.key')
90-
if (!file.exists())
91-
return null
92-
93-
InputStream inputStream = file.newDataInputStream()
94-
Properties properties = new Properties()
95-
properties.load(inputStream)
96-
97-
//读取Key
98-
return properties.getProperty(key)
99-
}
40+
apply from: 'bintray.gradle'

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
apply from: 'config.gradle'
23

34
buildscript {
4-
5+
56
repositories {
67
google()
78
jcenter()
89
}
910
dependencies {
1011
classpath 'com.android.tools.build:gradle:3.1.3'
11-
12-
12+
classpath 'com.novoda:bintray-release:0.8.0'
1313
// NOTE: Do not place your application dependencies here; they belong
1414
// in the individual module build.gradle files
1515
}

0 commit comments

Comments
 (0)