This repository has been archived by the owner on Sep 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle
120 lines (109 loc) · 4.19 KB
/
build.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
120
buildscript {
repositories {
google()
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.bugsnag:bugsnag-android-gradle-plugin:3.2.4'
}
}
ext {
supportLibVersion = "27.0.0"
}
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
def target = 'ndk/build/outputs/aar/ndk-release.aar'
def pomPath = 'tmp/bugsnag-android-ndk.pom'
task spliceReleaseArchive(type: Exec, dependsOn: 'generatePomFileForReleaseArchivePublication') {
description 'Generates a release archive'
commandLine 'make', 'release'
outputs.files(file(target), file("${target}.asc"))
}
spliceReleaseArchive.onlyIf { !file(target).exists() }
model {
tasks.generatePomFileForReleaseArchivePublication {
destination = file(pomPath)
}
}
if (project.hasProperty("releasing")) {
apply plugin: 'signing'
signing {
if (file(target).exists())
sign file(target)
if (file(pomPath).exists())
sign file(pomPath)
}
}
publishing {
publications {
ReleaseArchive(MavenPublication) {
artifact file(target)
artifact("${target}.asc") {
classifier = null
extension = 'aar.asc'
}
artifact("${pomPath}.asc") {
classifier = null
extension = 'pom.asc'
}
groupId project.GROUP
artifactId project.POM_ARTIFACT_ID
version project.VERSION_NAME
pom.withXml {
def root = asNode()
root.appendNode('name', project.POM_NAME)
root.remove(root.get('packaging'))
root.appendNode('packaging', project.POM_PACKAGING)
root.appendNode('url', project.POM_URL)
root.appendNode('description', project.POM_DESCRIPTION)
root.appendNode('inceptionYear', '2016')
def license = root.appendNode('licenses', []).appendNode('license', null)
license.appendNode('name', project.POM_LICENCE_NAME)
license.appendNode('url', project.POM_LICENCE_URL)
license.appendNode('distribution', project.POM_LICENCE_DIST)
def dev = root.appendNode('developers', []).appendNode('developer', null)
dev.appendNode('id', project.POM_DEVELOPER_ID)
dev.appendNode('name', project.POM_DEVELOPER_NAME)
dev.appendNode('email', project.POM_DEVELOPER_EMAIL)
def dep = root.appendNode('dependencies', []).appendNode('dependency', null)
dep.appendNode('groupId', project.GROUP)
dep.appendNode('artifactId', project.BUGSNAG_ANDROID_ARTIFACT_ID)
dep.appendNode('version', project.BUGSNAG_ANDROID_VERSION)
def scm = root.appendNode('scm', null)
scm.appendNode('url', project.POM_SCM_URL)
scm.appendNode('connection', project.POM_SCM_CONNECTION)
scm.appendNode('developerConnection', project.POM_SCM_DEV_CONNECTION)
}
}
}
repositories {
maven {
name 'central'
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
credentials {
username = project.hasProperty("NEXUS_USERNAME") ? "$NEXUS_USERNAME" : System.getenv("NEXUS_USERNAME")
password = project.hasProperty("NEXUS_PASSWORD") ? "$NEXUS_PASSWORD" : System.getenv("NEXUS_PASSWORD")
}
}
}
}
// Bintray upload
bintray {
user = project.hasProperty("bintray_user") ? "$bintray_user" : System.getenv("bintray_user")
key = project.hasProperty("bintray_api_key") ? "$bintray_api_key" : System.getenv("bintray_api_key")
publications = ['ReleaseArchive']
pkg {
repo = 'maven'
name = 'bugsnag-android-ndk'
userOrg = 'bugsnag'
licenses = ['MIT']
vcsUrl = 'https://github.com/bugsnag/bugsnag-android-ndk.git'
version {
name = project.VERSION_NAME
vcsTag = "v${project.VERSION_NAME}"
}
}
}