forked from Beepiz/BleGattCoroutines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.gradle
119 lines (110 loc) · 3.63 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
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
if (isRelease) apply from: '../no-version-ranges.gradle'
apply plugin: 'com.github.dcendents.android-maven'
group = 'com.beepiz.blegattcoroutines'
project.archivesBaseName = "blegattcoroutines-${project.name}"
version = library_version
def gitUrl = 'https://github.com/Beepiz/BleGattCoroutines.git'
def siteUrl = 'https://github.com/Beepiz/BleGattCoroutines'
def libraryDesc = 'Make Gatt Great Again! This library allows easy and safer usage of BluetoothGatt in Android'
// TODO replace with https://issuetracker.google.com/issues/72050365 once released.
android.libraryVariants.all { variant ->
variant.generateBuildConfigProvider.configure {
it.enabled = false
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
artifacts {
archives sourcesJar
}
install {
group = 'publishing'
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom.project {
packaging 'aar'
name "BleGattCoroutines"
description libraryDesc
url siteUrl
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'louiscad'
name 'Louis CAD'
email 'louis.cognault@gmail.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
if (isSnapshot) {
apply plugin: 'com.jfrog.artifactory'
artifactoryPublish.doFirst {
def runFromIde = System.getProperties()['idea.platform.prefix'] != null
if (runFromIde) {
def command = "./gradlew artifactoryPublish"
def errorMsg = "artifactoryPublish doesn\'t work from IDE"
throw new IllegalStateException("$errorMsg. Please run \"$command\" from command line.")
}
}
artifactoryPublish.dependsOn install
artifactory {
contextUrl = 'https://oss.jfrog.org/artifactory'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = beepiz_bintray_user
password = beepiz_bintray_api_key
maven = true
}
defaults {
publishConfigs('archives')
publishArtifacts = true
publishPom = true
publishIvy = false
}
}
}
} else {
assert isRelease
apply plugin: 'com.jfrog.bintray'
bintrayUpload.doFirst {
def gitTag = 'git describe --dirty'.execute().text.trim()
def expectedTag = "v$library_version"
if (gitTag != expectedTag) {
throw new IllegalStateException("Expected git tag '$expectedTag' but got '$gitTag'")
}
}
bintrayUpload.dependsOn install
bintray {
user = beepiz_bintray_user
key = beepiz_bintray_api_key
configurations = ['archives']
override = true
pkg {
userOrg = 'beepiz'
repo = 'maven'
name = "blegattcoroutines"
desc = libraryDesc
websiteUrl = siteUrl
issueTrackerUrl = 'https://github.com/Beepiz/BleGattCoroutines/issues'
vcsUrl = gitUrl
licenses = ['Apache-2.0']
labels = ['aar', 'android', 'kotlin']
publicDownloadNumbers = true
githubRepo = 'Beepiz/BleGattCoroutines'
}
}
}