forked from dariuszseweryn/RxAndroidBle
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gradle-mvn-config.gradle
74 lines (61 loc) · 2.39 KB
/
gradle-mvn-config.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
File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
// Read local.properties file first if it exists
Properties p = new Properties()
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
p.each { name, value -> ext[name] = value }
} else {
// Use system environment variables
ext["ossrhUsername"] = System.getenv('SONATYPE_NEXUS_USERNAME')
ext["ossrhPassword"] = System.getenv('SONATYPE_NEXUS_PASSWORD')
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
ext["signing.key"] = System.getenv('PGP_SIGNING_KEY')
ext["signing.password"] = System.getenv('PGP_SIGNING_PASSWORD')
ext["versionName"] = System.getenv('VERSION_NAME')
}
ext.VERSION_NAME = ext.has("versionName") && ext["versionName"]?.trim() ? ext["versionName"] : VERSION_NAME
subprojects {
ext.VERSION_NAME = rootProject.ext.VERSION_NAME
}
version = VERSION_NAME
group = GROUP
println "RxAndroidBle version \"$VERSION_NAME\""
ext.isReleaseBuild = {
return !VERSION_NAME.endsWith("SNAPSHOT")
}
ext.isAndroidProject = { project ->
return project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().hasPlugin('com.android.library')
}
def getSonatypeUsername() {
return hasProperty('ossrhUsername') ? ossrhUsername : ""
}
def getSonatypePassword() {
return hasProperty('ossrhPassword') ? ossrhPassword : ""
}
ext.getSigningKey = {
return ext.has('signing.key') ? ext["signing.key"] : ""
}
ext.getSigningKeyPassword = {
return ext.has('signing.password') ? ext["signing.password"] : ""
}
def getSonatypeReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://s01.oss.sonatype.org/service/local/"
}
def getSonatypeSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://s01.oss.sonatype.org/content/repositories/snapshots/"
}
nexusPublishing {
repositories {
sonatype {
nexusUrl = uri(getSonatypeReleaseRepositoryUrl())
snapshotRepositoryUrl = uri(getSonatypeSnapshotRepositoryUrl())
if (ext.has("sonatypeStagingProfileId")) {
stagingProfileId = sonatypeStagingProfileId
}
username = getSonatypeUsername()
password = getSonatypePassword()
}
}
}