-
Notifications
You must be signed in to change notification settings - Fork 7
/
publish.gradle
43 lines (38 loc) · 1.28 KB
/
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
ext {
ext.resolveRepositoyUrl = {
if (isReleaseBuild()) {
return "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
} else {
return "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
ext.getUsername = {
if (hasProperty('SONATYPE_NEXUS_USERNAME')) {
return SONATYPE_NEXUS_USERNAME
}
def propertiesFile = project.rootProject.file('local.properties')
if (propertiesFile.exists()) {
Properties properties = new Properties()
properties.load(propertiesFile.newDataInputStream())
return properties.getProperty('SONATYPE_NEXUS_USERNAME')
} else {
return ""
}
}
ext.getPassword = {
if (hasProperty('SONATYPE_NEXUS_PASSWORD')) {
return SONATYPE_NEXUS_PASSWORD
}
def propertiesFile = project.rootProject.file('local.properties')
if (propertiesFile.exists()) {
Properties properties = new Properties()
properties.load(propertiesFile.newDataInputStream())
return properties.getProperty('SONATYPE_NEXUS_PASSWORD')
} else {
return ""
}
}
}
def isReleaseBuild() {
return !VERSION_NAME.contains("SNAPSHOT")
}