aboutsummaryrefslogtreecommitdiff
path: root/kotlin-analysis/src/main/kotlin
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-07-18 12:18:59 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-14 17:51:11 +0200
commiteae1ce49d18c2978b49166ea502bf2c109a85504 (patch)
tree477f39e33f14c71042f06eecc938d6efaa95e66c /kotlin-analysis/src/main/kotlin
parent6c635551ed3ea0cfe5f04b54a98cb28225061d26 (diff)
downloaddokka-eae1ce49d18c2978b49166ea502bf2c109a85504.tar.gz
dokka-eae1ce49d18c2978b49166ea502bf2c109a85504.tar.bz2
dokka-eae1ce49d18c2978b49166ea502bf2c109a85504.zip
Simplify Dokka Gradle Plugin
Diffstat (limited to 'kotlin-analysis/src/main/kotlin')
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt11
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt4
2 files changed, 7 insertions, 8 deletions
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt
index 685bfe82..14067f43 100644
--- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt
+++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt
@@ -540,12 +540,11 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl
* Adds list of paths to source roots.
* $list: collection of files to add
*/
- fun addSources(list: List<String>) {
- list.forEach {
- configuration.addKotlinSourceRoot(it)
- val file = File(it)
- if (file.isDirectory || file.extension == ".java") {
- configuration.addJavaSourceRoot(file)
+ fun addSources(sourceDirectories: List<File>) {
+ sourceDirectories.forEach { directory ->
+ configuration.addKotlinSourceRoot(directory.path)
+ if (directory.isDirectory || directory.extension == ".java") {
+ configuration.addJavaSourceRoot(directory)
}
}
}
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt
index d9a89194..009bc66c 100644
--- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt
+++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt
@@ -17,12 +17,12 @@ internal fun createEnvironmentAndFacade(
if (analysisPlatform == Platform.jvm) {
addClasspath(PathUtil.getJdkClassesRootsFromCurrentJre())
}
- sourceSet.classpath.forEach { addClasspath(File(it)) }
+ sourceSet.classpath.forEach(::addClasspath)
addSources(
(sourceSet.sourceRoots + configuration.sourceSets.filter { it.sourceSetID in sourceSet.dependentSourceSets }
.flatMap { it.sourceRoots })
- .map { it.path }
+ .map { it.directory }
)
loadLanguageVersionSettings(sourceSet.languageVersion, sourceSet.apiVersion)