aboutsummaryrefslogtreecommitdiff
path: root/dokka-runners/dokkatoo/buildSrc/src/main/kotlin/buildsrc/utils/intellij.kt
diff options
context:
space:
mode:
Diffstat (limited to 'dokka-runners/dokkatoo/buildSrc/src/main/kotlin/buildsrc/utils/intellij.kt')
-rw-r--r--dokka-runners/dokkatoo/buildSrc/src/main/kotlin/buildsrc/utils/intellij.kt45
1 files changed, 45 insertions, 0 deletions
diff --git a/dokka-runners/dokkatoo/buildSrc/src/main/kotlin/buildsrc/utils/intellij.kt b/dokka-runners/dokkatoo/buildSrc/src/main/kotlin/buildsrc/utils/intellij.kt
new file mode 100644
index 00000000..f93e7683
--- /dev/null
+++ b/dokka-runners/dokkatoo/buildSrc/src/main/kotlin/buildsrc/utils/intellij.kt
@@ -0,0 +1,45 @@
+package buildsrc.utils
+
+import org.gradle.api.Project
+import org.gradle.api.file.ProjectLayout
+import org.gradle.plugins.ide.idea.model.IdeaModule
+
+
+/** exclude generated Gradle code, so it doesn't clog up search results */
+fun IdeaModule.excludeGeneratedGradleDsl(layout: ProjectLayout) {
+
+ val generatedSrcDirs = listOf(
+ "kotlin-dsl-accessors",
+ "kotlin-dsl-external-plugin-spec-builders",
+ "kotlin-dsl-plugins",
+ )
+
+ excludeDirs.addAll(
+ layout.projectDirectory.asFile.walk()
+ .filter { it.isDirectory && it.parentFile.name in generatedSrcDirs }
+ .flatMap { file ->
+ file.walk().maxDepth(1).filter { it.isDirectory }.toList()
+ }
+ )
+}
+
+
+/** Sets a logo for project IDEs */
+fun Project.initIdeProjectLogo(
+ svgLogoPath: String
+) {
+ val logoSvg = rootProject.layout.projectDirectory.file(svgLogoPath)
+ val ideaDir = rootProject.layout.projectDirectory.dir(".idea")
+
+ if (
+ logoSvg.asFile.exists()
+ && ideaDir.asFile.exists()
+ && !ideaDir.file("icon.png").asFile.exists()
+ && !ideaDir.file("icon.svg").asFile.exists()
+ ) {
+ copy {
+ from(logoSvg) { rename { "icon.svg" } }
+ into(ideaDir)
+ }
+ }
+}