1 /* 2 * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 import org.gradle.api.Project 6 import org.gradle.kotlin.dsl.delegateClosureOf 7 import org.gradle.kotlin.dsl.withType 8 import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink.Builder 9 import org.jetbrains.dokka.gradle.DokkaTask 10 import java.io.File 11 import java.net.URL 12 13 /** 14 * Package-list by external URL for documentation generation. 15 */ externalDocumentationLinknull16fun Project.externalDocumentationLink( 17 url: String, 18 packageList: File = projectDir.resolve("package.list") 19 ) { 20 tasks.withType<DokkaTask>().configureEach { 21 externalDocumentationLink(delegateClosureOf<Builder> { 22 this.url = URL(url) 23 packageListUrl = packageList.toPath().toUri().toURL() 24 }) 25 } 26 } 27