This repository has been archived by the owner on Nov 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
159 lines (148 loc) · 4.87 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'digital.wup:android-maven-publish:3.6.2'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4"
}
}
plugins {
id "net.researchgate.release" version "2.7.0"
}
def initPublication = { MavenPublication publication ->
publication.pom {
name = 'ASL'
description = 'Android ServiceLoader'
url = 'https://github.com/F43nd1r/androidserviceloader'
scm {
connection = 'scm:git:https://github.com/F43nd1r/androidserviceloader.git'
developerConnection = 'scm:git:git@github.com:F43nd1r/androidserviceloader.git'
url = 'https://github.com/F43nd1r/androidserviceloader.git'
}
licenses {
license {
name = 'Apache-2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'f43nd1r'
name = 'Lukas Morawietz'
}
}
}
}
release {
tagTemplate = '$name-$version'
}
task build {
subprojects.each {
beforeReleaseBuild.dependsOn "${it.path}:clean"
dependsOn "${it.path}:build"
}
}
subprojects {
repositories {
google()
jcenter()
}
plugins.withType(com.android.build.gradle.BasePlugin) {
android {
compileSdkVersion Integer.parseInt(androidVersion)
defaultConfig {
minSdkVersion androidMinVersion
targetSdkVersion androidVersion
versionName version
}
buildTypes {
release {
minifyEnabled false
}
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs + files("${project.buildDir}/generated/source/apt/release")
classpath += files(android.getBootClasspath().join(File.pathSeparator)) + files("${project.buildDir}/generated/source/r/release")
options.with {
linksOffline "http://d.android.com/reference", "${android.sdkDirectory.path}/docs/reference"
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc
classifier = 'javadoc'
}
plugins.withType(digital.wup.android_maven_publish.AndroidMavenPublishPlugin) {
publishing {
publications {
maven(MavenPublication) { MavenPublication publication ->
from components.android
artifact sourcesJar
artifact javadocJar
initPublication(publication)
}
}
}
}
}
plugins.withType(JavaLibraryPlugin) {
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc
classifier = 'javadoc'
}
plugins.withType(MavenPublishPlugin) {
publishing {
publications {
maven(MavenPublication) { MavenPublication publication ->
from components.java
artifact sourcesJar
artifact javadocJar
initPublication(publication)
}
}
}
}
}
plugins.withType(com.jfrog.bintray.gradle.BintrayPlugin) {
bintray {
if (project.hasProperty('artifactoryUser')) {
user = artifactoryUser
key = artifactoryApiKey
}
publications = ['maven']
publish = true
pkg {
repo = 'maven'
afterEvaluate {
org.gradle.api.publish.maven.MavenPom pom = publishing.publications.maven.pom
name = pom.name.get()
websiteUrl = pom.url.get()
vcsUrl = pom.scm.url.get()
licenses = pom.licenses.collect { l -> l.name.get() }
desc = pom.description.get()
}
publicDownloadNumbers = true
version {
name = project.version
}
}
}
bintrayUpload.dependsOn(build, javadocJar, sourcesJar, 'generatePomFileForMavenPublication')
rootProject.afterReleaseBuild.dependsOn bintrayUpload
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}