Skip to content

Commit

Permalink
Contribute Dokkatoo (#3188)
Browse files Browse the repository at this point in the history
  • Loading branch information
aSemy authored Oct 19, 2023
1 parent 8016c1f commit 35d1560
Show file tree
Hide file tree
Showing 367 changed files with 15,468 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(11))
}
}

Expand Down
51 changes: 51 additions & 0 deletions dokka-runners/dokkatoo/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# https://help.github.com/articles/dealing-with-line-endings/
# https://github.com/alexkaratarakis/gitattributes

* text=auto

# The above will handle all files NOT found below

*.json text
*.toml text
*.xml text
*.yaml text
*.yml text
.editorconfig text
.env text

# Documentation
*.md text diff=markdown
*.txt text
LICENSE text

# JVM
*.java text diff=java
*.kt text diff=kotlin
*.kts text diff=kotlin
*.properties text
*.jar binary


# Linux start script should use lf
gradlew text eol=lf
*.bash text eol=lf
*.sh text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf
*.cmd text eol=crlf

# SVG treated as an asset (binary) by default.
*.svg text

# Exclude external libs from GitHub language stats https://github.com/github/linguist/blob/v7.24.1/docs/overrides.md
examples/** linguist-documentation
examples/*/dokka linguist-vendored
modules/dokkatoo-plugin-integration-tests/projects/**dokka/ linguist-vendored
modules/dokkatoo-plugin-integration-tests/projects/**dokkatoo/ linguist-documentation

# Exclude files from exporting

.gitattributes export-ignore
.gitignore export-ignore
.gitkeep export-ignore
71 changes: 71 additions & 0 deletions dokka-runners/dokkatoo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
### Gradle ###
.gradle
build/

!gradle/wrapper/gradle-wrapper.jar
!gradle/wrapper/gradle-wrapper.properties


### Kotlin/JVM ###
*.class
*.log

hs_err_pid*
replay_pid*
*.hprof

*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar


### IntelliJ ###
.idea/**
!.idea/codeStyles/
!.idea/codeStyles/**


### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
.settings/
.loadpath
.recommenders
.classpath

.apt_generated/
.apt_generated_test/
.project


### Linux ###
*~
.fuse_hidden*
.Trash-*
.nfs*


### Windows ###
[Dd]esktop.ini
$RECYCLE.BIN/
*.lnk


### macOS ###
.DS_Store
._*

# Icon must end with two \r
Icon


###########################
47 changes: 47 additions & 0 deletions dokka-runners/dokkatoo/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import buildsrc.utils.excludeGeneratedGradleDsl
import buildsrc.utils.initIdeProjectLogo

plugins {
buildsrc.conventions.base
idea
}

group = "org.jetbrains.dokka.dokkatoo"
version = "2.1.0-SNAPSHOT"


idea {
module {
excludeGeneratedGradleDsl(layout)

excludeDirs.apply {
// exclude .gradle, IDE dirs from nested projects (e.g. example & template projects)
// so IntelliJ project-wide search isn't cluttered with irrelevant files
val excludedDirs = setOf(
".idea",
".gradle",
"build",
"gradle/wrapper",
"ANDROID_SDK",
)
addAll(
projectDir.walk().filter { file ->
excludedDirs.any {
file.invariantSeparatorsPath.endsWith(it)
}
}
)
}
}
}

initIdeProjectLogo("modules/docs/images/logo-icon.svg")

val dokkatooVersion by tasks.registering {
description = "prints the Dokkatoo project version (used during release to verify the version)"
group = "help"
val version = providers.provider { project.version }
doLast {
logger.quiet("${version.orNull}")
}
}
19 changes: 19 additions & 0 deletions dokka-runners/dokkatoo/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import org.gradle.kotlin.dsl.support.expectedKotlinDslPluginsVersion

plugins {
`kotlin-dsl`
}

dependencies {
implementation("org.gradle.kotlin:gradle-kotlin-dsl-plugins:$expectedKotlinDslPluginsVersion")
implementation(libs.gradlePlugin.bcvMu)
implementation(libs.gradlePlugin.dokkatoo)
implementation(libs.gradlePlugin.gradlePublishPlugin)
implementation("org.jetbrains.kotlin:kotlin-serialization:$embeddedKotlinVersion")
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
25 changes: 25 additions & 0 deletions dokka-runners/dokkatoo/buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
rootProject.name = "buildSrc"

pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}

@Suppress("UnstableApiUsage")
dependencyResolutionManagement {

repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)

repositories {
mavenCentral()
gradlePluginPortal()
}

versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package buildsrc.conventions

import org.jetbrains.kotlin.util.suffixIfNot


/**
* Utilities for preparing Android projects
*/

plugins {
base
id("buildsrc.conventions.base")
}


val androidSdkDirPath: Provider<String> = providers
// first try getting the SDK installed on via GitHub step setup-android
.environmentVariable("ANDROID_SDK_ROOT").map(::File)
// else get the project-local SDK
.orElse(layout.projectDirectory.file("projects/ANDROID_SDK").asFile)
.map { it.invariantSeparatorsPath }


val createAndroidLocalPropertiesFile by tasks.registering {

val localPropertiesFile = temporaryDir.resolve("local.properties")
outputs.file(localPropertiesFile).withPropertyName("localPropertiesFile")

val androidSdkDirPath = androidSdkDirPath
inputs.property("androidSdkDirPath", androidSdkDirPath)

doLast {
localPropertiesFile.apply {
parentFile.mkdirs()
createNewFile()
writeText(
"""
|# DO NOT EDIT - Generated by $path
|
|sdk.dir=${androidSdkDirPath.get()}
|
""".trimMargin()
)
}
}
}


val updateAndroidLocalProperties by tasks.registering {

// find all local.properties files
val localPropertiesFiles = layout.projectDirectory.dir("projects")
.asFileTree
.matching { include("**/local.properties") }
.files

outputs.files(localPropertiesFiles).withPropertyName("localPropertiesFiles")

val androidSdkDirPath = androidSdkDirPath
inputs.property("androidSdkDirPath", androidSdkDirPath)

doLast {
localPropertiesFiles
.filter { it.exists() }
.forEach { file ->
file.writeText(
file.useLines { lines ->
lines.joinToString("\n") { line ->
when {
line.startsWith("sdk.dir=") -> "sdk.dir=${androidSdkDirPath.get()}"
else -> line
}
}.suffixIfNot("\n")
}
)
}
}
}
Loading

0 comments on commit 35d1560

Please sign in to comment.