-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.gradle
112 lines (98 loc) · 3.38 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
ext.moduleGroupId = "com.kaleyra"
ext.moduleProductId = "video-utils"
ext.moduleVersion = "2.0.1"
ext.dryRun = true
Properties properties = new Properties()
if (project.rootProject.file("local.properties").exists()) {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
}
def mavenAccessKey = properties.getProperty("maven.accessKey") ?: ""
def mavenSecretKey = properties.getProperty("maven.secretKey") ?: ""
def mavenDistributionId = properties.getProperty("maven.distributionId") ?: ""
afterEvaluate {
//tasks["dokkaHtml"].dependsOn(tasks.getByName("kaptReleaseKotlin"), tasks.getByName("kaptDebugKotlin"))
publishing {
repositories {
maven {
url = "s3://maven-bandyer/releases/"
credentials(AwsCredentials) {
accessKey = mavenAccessKey
secretKey = mavenSecretKey
}
}
}
publications {
release(MavenPublication) {
from components.getByName("release")
groupId = moduleGroupId
artifactId = project.getName()
version = moduleVersion
artifact kdocJar
artifact sourcesJar
pom {
url.set("https://github.com/Bandyer/Kaleyra-Android-Collaboration-Suite-Utils")
description.set("Kaleyra Video Utils")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("Kaleyra Spa")
name.set("Kaleyra Spa")
}
}
}
}
}
}
}
task publishUpload {
def publishTask = 'publishToMavenLocal'
if (!dryRun) publishTask = 'publish'
dependsOn publishTask
}
task invalidateCache(type: Exec, dependsOn: publishUpload) {
workingDir '../scripts'
def publishPath = "releases"
def packageName = moduleGroupId + "." + project.getName()
commandLine 'python3', './invalidate_s3_cache.py', mavenAccessKey, mavenSecretKey, mavenDistributionId, publishPath, packageName, version
doLast { println("Invalidated $project.name maven cache.") }
}
dokkaHtml {
outputDirectory = new File("$buildDir/docs")
dokkaSourceSets {
configureEach {
moduleName.set(project.name)
reportUndocumented.set(true)
jdkVersion.set(8)
includeNonPublic.set(false)
skipEmptyPackages.set(true)
}
}
}
task publishDocs(type: Exec) {
workingDir '../scripts'
commandLine 'python3', './publish_doc.py', "$moduleGroupId", "${project.name}", "$version"
}
task dokkaDoc() {
dependsOn dokkaHtml
}
task kdocJar(type: Jar, dependsOn: dokkaHtml) {
from "$buildDir/docs"
archiveClassifier.set("kdocJar")
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
archiveClassifier.set("sources")
}
afterEvaluate {
tasks["invalidateCache"].dependsOn(tasks.getByName("publishUpload"))
publishUpload.finalizedBy(invalidateCache)
}
artifacts {
archives kdocJar
archives sourcesJar
}