Skip to content

Commit 8ae7be9

Browse files
sorenoidSoren Rotheri9000
authored
kdoc project to doc the released toolkit components. (#284)
* kdoc project to doc the released toolkit components. * add dependencies on the dependencies of the released projects. * Update kdoc/build.gradle.kts Co-authored-by: Erick Lopez Solis <[email protected]> --------- Co-authored-by: Soren Roth <[email protected]> Co-authored-by: Erick Lopez Solis <[email protected]>
1 parent ba833e1 commit 8ae7be9

File tree

4 files changed

+112
-1
lines changed

4 files changed

+112
-1
lines changed

build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ plugins {
2323
alias(libs.plugins.kotlin.android) apply false
2424
alias(libs.plugins.gradle.secrets) apply false
2525
alias(libs.plugins.kotlin.serialization) apply false
26+
alias(libs.plugins.dokka) apply false
2627
}

gradle/libs.versions.toml

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ androidxEspresso = "3.5.1"
88
androidxLifecycle = "2.6.2"
99
androidxTestExt = "1.1.5"
1010
compileSdk = "34"
11+
dokka = "1.9.10"
1112
junit = "4.13.2"
1213
kotlin = "1.9.21"
1314
minSdk = "26"
@@ -43,6 +44,7 @@ truth = { group = "com.google.truth", name = "truth", version.ref = "truth" }
4344
[plugins]
4445
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
4546
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
47+
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
4648
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
4749
gradle-secrets = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version = "2.0.1"}
4850
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

kdoc/build.gradle.kts

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/*
2+
*
3+
* Copyright 2024 Esri
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
19+
plugins {
20+
id("com.android.library")
21+
id("org.jetbrains.kotlin.android")
22+
alias(libs.plugins.dokka)
23+
}
24+
25+
val versionNumber: String by project
26+
val buildNumber: String by project
27+
val ignoreBuildNumber: String by project
28+
val artifactVersion: String = if (ignoreBuildNumber == "true") {
29+
versionNumber
30+
} else {
31+
"$versionNumber-$buildNumber"
32+
}
33+
34+
// make this project get evaluated after all the other projects
35+
// so that we can be sure the logic to determine released components
36+
// below works
37+
rootProject.subprojects.filter {
38+
it.name != project.name && it.name != "bom"
39+
}.forEach {
40+
evaluationDependsOn(":${it.name}")
41+
}
42+
43+
val releasedModules = project.rootProject.subprojects.filter {
44+
it.plugins.findPlugin("artifact-deploy") != null
45+
}
46+
47+
// determine the released toolkit components
48+
val releasedSourceSets = releasedModules.map { subproject ->
49+
// add all the intended library projects as sourceSets below
50+
File(rootDir, "toolkit/${subproject.name}/src/main/java").canonicalPath
51+
}
52+
53+
tasks {
54+
//./gradlew :documentation:dokkaHtml
55+
// doc output will be under `documentation/build/dokka/html`.
56+
dokkaHtml {
57+
moduleName.set("arcgis-maps-kotlin-toolkit")
58+
dokkaSourceSets {
59+
configureEach {
60+
perPackageOption {
61+
matchingRegex.set(".*internal.*")
62+
suppress.set(true)
63+
}
64+
65+
perPackageOption {
66+
reportUndocumented.set(true)
67+
}
68+
69+
}
70+
}
71+
}
72+
}
73+
74+
android {
75+
namespace = "com.arcgismaps.toolkit.doc"
76+
compileSdk = libs.versions.compileSdk.get().toInt()
77+
78+
defaultConfig {
79+
minSdk = libs.versions.minSdk.get().toInt()
80+
81+
consumerProguardFiles("consumer-rules.pro")
82+
}
83+
84+
sourceSets {
85+
named("main") {
86+
java {
87+
releasedSourceSets.forEach {
88+
srcDir(it)
89+
}
90+
}
91+
}
92+
}
93+
}
94+
95+
dependencies {
96+
project.afterEvaluate {
97+
releasedModules.forEach { proj ->
98+
proj.configurations.forEach { config ->
99+
config.allDependencies.forEach {
100+
//add all dependencies as implementation dependencies, no need for api.
101+
project.dependencies.add("implementation", it)
102+
}
103+
}
104+
}
105+
}
106+
}
107+

settings.gradle.kts

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ dependencyResolutionManagement {
6363
} else {
6464
sdkVersionNumber
6565
}
66-
version("mapsSdk", "$versionAndBuild")
66+
version("mapsSdk", versionAndBuild)
6767
library("mapsSdk", "com.esri", "arcgis-maps-kotlin").versionRef("mapsSdk")
6868
}
6969
}
@@ -72,6 +72,7 @@ dependencyResolutionManagement {
7272
var includedProjects = projects.flatMap { listOf(":$it", ":$it-app") }.toTypedArray()
7373
include(*includedProjects)
7474
include(":bom")
75+
include(":kdoc")
7576
include(":composable-map")
7677
include(":indoors")
7778
include(":floor-filter-app")

0 commit comments

Comments
 (0)