-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjcenter_publish.gradle
70 lines (61 loc) · 2.64 KB
/
jcenter_publish.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
if (!hasProperty("publishJcenter")) {
return
}
//publishJcenter 是否发版到Jcenter
//BINTRAY_USER jcenter用户名
//BINTRAY_KEY jcenter验证Key
//PUBLISH_GROUP_ID 组
//PUBLISH_ARTIFACT_ID 模块名
//PUBLISH_VERSION_NAME 版本号
//PUBLISH_DESCRIPTION 描述
//PUBLISH_JCENTER_GITHUB_REPOSITORIES_NAME 在github上到项目名
apply plugin: 'com.novoda.bintray-release'
def getLocalProperties() {
def localProperties = new Properties()
InputStream inputStream = project.rootProject.file('local.properties').newDataInputStream()
localProperties.load(inputStream)
return localProperties
}
def getPublishBintrayUser() {
def localUser = localProperties.getProperty('BINTRAY_USER', "")
return hasProperty('BINTRAY_USER') ? BINTRAY_USER : localUser
}
def getPublishBintrayKey() {
def localKey = localProperties.getProperty('BINTRAY_KEY', "")
return hasProperty('BINTRAY_KEY') ? BINTRAY_KEY : localKey
}
def getPublishGroupId() {
def localGroupId = localProperties.getProperty('PUBLISH_GROUP_ID', "com.theone")
return hasProperty('PUBLISH_GROUP_ID') ? PUBLISH_GROUP_ID : localGroupId
}
def getPublishArtifactId() {
def localArtifactId = localProperties.getProperty('PUBLISH_ARTIFACT_ID', "")
return hasProperty('PUBLISH_ARTIFACT_ID') ? PUBLISH_ARTIFACT_ID : localArtifactId
}
//PUBLISH_VERSION_NAME>Local PUBLISH_VERSION_NAME > Local VERSION_NAME > VERSION_NAME
def getPublishVersionName() {
def temVersionName = hasProperty('VERSION_NAME') ? VERSION_NAME : "1.0.0"
def localVersionName = localProperties.getProperty('VERSION_NAME', temVersionName)
def localPublishVersionName = localProperties.getProperty('PUBLISH_VERSION_NAME', localVersionName)
return hasProperty('PUBLISH_VERSION_NAME') ? PUBLISH_VERSION_NAME : localPublishVersionName
}
def getPublishDescription() {
def localPublishVersionName = localProperties.getProperty('PUBLISH_DESCRIPTION', "the library of liuzhiqiang")
return hasProperty('PUBLISH_DESCRIPTION') ? PUBLISH_DESCRIPTION : localPublishVersionName
}
def getPublishWebsiteUrl() {
def localGithub = localProperties.getProperty('PUBLISH_JCENTER_GITHUB_REPOSITORIES_NAME', "")
def github = hasProperty('PUBLISH_JCENTER_GITHUB_REPOSITORIES_NAME') ? PUBLISH_JCENTER_GITHUB_REPOSITORIES_NAME : localGithub
return "https://github.com/snailflying/${github}"
}
publish {
bintrayUser = getPublishBintrayUser()
bintrayKey = getPublishBintrayKey()
dryRun = false
userOrg = 'bravoon'
groupId = getPublishGroupId()
artifactId = getPublishArtifactId()
publishVersion = getPublishVersionName()
desc = getPublishDescription()
website = getPublishWebsiteUrl()
}