diff options
Diffstat (limited to 'runners')
19 files changed, 265 insertions, 60 deletions
diff --git a/runners/android-gradle-plugin/build.gradle b/runners/android-gradle-plugin/build.gradle index 72d1be9e..28b0cbb9 100644 --- a/runners/android-gradle-plugin/build.gradle +++ b/runners/android-gradle-plugin/build.gradle @@ -76,7 +76,7 @@ artifacts { } pluginBundle { - website = 'http://www.kotlinlang.org/' + website = 'https://www.kotlinlang.org/' vcsUrl = 'https://github.com/kotlin/dokka.git' description = 'Dokka, the Kotlin documentation tool' tags = ['dokka', 'kotlin', 'kdoc', 'android'] diff --git a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt index bd2e88c2..b1996da0 100644 --- a/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt +++ b/runners/android-gradle-plugin/src/main/kotlin/mainAndroid.kt @@ -10,6 +10,7 @@ open class DokkaAndroidPlugin : Plugin<Project> { override fun apply(project: Project) { DokkaVersion.loadFrom(javaClass.getResourceAsStream("/META-INF/gradle-plugins/org.jetbrains.dokka-android.properties")) project.tasks.create("dokka", DokkaAndroidTask::class.java).apply { + dokkaRuntime = project.configurations.create("dokkaRuntime") moduleName = project.name outputDirectory = File(project.buildDir, "dokka").absolutePath } diff --git a/runners/ant/src/main/kotlin/ant/dokka.kt b/runners/ant/src/main/kotlin/ant/dokka.kt index 5a4111e8..fe793396 100644 --- a/runners/ant/src/main/kotlin/ant/dokka.kt +++ b/runners/ant/src/main/kotlin/ant/dokka.kt @@ -80,7 +80,7 @@ class AntPassConfig(task: Task) : DokkaConfiguration.PassConfiguration { get() { val links = mutableListOf<DokkaConfiguration.ExternalDocumentationLink>() if (!noJdkLink) - links += DokkaConfiguration.ExternalDocumentationLink.Builder("http://docs.oracle.com/javase/$jdkVersion/docs/api/").build() + links += DokkaConfiguration.ExternalDocumentationLink.Builder("https://docs.oracle.com/javase/$jdkVersion/docs/api/").build() if (!noStdlibLink) links += DokkaConfiguration.ExternalDocumentationLink.Builder("https://kotlinlang.org/api/latest/jvm/stdlib/").build() @@ -172,6 +172,9 @@ class DokkaAntTask: Task(), DokkaConfiguration { if (sourceLink.path == null) { throw BuildException("'path' attribute of a <sourceLink> element is required") } + if (sourceLink.path.contains("\\")) { + throw BuildException("'dir' attribute of a <sourceLink> - incorrect value, only Unix based path allowed") + } if (sourceLink.url == null) { throw BuildException("'url' attribute of a <sourceLink> element is required") diff --git a/runners/gradle-integration-tests/build.gradle b/runners/gradle-integration-tests/build.gradle index a681c82e..297a175a 100644 --- a/runners/gradle-integration-tests/build.gradle +++ b/runners/gradle-integration-tests/build.gradle @@ -56,4 +56,5 @@ testClasses.dependsOn createClasspathManifest test { systemProperty "android.licenses.overwrite", project.findProperty("android.licenses.overwrite") ?: "" + inputs.dir(file('testData')) }
\ No newline at end of file diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/TypeSafeConfigurationTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/TypeSafeConfigurationTest.kt new file mode 100644 index 00000000..7b179e92 --- /dev/null +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/TypeSafeConfigurationTest.kt @@ -0,0 +1,36 @@ +package org.jetbrains.dokka.gradle + +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.Parameterized + +@RunWith(Parameterized::class) +class TypeSafeConfigurationTest(private val testCase: TestCase) : AbstractDokkaGradleTest() { + + data class TestCase(val gradleVersion: String, val kotlinVersion: String) { + override fun toString(): String = "Gradle $gradleVersion and Kotlin $kotlinVersion" + } + + companion object { + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun testCases() = listOf( + TestCase("4.0", "1.1.2"), + TestCase("4.5", "1.2.20"), + TestCase("4.10.1", "1.2.60") + ) + } + + @Test + fun test() { + + testDataFolder.resolve("typeSafeConfiguration").toFile() + .copyRecursively(testProjectDir.root) + + configure( + testCase.gradleVersion, + testCase.kotlinVersion, + arguments = arrayOf("help", "-s") + ).build() + } +} diff --git a/runners/gradle-integration-tests/testData/androidApp/build.gradle b/runners/gradle-integration-tests/testData/androidApp/build.gradle index 59477b52..35356b90 100644 --- a/runners/gradle-integration-tests/testData/androidApp/build.gradle +++ b/runners/gradle-integration-tests/testData/androidApp/build.gradle @@ -3,7 +3,7 @@ buildscript { mavenCentral() jcenter() maven { url 'https://maven.google.com' } - maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap-1.1" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } } dependencies { @@ -15,7 +15,7 @@ allprojects { repositories { mavenCentral() jcenter() - maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap-1.1" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } } } diff --git a/runners/gradle-integration-tests/testData/androidApp/fileTree.txt b/runners/gradle-integration-tests/testData/androidApp/fileTree.txt index 3827b69e..f66c79e3 100644 --- a/runners/gradle-integration-tests/testData/androidApp/fileTree.txt +++ b/runners/gradle-integration-tests/testData/androidApp/fileTree.txt @@ -9,6 +9,7 @@ -init-.html index.html on-create-options-menu.html + on-create.html -kotlin-activity/ -init-.html index.html diff --git a/runners/gradle-integration-tests/testData/androidAppJavadoc/build.gradle b/runners/gradle-integration-tests/testData/androidAppJavadoc/build.gradle index 59477b52..35356b90 100644 --- a/runners/gradle-integration-tests/testData/androidAppJavadoc/build.gradle +++ b/runners/gradle-integration-tests/testData/androidAppJavadoc/build.gradle @@ -3,7 +3,7 @@ buildscript { mavenCentral() jcenter() maven { url 'https://maven.google.com' } - maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap-1.1" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } } dependencies { @@ -15,7 +15,7 @@ allprojects { repositories { mavenCentral() jcenter() - maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap-1.1" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } } } diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/build.gradle b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/build.gradle index 59477b52..35356b90 100644 --- a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/build.gradle +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/build.gradle @@ -3,7 +3,7 @@ buildscript { mavenCentral() jcenter() maven { url 'https://maven.google.com' } - maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap-1.1" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } } dependencies { @@ -15,7 +15,7 @@ allprojects { repositories { mavenCentral() jcenter() - maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap-1.1" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } } } diff --git a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/fileTree.txt b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/fileTree.txt index 5e969d8b..77b563b2 100644 --- a/runners/gradle-integration-tests/testData/androidMultiFlavourApp/fileTree.txt +++ b/runners/gradle-integration-tests/testData/androidMultiFlavourApp/fileTree.txt @@ -10,6 +10,7 @@ -init-.html index.html on-create-options-menu.html + on-create.html -kotlin-activity/ -init-.html index.html @@ -35,6 +36,7 @@ -init-.html index.html on-create-options-menu.html + on-create.html -kotlin-activity/ -init-.html index.html diff --git a/runners/gradle-integration-tests/testData/basic/build.gradle b/runners/gradle-integration-tests/testData/basic/build.gradle index 4a259f50..a3116751 100644 --- a/runners/gradle-integration-tests/testData/basic/build.gradle +++ b/runners/gradle-integration-tests/testData/basic/build.gradle @@ -2,7 +2,7 @@ buildscript { repositories { mavenCentral() jcenter() - maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap-1.1" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } } dependencies { @@ -21,7 +21,7 @@ repositories { mavenCentral() jcenter() maven { - url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" + url "https://dl.bintray.com/kotlin/kotlin-eap-1.1" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" diff --git a/runners/gradle-integration-tests/testData/multiProjectSingleOut/build.gradle b/runners/gradle-integration-tests/testData/multiProjectSingleOut/build.gradle index 68d93e30..4f561472 100644 --- a/runners/gradle-integration-tests/testData/multiProjectSingleOut/build.gradle +++ b/runners/gradle-integration-tests/testData/multiProjectSingleOut/build.gradle @@ -7,7 +7,7 @@ subprojects { repositories { mavenCentral() jcenter() - maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap-1.1" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } } dependencies { @@ -17,7 +17,7 @@ subprojects { repositories { mavenCentral() jcenter() - maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap-1.1" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } } } diff --git a/runners/gradle-integration-tests/testData/sourcesChange/build.gradle b/runners/gradle-integration-tests/testData/sourcesChange/build.gradle index bc20e1cf..4627e8ef 100644 --- a/runners/gradle-integration-tests/testData/sourcesChange/build.gradle +++ b/runners/gradle-integration-tests/testData/sourcesChange/build.gradle @@ -2,7 +2,7 @@ buildscript { repositories { mavenCentral() jcenter() - maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" } + maven { url "https://dl.bintray.com/kotlin/kotlin-eap-1.1" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } } dependencies { @@ -21,7 +21,7 @@ repositories { mavenCentral() jcenter() maven { - url "http://dl.bintray.com/kotlin/kotlin-eap-1.1" + url "https://dl.bintray.com/kotlin/kotlin-eap-1.1" } maven { url "https://dl.bintray.com/kotlin/kotlin-dev" diff --git a/runners/gradle-integration-tests/testData/typeSafeConfiguration/build.gradle b/runners/gradle-integration-tests/testData/typeSafeConfiguration/build.gradle new file mode 100644 index 00000000..327cead8 --- /dev/null +++ b/runners/gradle-integration-tests/testData/typeSafeConfiguration/build.gradle @@ -0,0 +1,84 @@ +import org.jetbrains.dokka.* +import org.jetbrains.dokka.gradle.* +import org.jetbrains.kotlin.gradle.tasks.* + +import groovy.transform.CompileStatic +import java.util.concurrent.Callable + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$test_kotlin_version" + } +} + +plugins { + id 'org.jetbrains.dokka' +} + +apply plugin: 'kotlin' + +@CompileStatic +def configureDokkaTypeSafely(DokkaTask dokka) { + dokka.with { + moduleName = "some String" + outputFormat = "some String" + outputDirectory = "some String" + classpath = Collections.singleton(file("someClassDir")) + includes = Collections.emptyList() + linkMappings = new ArrayList<LinkMapping>() + samples = Collections.emptyList() + jdkVersion = 6 + sourceDirs = Collections.<File>emptyList() + sourceRoots = new ArrayList<SourceRoot>() + dokkaFatJar = file("some File") + includeNonPublic = false + skipDeprecated = false + skipEmptyPackages = true + reportUndocumented = true + perPackageOptions = new ArrayList<PackageOptions>() + impliedPlatforms = Collections.<String>emptyList() + externalDocumentationLinks = new ArrayList<DokkaConfiguration.ExternalDocumentationLink>() + noStdlibLink = false + cacheRoot = null as String + languageVersion = null as String + apiVersion = null as String + kotlinTasks(new Callable<List<Object>>() { + @Override + List<Object> call() { + return defaultKotlinTasks() + } + }) + linkMapping(new Action<LinkMapping>() { + @Override + void execute(LinkMapping mapping) { + mapping.dir = "some String" + mapping.url = "some String" + } + }) + sourceRoot(new Action<SourceRoot>() { + @Override + void execute(SourceRoot sourceRoot) { + sourceRoot.path = "some String" + } + }) + packageOptions(new Action<PackageOptions>() { + @Override + void execute(PackageOptions packageOptions) { + packageOptions.prefix = "some String" + } + }) + externalDocumentationLink(new Action<DokkaConfiguration.ExternalDocumentationLink.Builder>() { + @Override + void execute(DokkaConfiguration.ExternalDocumentationLink.Builder builder) { + builder.url = uri("some URI").toURL() + } + }) + } +} + +project.tasks.withType(DokkaTask) { dokka -> + configureDokkaTypeSafely(dokka) +} diff --git a/runners/gradle-integration-tests/testData/typeSafeConfiguration/settings.gradle b/runners/gradle-integration-tests/testData/typeSafeConfiguration/settings.gradle new file mode 100644 index 00000000..be82e328 --- /dev/null +++ b/runners/gradle-integration-tests/testData/typeSafeConfiguration/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "type-safe-configuration"
\ No newline at end of file diff --git a/runners/gradle-plugin/build.gradle b/runners/gradle-plugin/build.gradle index 661d432b..8e59a7be 100644 --- a/runners/gradle-plugin/build.gradle +++ b/runners/gradle-plugin/build.gradle @@ -74,7 +74,7 @@ artifacts { } pluginBundle { - website = 'http://www.kotlinlang.org/' + website = 'https://www.kotlinlang.org/' vcsUrl = 'https://github.com/kotlin/dokka.git' description = 'Dokka, the Kotlin documentation tool' tags = ['dokka', 'kotlin', 'kdoc'] diff --git a/runners/gradle-plugin/src/main/kotlin/main.kt b/runners/gradle-plugin/src/main/kotlin/main.kt index 25ca370b..f726c6c7 100644 --- a/runners/gradle-plugin/src/main/kotlin/main.kt +++ b/runners/gradle-plugin/src/main/kotlin/main.kt @@ -1,10 +1,12 @@ package org.jetbrains.dokka.gradle import groovy.lang.Closure +import org.gradle.api.Action import org.gradle.api.DefaultTask import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.Task +import org.gradle.api.artifacts.Configuration import org.gradle.api.file.FileCollection import org.gradle.api.plugins.JavaBasePlugin import org.gradle.api.plugins.JavaPluginConvention @@ -30,6 +32,7 @@ open class DokkaPlugin : Plugin<Project> { override fun apply(project: Project) { DokkaVersion.loadFrom(javaClass.getResourceAsStream("/META-INF/gradle-plugins/org.jetbrains.dokka.properties")) project.tasks.create("dokka", DokkaTask::class.java).apply { + dokkaRuntime = project.configurations.create("dokkaRuntime") moduleName = project.name outputDirectory = File(project.buildDir, "dokka").absolutePath } @@ -80,7 +83,7 @@ open class DokkaTask : DefaultTask() { @Input var outputFormat: String = "html" var outputDirectory: String = "" - + var dokkaRuntime: Configuration? = null @Deprecated("Going to be removed in 0.9.16, use classpath + sourceDirs instead if kotlinTasks is not suitable for you") @Input var processConfigurations: List<Any?> = emptyList() @@ -147,14 +150,17 @@ open class DokkaTask : DefaultTask() { private var kotlinTasksConfigurator: () -> List<Any?>? = { defaultKotlinTasks() } private val kotlinTasks: List<Task> by lazy { extractKotlinCompileTasks() } + fun kotlinTasks(taskSupplier: Callable<List<Any>>) { + kotlinTasksConfigurator = { taskSupplier.call() } + } + fun kotlinTasks(closure: Closure<Any?>) { kotlinTasksConfigurator = { closure.call() as? List<Any?> } } - fun linkMapping(closure: Closure<Unit>) { + fun linkMapping(action: Action<LinkMapping>) { val mapping = LinkMapping() - closure.delegate = mapping - closure.call() + action.execute(mapping) if (mapping.path.isEmpty()) { throw IllegalArgumentException("Link mapping should have dir") @@ -166,33 +172,55 @@ open class DokkaTask : DefaultTask() { linkMappings.add(mapping) } - fun sourceRoot(closure: Closure<Unit>) { + fun linkMapping(closure: Closure<Unit>) { + linkMapping(Action { mapping -> + closure.delegate = mapping + closure.call() + }) + } + + fun sourceRoot(action: Action<SourceRoot>) { val sourceRoot = SourceRoot() - closure.delegate = sourceRoot - closure.call() + action.execute(sourceRoot) sourceRoots.add(sourceRoot) } - fun packageOptions(closure: Closure<Unit>) { + fun sourceRoot(closure: Closure<Unit>) { + sourceRoot(Action { sourceRoot -> + closure.delegate = sourceRoot + closure.call() + }) + } + + fun packageOptions(action: Action<PackageOptions>) { val packageOptions = PackageOptions() - closure.delegate = packageOptions - closure.call() + action.execute(packageOptions) perPackageOptions.add(packageOptions) } - fun externalDocumentationLink(closure: Closure<Unit>) { + fun packageOptions(closure: Closure<Unit>) { + packageOptions(Action { packageOptions -> + closure.delegate = packageOptions + closure.call() + }) + } + + fun externalDocumentationLink(action: Action<DokkaConfiguration.ExternalDocumentationLink.Builder>) { val builder = DokkaConfiguration.ExternalDocumentationLink.Builder() - closure.delegate = builder - closure.call() + action.execute(builder) externalDocumentationLinks.add(builder.build()) } - fun tryResolveFatJar(project: Project): File { + fun externalDocumentationLink(closure: Closure<Unit>) { + externalDocumentationLink(Action { builder -> + closure.delegate = builder + closure.call() + }) + } + + fun tryResolveFatJar(project: Project): Set<File> { return try { - val dependency = project.buildscript.dependencies.create(dokkaFatJar) - val configuration = project.buildscript.configurations.detachedConfiguration(dependency) - configuration.description = "Dokka main jar" - configuration.resolve().first() + dokkaRuntime!!.resolve() } catch (e: Exception) { project.parent?.let { tryResolveFatJar(it) } ?: throw e } @@ -200,11 +228,11 @@ open class DokkaTask : DefaultTask() { fun loadFatJar() { if (fatJarClassLoader == null) { - val fatjar = if (dokkaFatJar is File) - dokkaFatJar as File + val jars = if (dokkaFatJar is File) + setOf(dokkaFatJar as File) else tryResolveFatJar(project) - fatJarClassLoader = URLClassLoader(arrayOf(fatjar.toURI().toURL()), ClassLoader.getSystemClassLoader().parent) + fatJarClassLoader = URLClassLoader(jars.map { it.toURI().toURL() }.toTypedArray(), ClassLoader.getSystemClassLoader().parent) } } @@ -269,6 +297,11 @@ open class DokkaTask : DefaultTask() { @TaskAction fun generate() { + if (dokkaRuntime == null){ + dokkaRuntime = project.configurations.getByName("dokkaRuntime") + } + + dokkaRuntime?.defaultDependencies{ dependencies -> dependencies.add(project.dependencies.create(dokkaFatJar)) } val kotlinColorsEnabledBefore = System.getProperty(COLORS_ENABLED_PROPERTY) ?: "false" System.setProperty(COLORS_ENABLED_PROPERTY, "false") try { @@ -414,7 +447,9 @@ open class LinkMapping : Serializable, DokkaConfiguration.SourceLinkDefinition { var dir: String get() = path set(value) { - path = value + if (value.contains("\\")) + throw java.lang.IllegalArgumentException("Incorrect dir property, only Unix based path allowed.") + else path = value } override var path: String = "" diff --git a/runners/maven-plugin/build.gradle b/runners/maven-plugin/build.gradle index 7e94058e..2e9d0b1b 100644 --- a/runners/maven-plugin/build.gradle +++ b/runners/maven-plugin/build.gradle @@ -49,50 +49,84 @@ task setupMaven(type: Sync) { into "$buildDir/maven-bin" } +def mavenBuildDir = "$buildDir/maven" + + +sourceSets.main.resources { + srcDirs += "$mavenBuildDir/classes/java/main" + exclude "**/*.class" +} + task generatePom() { inputs.file(new File(projectDir, "pom.tpl.xml")) - outputs.file(new File(buildDir, "pom.xml")) + outputs.file(new File(mavenBuildDir, "pom.xml")) doLast { final pomTemplate = new File(projectDir, "pom.tpl.xml") - final pom = new File(buildDir, "pom.xml") + final pom = new File(mavenBuildDir, "pom.xml") + pom.parentFile.mkdirs() pom.text = pomTemplate.text.replace("<version>dokka_version</version>", "<version>$dokka_version</version>") .replace("<maven.version></maven.version>", "<maven.version>$maven_version</maven.version>") .replace("<version>maven-plugin-plugin</version>", "<version>$maven_plugin_tools_version</version>") } } - -task mergeClassOutputs doLast { - def sourceDir = new File(buildDir, "classes/kotlin") - def targetDir = new File(buildDir, "classes/java") - - sourceDir.eachFileRecurse FileType.ANY, { - def filePath = it.toPath() - def targetFilePath = targetDir.toPath().resolve(sourceDir.toPath().relativize(filePath)) - if (it.isFile()) { - Files.move(filePath, targetFilePath, StandardCopyOption.REPLACE_EXISTING) - } else if (it.isDirectory()) { - targetFilePath.toFile().mkdirs() - } +// +//task mergeClassOutputs doLast { +// def sourceDir = new File(buildDir, "classes/kotlin") +// def targetDir = new File(buildDir, "classes/java") +// +// sourceDir.eachFileRecurse FileType.ANY, { +// def filePath = it.toPath() +// def targetFilePath = targetDir.toPath().resolve(sourceDir.toPath().relativize(filePath)) +// if (it.isFile()) { +// Files.move(filePath, targetFilePath, StandardCopyOption.REPLACE_EXISTING) +// } else if (it.isDirectory()) { +// targetFilePath.toFile().mkdirs() +// } +// } +//} + + + +task syncKotlinClasses(type: Sync, dependsOn: compileKotlin) { + from "$buildDir/classes/kotlin" + into "$mavenBuildDir/classes/java" + + preserve { + include '**/*.class' } } -task pluginDescriptor(type: CrossPlatformExec, dependsOn: setupMaven) { - workingDir buildDir - commandLine mvn, '-e', '-B', 'org.apache.maven.plugins:maven-plugin-plugin:descriptor' +task syncJavaClasses(type: Sync, dependsOn: compileJava) { + from "$buildDir/classes/java" + into "$mavenBuildDir/classes/java" - dependsOn mergeClassOutputs + preserve { + include '**/*.class' + } } task helpMojo(type: CrossPlatformExec, dependsOn: setupMaven) { - workingDir buildDir + workingDir mavenBuildDir commandLine mvn, '-e', '-B', 'org.apache.maven.plugins:maven-plugin-plugin:helpmojo' - dependsOn mergeClassOutputs + dependsOn syncKotlinClasses +} + + +task pluginDescriptor(type: CrossPlatformExec, dependsOn: setupMaven) { + workingDir mavenBuildDir + commandLine mvn, '-e', '-B', 'org.apache.maven.plugins:maven-plugin-plugin:descriptor' + + dependsOn syncJavaClasses } + +//mergeClassOutputs.dependsOn compileKotlin +//helpMojo.dependsOn mergeClassOutputs helpMojo.dependsOn generatePom -sourceSets.main.java.srcDir("$buildDir/generated-sources/plugin") +sourceSets.main.java.srcDir("$buildDir/maven/generated-sources/plugin") compileJava.dependsOn helpMojo +processResources.dependsOn pluginDescriptor pluginDescriptor.dependsOn generatePom diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index a2771306..ed8a659f 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -4,6 +4,7 @@ import org.apache.maven.archiver.MavenArchiveConfiguration import org.apache.maven.archiver.MavenArchiver import org.apache.maven.execution.MavenSession import org.apache.maven.plugin.AbstractMojo +import org.apache.maven.plugin.MojoExecutionException import org.apache.maven.plugins.annotations.* import org.apache.maven.project.MavenProject import org.apache.maven.project.MavenProjectHelper @@ -122,6 +123,12 @@ abstract class AbstractDokkaMojo : AbstractMojo() { return } + sourceLinks.forEach { + if (it.dir.contains("\\")) { + throw MojoExecutionException("Incorrect dir property, only Unix based path allowed.") + } + } + val passConfiguration = PassConfigurationImpl( sourceLinks = sourceLinks.map { SourceLinkDefinitionImpl(it.dir, it.url, it.urlSuffix) }, jdkVersion = jdkVersion, @@ -200,7 +207,7 @@ class DokkaJavadocJarMojo : AbstractDokkaMojo() { /** * The archive configuration to use. - * See [Maven Archiver Reference](http://maven.apache.org/shared/maven-archiver/index.html) + * See [Maven Archiver Reference](https://maven.apache.org/shared/maven-archiver/index.html) */ @Parameter private val archive = MavenArchiveConfiguration() |