Skip to content

Commit 35d1560

Browse files
authored
Contribute Dokkatoo (#3188)
1 parent 8016c1f commit 35d1560

File tree

367 files changed

+15468
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

367 files changed

+15468
-3
lines changed

build-logic/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins {
1010

1111
kotlin {
1212
jvmToolchain {
13-
languageVersion.set(JavaLanguageVersion.of(8))
13+
languageVersion.set(JavaLanguageVersion.of(11))
1414
}
1515
}
1616

dokka-runners/dokkatoo/.gitattributes

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# https://help.github.com/articles/dealing-with-line-endings/
2+
# https://github.com/alexkaratarakis/gitattributes
3+
4+
* text=auto
5+
6+
# The above will handle all files NOT found below
7+
8+
*.json text
9+
*.toml text
10+
*.xml text
11+
*.yaml text
12+
*.yml text
13+
.editorconfig text
14+
.env text
15+
16+
# Documentation
17+
*.md text diff=markdown
18+
*.txt text
19+
LICENSE text
20+
21+
# JVM
22+
*.java text diff=java
23+
*.kt text diff=kotlin
24+
*.kts text diff=kotlin
25+
*.properties text
26+
*.jar binary
27+
28+
29+
# Linux start script should use lf
30+
gradlew text eol=lf
31+
*.bash text eol=lf
32+
*.sh text eol=lf
33+
34+
# These are Windows script files and should use crlf
35+
*.bat text eol=crlf
36+
*.cmd text eol=crlf
37+
38+
# SVG treated as an asset (binary) by default.
39+
*.svg text
40+
41+
# Exclude external libs from GitHub language stats https://github.com/github/linguist/blob/v7.24.1/docs/overrides.md
42+
examples/** linguist-documentation
43+
examples/*/dokka linguist-vendored
44+
modules/dokkatoo-plugin-integration-tests/projects/**dokka/ linguist-vendored
45+
modules/dokkatoo-plugin-integration-tests/projects/**dokkatoo/ linguist-documentation
46+
47+
# Exclude files from exporting
48+
49+
.gitattributes export-ignore
50+
.gitignore export-ignore
51+
.gitkeep export-ignore

dokka-runners/dokkatoo/.gitignore

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
### Gradle ###
2+
.gradle
3+
build/
4+
5+
!gradle/wrapper/gradle-wrapper.jar
6+
!gradle/wrapper/gradle-wrapper.properties
7+
8+
9+
### Kotlin/JVM ###
10+
*.class
11+
*.log
12+
13+
hs_err_pid*
14+
replay_pid*
15+
*.hprof
16+
17+
*.jar
18+
*.war
19+
*.nar
20+
*.ear
21+
*.zip
22+
*.tar.gz
23+
*.rar
24+
25+
26+
### IntelliJ ###
27+
.idea/**
28+
!.idea/codeStyles/
29+
!.idea/codeStyles/**
30+
31+
32+
### Eclipse ###
33+
.metadata
34+
bin/
35+
tmp/
36+
*.tmp
37+
*.bak
38+
*.swp
39+
*~.nib
40+
.settings/
41+
.loadpath
42+
.recommenders
43+
.classpath
44+
45+
.apt_generated/
46+
.apt_generated_test/
47+
.project
48+
49+
50+
### Linux ###
51+
*~
52+
.fuse_hidden*
53+
.Trash-*
54+
.nfs*
55+
56+
57+
### Windows ###
58+
[Dd]esktop.ini
59+
$RECYCLE.BIN/
60+
*.lnk
61+
62+
63+
### macOS ###
64+
.DS_Store
65+
._*
66+
67+
# Icon must end with two \r
68+
Icon
69+
70+
71+
###########################
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import buildsrc.utils.excludeGeneratedGradleDsl
2+
import buildsrc.utils.initIdeProjectLogo
3+
4+
plugins {
5+
buildsrc.conventions.base
6+
idea
7+
}
8+
9+
group = "org.jetbrains.dokka.dokkatoo"
10+
version = "2.1.0-SNAPSHOT"
11+
12+
13+
idea {
14+
module {
15+
excludeGeneratedGradleDsl(layout)
16+
17+
excludeDirs.apply {
18+
// exclude .gradle, IDE dirs from nested projects (e.g. example & template projects)
19+
// so IntelliJ project-wide search isn't cluttered with irrelevant files
20+
val excludedDirs = setOf(
21+
".idea",
22+
".gradle",
23+
"build",
24+
"gradle/wrapper",
25+
"ANDROID_SDK",
26+
)
27+
addAll(
28+
projectDir.walk().filter { file ->
29+
excludedDirs.any {
30+
file.invariantSeparatorsPath.endsWith(it)
31+
}
32+
}
33+
)
34+
}
35+
}
36+
}
37+
38+
initIdeProjectLogo("modules/docs/images/logo-icon.svg")
39+
40+
val dokkatooVersion by tasks.registering {
41+
description = "prints the Dokkatoo project version (used during release to verify the version)"
42+
group = "help"
43+
val version = providers.provider { project.version }
44+
doLast {
45+
logger.quiet("${version.orNull}")
46+
}
47+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import org.gradle.kotlin.dsl.support.expectedKotlinDslPluginsVersion
2+
3+
plugins {
4+
`kotlin-dsl`
5+
}
6+
7+
dependencies {
8+
implementation("org.gradle.kotlin:gradle-kotlin-dsl-plugins:$expectedKotlinDslPluginsVersion")
9+
implementation(libs.gradlePlugin.bcvMu)
10+
implementation(libs.gradlePlugin.dokkatoo)
11+
implementation(libs.gradlePlugin.gradlePublishPlugin)
12+
implementation("org.jetbrains.kotlin:kotlin-serialization:$embeddedKotlinVersion")
13+
}
14+
15+
java {
16+
toolchain {
17+
languageVersion.set(JavaLanguageVersion.of(11))
18+
}
19+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
rootProject.name = "buildSrc"
2+
3+
pluginManagement {
4+
repositories {
5+
mavenCentral()
6+
gradlePluginPortal()
7+
}
8+
}
9+
10+
@Suppress("UnstableApiUsage")
11+
dependencyResolutionManagement {
12+
13+
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
14+
15+
repositories {
16+
mavenCentral()
17+
gradlePluginPortal()
18+
}
19+
20+
versionCatalogs {
21+
create("libs") {
22+
from(files("../gradle/libs.versions.toml"))
23+
}
24+
}
25+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
package buildsrc.conventions
2+
3+
import org.jetbrains.kotlin.util.suffixIfNot
4+
5+
6+
/**
7+
* Utilities for preparing Android projects
8+
*/
9+
10+
plugins {
11+
base
12+
id("buildsrc.conventions.base")
13+
}
14+
15+
16+
val androidSdkDirPath: Provider<String> = providers
17+
// first try getting the SDK installed on via GitHub step setup-android
18+
.environmentVariable("ANDROID_SDK_ROOT").map(::File)
19+
// else get the project-local SDK
20+
.orElse(layout.projectDirectory.file("projects/ANDROID_SDK").asFile)
21+
.map { it.invariantSeparatorsPath }
22+
23+
24+
val createAndroidLocalPropertiesFile by tasks.registering {
25+
26+
val localPropertiesFile = temporaryDir.resolve("local.properties")
27+
outputs.file(localPropertiesFile).withPropertyName("localPropertiesFile")
28+
29+
val androidSdkDirPath = androidSdkDirPath
30+
inputs.property("androidSdkDirPath", androidSdkDirPath)
31+
32+
doLast {
33+
localPropertiesFile.apply {
34+
parentFile.mkdirs()
35+
createNewFile()
36+
writeText(
37+
"""
38+
|# DO NOT EDIT - Generated by $path
39+
|
40+
|sdk.dir=${androidSdkDirPath.get()}
41+
|
42+
""".trimMargin()
43+
)
44+
}
45+
}
46+
}
47+
48+
49+
val updateAndroidLocalProperties by tasks.registering {
50+
51+
// find all local.properties files
52+
val localPropertiesFiles = layout.projectDirectory.dir("projects")
53+
.asFileTree
54+
.matching { include("**/local.properties") }
55+
.files
56+
57+
outputs.files(localPropertiesFiles).withPropertyName("localPropertiesFiles")
58+
59+
val androidSdkDirPath = androidSdkDirPath
60+
inputs.property("androidSdkDirPath", androidSdkDirPath)
61+
62+
doLast {
63+
localPropertiesFiles
64+
.filter { it.exists() }
65+
.forEach { file ->
66+
file.writeText(
67+
file.useLines { lines ->
68+
lines.joinToString("\n") { line ->
69+
when {
70+
line.startsWith("sdk.dir=") -> "sdk.dir=${androidSdkDirPath.get()}"
71+
else -> line
72+
}
73+
}.suffixIfNot("\n")
74+
}
75+
)
76+
}
77+
}
78+
}

0 commit comments

Comments
 (0)