Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an integration with Dokka to generate Glide docs. #4902

Merged
merged 1 commit into from Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
78 changes: 68 additions & 10 deletions build.gradle
Expand Up @@ -5,27 +5,31 @@ buildscript {
repositories {
google()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
gradlePluginPortal()
}

dependencies {
classpath "com.android.tools.build:gradle:${ANDROID_GRADLE_VERSION}"
classpath "com.android.tools.build:gradle:$ANDROID_GRADLE_VERSION"
if (!hasProperty('DISABLE_ERROR_PRONE')) {
classpath "net.ltgt.gradle:gradle-errorprone-plugin:${ERROR_PRONE_PLUGIN_VERSION}"
classpath "net.ltgt.gradle:gradle-errorprone-plugin:$ERROR_PRONE_PLUGIN_VERSION"
}
classpath 'com.guardsquare:proguard-gradle:7.1.0'
classpath "se.bjurr.violations:violations-gradle-plugin:${VIOLATIONS_PLUGIN_VERSION}"
classpath "androidx.benchmark:benchmark-gradle-plugin:${ANDROID_X_BENCHMARK_VERSION}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${JETBRAINS_KOTLIN_VERSION}"
classpath "se.bjurr.violations:violations-gradle-plugin:$VIOLATIONS_PLUGIN_VERSION"
classpath "androidx.benchmark:benchmark-gradle-plugin:$ANDROID_X_BENCHMARK_VERSION"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$JETBRAINS_KOTLIN_VERSION"
classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:$KSP_GRADLE_PLUGIN_VERSION"
classpath "org.jetbrains.kotlinx:binary-compatibility-validator:0.11.0"
classpath "org.jetbrains.kotlinx:binary-compatibility-validator:$JETBRAINS_KOTLINX_BINARY_COMPATIBILITY_VALIDATOR_VERSION"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$JETBRAINS_DOKKA_VERSION"
}
}

repositories {
google()
mavenCentral()
}

apply plugin: 'binary-compatibility-validator'
apply plugin: 'org.jetbrains.dokka'

apiValidation {
ignoredProjects += ["ksp", "test", "gallery"]
Expand All @@ -41,8 +45,23 @@ if (JavaVersion.current().isJava8Compatible()) {
}
}

subprojects { project ->
dokkaHtmlMultiModule.configure {
moduleName.set("Glide")
}
afterEvaluate {
tasks.named("dokkaHtmlMultiModule") {
pluginsMapConfiguration.set(
[
"org.jetbrains.dokka.base.DokkaBase": """{
"customStyleSheets": ["${projectDir.toString()}/static/logo-styles.css"],
"customAssets" : ["${projectDir.toString()}/static/logo-icon.svg", "${projectDir.toString()}/static/glide_circle_logo.png"]
}"""
]
)
}
}

subprojects { project ->
repositories {
google()
mavenCentral()
Expand All @@ -61,6 +80,45 @@ subprojects { project ->
}
}

// Exclude packages not intended for public use.
if (![
"testutil",
"flickr",
"giphy",
"imgur",
"svg",
"gallery",
"contacturi",
"test",
"gif_decoder",
"gifencoder",
"compiler",
"benchmark",
"instrumentation"
].contains(project.getName())) {
afterEvaluate {
project.apply plugin: 'org.jetbrains.dokka'

project.tasks.dokkaHtmlPartial.configure {
dokkaSourceSets {
// Kotlin works out of the box
if (!project.plugins.hasPlugin("kotlin-android") && project.plugins.hasPlugin("com.android.library")) {
// Java Android modules
register("main") {
sourceRoots.from(project.android.sourceSets.main.java.srcDirs)

}
} else if (project.plugins.hasPlugin("java") && "ksp" != project.getName()) {
// Java only modules (ksp is not useful and uses multiple plugins)
register("main") {
sourceRoots.from(sourceSets.main.java.srcDirs)
}
}
}
}
}
}

tasks.withType(JavaCompile) {
// gifencoder is a legacy project that has a ton of warnings and is basically never
// modified, so we're not going to worry about cleaning it up.
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Expand Up @@ -71,6 +71,8 @@ JETBRAINS_KOTLINX_COROUTINES_VERSION=1.6.4
JETBRAINS_KOTLINX_COROUTINES_TEST_VERSION=1.6.4
JETBRAINS_KOTLIN_VERSION=1.7.0
JETBRAINS_KOTLIN_TEST_VERSION=1.7.0
JETBRAINS_KOTLINX_BINARY_COMPATIBILITY_VALIDATOR_VERSION=0.11.0
JETBRAINS_DOKKA_VERSION=1.7.10

## Other dependency versions
ACCOMPANIEST_VERSION=0.25.1
Expand Down
13 changes: 13 additions & 0 deletions library/build.gradle
Expand Up @@ -69,6 +69,19 @@ android {
}
}

// Change the name to make it a little more obvious where the main library
// documentation has gone. Using a capital letter happens to make this first in
// the list too...
afterEvaluate {
dokkaHtmlPartial.configure {
dokkaSourceSets {
named("main") {
moduleName.set("Glide")
}
}
}
}

check.dependsOn(':library:pmd:pmd')
check.dependsOn(':library:test:check')

Expand Down
Binary file added static/glide_circle_logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions static/logo-icon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions static/logo-styles.css
@@ -0,0 +1,17 @@
.library-name a {
position: relative;
--logo-width: 75px;
margin-left: calc(var(--logo-width) + 5px);
}

.library-name a::before {
content: '';
background: url("../images/glide_circle_logo.png") center no-repeat;
background-size: contain;
position: absolute;
width: var(--logo-width);
height: 50px;
top: -18px;
left: calc(-1 * var(--logo-width) - 5px);
/* other styles required to make your page pretty */
}