-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle.kts
111 lines (92 loc) · 3.61 KB
/
build.gradle.kts
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
/*
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.net.URI
import java.time.Duration
import java.util.Properties
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
alias(libs.plugins.androidLibrary) apply false
id("org.jetbrains.dokka") version "1.9.20"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "io.github.gradle-nexus.publish-plugin")
apply(plugin = "java-library")
subprojects {
apply(plugin = "maven-publish")
apply(plugin = "signing")
apply(plugin = "org.jetbrains.dokka")
}
val groupName: String = properties["GROUP"] as String
// Read local.properties file to get the Nexus credentials
val localPropertiesFile = rootProject.file("local.properties")
val localProperties = Properties()
if (localPropertiesFile.exists()) {
localPropertiesFile.inputStream().use { stream ->
localProperties.load(stream)
}
}
// Get the WSO2 Nexus repository URL
fun getWSO2NexusReleaseRepositoryUrl(): URI =
URI.create((properties["NEXUS_RELEASE_URL"] ?: "").toString())
// Get the WSO2 Nexus snapshot repository URL
fun getWSO2NexusSnapshotRepositoryUrl(): URI =
URI.create((properties["NEXUS_SNAPSHOT_URL"] ?: "").toString())
// Get the WSO2 Nexus repository username
fun getWSO2NexusRepositoryUsername(): String =
(localProperties.getProperty("NEXUS_USERNAME") ?: "").toString()
// Get the WSO2 Nexus repository password
fun getWSO2NexusRepositoryPassword(): String =
(localProperties.getProperty("NEXUS_PASSWORD") ?: "").toString()
nexusPublishing {
group = groupName
packageGroup = groupName
repositories {
create("wso2Nexus") {
nexusUrl.set(getWSO2NexusReleaseRepositoryUrl())
snapshotRepositoryUrl.set(getWSO2NexusSnapshotRepositoryUrl())
username.set(getWSO2NexusRepositoryUsername())
password.set(getWSO2NexusRepositoryPassword())
}
}
clientTimeout = Duration.ofMinutes(5)
connectTimeout = Duration.ofMinutes(1)
transitionCheckOptions {
maxRetries.set(40)
delayBetween.set(Duration.ofSeconds(10))
}
}
tasks.dokkaHtmlMultiModule.configure {
outputDirectory.set(File("${project.rootDir}/docs"))
}
tasks.register<Jar>("dokkaJavadocJar") {
dependsOn(tasks.dokkaJavadoc)
from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
extra.apply {
set("groupName", groupName)
set("minCompileSdkVersion", properties["MIN_COMPILE_SDK"])
set("packagingType", properties["PACKAGING_TYPE"])
set("wso2NexusReleaseRepositoryUrl", getWSO2NexusReleaseRepositoryUrl())
set("wso2NexusSnapshotRepositoryUrl", getWSO2NexusSnapshotRepositoryUrl())
set("wso2NexusRepositoryUsername", getWSO2NexusRepositoryUsername())
set("wso2NexusRepositoryPassword", getWSO2NexusRepositoryPassword())
}