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 Dokkatoo #3188

Merged
merged 1 commit into from
Oct 19, 2023
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.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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
Loading