Skip to content

Commit e5a29be

Browse files
committedSep 24, 2022
Add an integration with Dokka to generate Glide docs.
1 parent dafc7e2 commit e5a29be

File tree

6 files changed

+107
-10
lines changed

6 files changed

+107
-10
lines changed
 

‎build.gradle

+68-10
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,31 @@ buildscript {
55
repositories {
66
google()
77
mavenCentral()
8-
maven {
9-
url "https://oss.sonatype.org/content/repositories/snapshots"
10-
}
118
gradlePluginPortal()
129
}
1310

1411
dependencies {
15-
classpath "com.android.tools.build:gradle:${ANDROID_GRADLE_VERSION}"
12+
classpath "com.android.tools.build:gradle:$ANDROID_GRADLE_VERSION"
1613
if (!hasProperty('DISABLE_ERROR_PRONE')) {
17-
classpath "net.ltgt.gradle:gradle-errorprone-plugin:${ERROR_PRONE_PLUGIN_VERSION}"
14+
classpath "net.ltgt.gradle:gradle-errorprone-plugin:$ERROR_PRONE_PLUGIN_VERSION"
1815
}
1916
classpath 'com.guardsquare:proguard-gradle:7.1.0'
20-
classpath "se.bjurr.violations:violations-gradle-plugin:${VIOLATIONS_PLUGIN_VERSION}"
21-
classpath "androidx.benchmark:benchmark-gradle-plugin:${ANDROID_X_BENCHMARK_VERSION}"
22-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${JETBRAINS_KOTLIN_VERSION}"
17+
classpath "se.bjurr.violations:violations-gradle-plugin:$VIOLATIONS_PLUGIN_VERSION"
18+
classpath "androidx.benchmark:benchmark-gradle-plugin:$ANDROID_X_BENCHMARK_VERSION"
19+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$JETBRAINS_KOTLIN_VERSION"
2320
classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:$KSP_GRADLE_PLUGIN_VERSION"
24-
classpath "org.jetbrains.kotlinx:binary-compatibility-validator:0.11.0"
21+
classpath "org.jetbrains.kotlinx:binary-compatibility-validator:$JETBRAINS_KOTLINX_BINARY_COMPATIBILITY_VALIDATOR_VERSION"
22+
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$JETBRAINS_DOKKA_VERSION"
2523
}
2624
}
2725

26+
repositories {
27+
google()
28+
mavenCentral()
29+
}
30+
2831
apply plugin: 'binary-compatibility-validator'
32+
apply plugin: 'org.jetbrains.dokka'
2933

3034
apiValidation {
3135
ignoredProjects += ["ksp", "test", "gallery"]
@@ -41,8 +45,23 @@ if (JavaVersion.current().isJava8Compatible()) {
4145
}
4246
}
4347

44-
subprojects { project ->
48+
dokkaHtmlMultiModule.configure {
49+
moduleName.set("Glide")
50+
}
51+
afterEvaluate {
52+
tasks.named("dokkaHtmlMultiModule") {
53+
pluginsMapConfiguration.set(
54+
[
55+
"org.jetbrains.dokka.base.DokkaBase": """{
56+
"customStyleSheets": ["${projectDir.toString()}/static/logo-styles.css"],
57+
"customAssets" : ["${projectDir.toString()}/static/logo-icon.svg", "${projectDir.toString()}/static/glide_circle_logo.png"]
58+
}"""
59+
]
60+
)
61+
}
62+
}
4563

64+
subprojects { project ->
4665
repositories {
4766
google()
4867
mavenCentral()
@@ -61,6 +80,45 @@ subprojects { project ->
6180
}
6281
}
6382

83+
// Exclude packages not intended for public use.
84+
if (![
85+
"testutil",
86+
"flickr",
87+
"giphy",
88+
"imgur",
89+
"svg",
90+
"gallery",
91+
"contacturi",
92+
"test",
93+
"gif_decoder",
94+
"gifencoder",
95+
"compiler",
96+
"benchmark",
97+
"instrumentation"
98+
].contains(project.getName())) {
99+
afterEvaluate {
100+
project.apply plugin: 'org.jetbrains.dokka'
101+
102+
project.tasks.dokkaHtmlPartial.configure {
103+
dokkaSourceSets {
104+
// Kotlin works out of the box
105+
if (!project.plugins.hasPlugin("kotlin-android") && project.plugins.hasPlugin("com.android.library")) {
106+
// Java Android modules
107+
register("main") {
108+
sourceRoots.from(project.android.sourceSets.main.java.srcDirs)
109+
110+
}
111+
} else if (project.plugins.hasPlugin("java") && "ksp" != project.getName()) {
112+
// Java only modules (ksp is not useful and uses multiple plugins)
113+
register("main") {
114+
sourceRoots.from(sourceSets.main.java.srcDirs)
115+
}
116+
}
117+
}
118+
}
119+
}
120+
}
121+
64122
tasks.withType(JavaCompile) {
65123
// gifencoder is a legacy project that has a ton of warnings and is basically never
66124
// modified, so we're not going to worry about cleaning it up.

‎gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ JETBRAINS_KOTLINX_COROUTINES_VERSION=1.6.4
7171
JETBRAINS_KOTLINX_COROUTINES_TEST_VERSION=1.6.4
7272
JETBRAINS_KOTLIN_VERSION=1.7.0
7373
JETBRAINS_KOTLIN_TEST_VERSION=1.7.0
74+
JETBRAINS_KOTLINX_BINARY_COMPATIBILITY_VALIDATOR_VERSION=0.11.0
75+
JETBRAINS_DOKKA_VERSION=1.7.10
7476

7577
## Other dependency versions
7678
ACCOMPANIEST_VERSION=0.25.1

‎library/build.gradle

+13
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,19 @@ android {
6969
}
7070
}
7171

72+
// Change the name to make it a little more obvious where the main library
73+
// documentation has gone. Using a capital letter happens to make this first in
74+
// the list too...
75+
afterEvaluate {
76+
dokkaHtmlPartial.configure {
77+
dokkaSourceSets {
78+
named("main") {
79+
moduleName.set("Glide")
80+
}
81+
}
82+
}
83+
}
84+
7285
check.dependsOn(':library:pmd:pmd')
7386
check.dependsOn(':library:test:check')
7487

‎static/glide_circle_logo.png

6.64 KB
Loading

‎static/logo-icon.svg

+7
Loading

‎static/logo-styles.css

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.library-name a {
2+
position: relative;
3+
--logo-width: 75px;
4+
margin-left: calc(var(--logo-width) + 5px);
5+
}
6+
7+
.library-name a::before {
8+
content: '';
9+
background: url("../images/glide_circle_logo.png") center no-repeat;
10+
background-size: contain;
11+
position: absolute;
12+
width: var(--logo-width);
13+
height: 50px;
14+
top: -18px;
15+
left: calc(-1 * var(--logo-width) - 5px);
16+
/* other styles required to make your page pretty */
17+
}

0 commit comments

Comments
 (0)
Please sign in to comment.