forked from maplibre/maplibre-navigation-android-legacy
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
152 lines (133 loc) · 5.06 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
apply plugin: 'com.github.kt3k.coveralls'
buildscript {
apply from: "${rootDir}/gradle/dependencies.gradle"
repositories {
google()
jcenter()
maven { url 'https://plugins.gradle.org/m2' }
}
dependencies {
classpath pluginDependencies.gradle
classpath pluginDependencies.coveralls
classpath pluginDependencies.errorprone
classpath pluginDependencies.dependencyUpdates
}
}
task testReport(type: TestReport, group: 'Build') {
description = 'Generates an aggregate test report'
destinationDir = file("${buildDir}/reports/allTests")
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://plugins.gradle.org/m2' }
}
group = GROUP
version = VERSION_NAME
}
subprojects {
apply plugin: 'idea'
apply plugin: 'net.ltgt.errorprone'
apply from: "${rootDir}/gradle/dependencies.gradle"
dependencies {
errorprone dependenciesList.errorprone
errorproneJavac dependenciesList.errorproneJavac
}
afterEvaluate { project ->
task sourcesJar(type: Jar) {
if (pluginManager.hasPlugin('com.android.library')) {
classifier 'sources'
from android.sourceSets.main.java.srcDirs
} else {
classifier 'sources'
from sourceSets.main.allSource
}
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/droidsonroids/graphhopper-navigation-android")
credentials {
username = System.getenv("GPR_USER")
password = System.getenv("GPR_API_KEY")
}
}
}
publications {
gpr(MavenPublication) {
from components.findByName("release")
artifact tasks.sourcesJar
def getVersionName = { ->
def currentBranch = System.getenv('BITRISE_GIT_BRANCH')
def deployBranch = System.getenv('DEPLOY_BRANCH')
def isSnapshot = currentBranch == null || currentBranch != deployBranch
def artifactVersion = VERSION_NAME
return isSnapshot ? "${artifactVersion}.SNAPSHOT.${getShortSha()}" : "${artifactVersion}"
}
def getArtifactPath = { ->
def aarPath = "$buildDir/outputs/aar/${project.name}-release.aar"
def jarPath = "$buildDir/libs/${project.name}.jar"
def isAar = file(aarPath).exists()
return isAar ? aarPath : jarPath
}
groupId project.group
artifactId project.name
version getVersionName()
artifact getArtifactPath()
pom {
name = POM_NAME
description = POM_DESCRIPTION
url = POM_URL
scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
}
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
withXml {
def dependencies = asNode().appendNode('dependencies')
configurations.implementation.allDependencies.each {
addDependency(dependencies, it).appendNode('scope', 'runtime')
}
configurations.api.allDependencies.each {
addDependency(dependencies, it)
}
}
}
}
}
}
}
apply plugin: "maven-publish"
}
private static Object addDependency(Object dependenciesNode, Dependency dependency) {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', dependency.group)
dependencyNode.appendNode('artifactId', dependency.name)
dependencyNode.appendNode('version', dependency.version)
return dependencyNode
}
private def getShortSha() {
def stdOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', 'HEAD'
standardOutput = stdOut
}
return "$stdOut".trim().take(7)
}
task clean(type: Delete) {
delete rootProject.buildDir
}