-
Notifications
You must be signed in to change notification settings - Fork 4
/
release_android_library.gradle
109 lines (90 loc) · 3.22 KB
/
release_android_library.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
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
def publishFlag = false
def projectGroupId = 'com.o3dr.android'
def projectArtifactId = project.PUBLISH_ARTIFACT_ID
def projectVersion = project.PUBLISH_VERSION
def projectDescription = project.PROJECT_DESCRIPTION
def projectLabels = project.PROJECT_LABELS
def projectLicenses = project.PROJECT_LICENSES
task androidJavadocs(type: Javadoc) {
//Add the project java source directory.
def files = [android.sourceSets.main.java.srcDirs]
//Add the java source directories for the project's dependencies
configurations.compile.dependencies.each {
if (it instanceof ProjectDependency) {
def dependency = it as ProjectDependency
def depProj = dependency.getDependencyProject()
def projName = depProj.getName()
if(projName != "Mavlink") {
files += depProj.android.sourceSets.main.java.srcDirs
}
}
}
source = files
title = projectDescription
exclude '**/*.aidl'
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
options.links("http://docs.oracle.com/javase/7/docs/api/")
options.links("https://developer.android.com/reference/packages.html")
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs){
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar){
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}
publishing {
publications {
mavenLibraryRelease(MavenPublication){
groupId projectGroupId
artifactId projectArtifactId
version projectVersion
artifact "build/outputs/aar/${PUBLISH_ARTIFACT_ID}.${PUBLISH_VERSION}.aar"
artifact androidSourcesJar {
classifier 'sources'
}
artifact androidJavadocsJar {
classifier 'javadoc'
}
}
}
}
bintray {
user = getMavenUsername()
key = getMavenApiKey()
publications = ['mavenLibraryRelease'] //When uploading Maven-based publication files
dryRun = false //Whether to run this as dry-run, without deploying
publish = publishFlag //If version should be auto published after an upload
pkg {
repo = getMavenRepo()
name = projectArtifactId
desc = projectDescription
websiteUrl = 'http://android.dronekit.io/'
issueTrackerUrl = 'https://github.com/DroidPlanner/DroneKit-Android/issues'
vcsUrl = 'https://github.com/DroidPlanner/DroneKit-Android.git'
licenses = projectLicenses
labels = projectLabels
publicDownloadNumbers = true
//Optional version descriptor
version {
name = projectVersion //Bintray logical version name
}
}
}
bintrayUpload.dependsOn(publishToMavenLocal)
def getMavenUsername(){
return hasProperty('COM_O3DR_MAVEN_USERNAME') ? COM_O3DR_MAVEN_USERNAME : ''
}
def getMavenApiKey(){
return hasProperty('COM_O3DR_MAVEN_APIKEY') ? COM_O3DR_MAVEN_APIKEY : ''
}
def getMavenRepo(){
return hasProperty('COM_O3DR_MAVEN_REPO') ? COM_O3DR_MAVEN_REPO : ''
}