diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-01-31 00:37:29 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-01-31 15:27:26 +0100 |
commit | e99be615ce7c2c2b5c3ee5e3f8941c41c1e7a944 (patch) | |
tree | 7e3eb4f67d36d3b7b6db6aec08c58de2e1b678d3 | |
parent | 0073c4c547dafaae5d465d4c410a52fd7fdc818d (diff) | |
download | dokka-e99be615ce7c2c2b5c3ee5e3f8941c41c1e7a944.tar.gz dokka-e99be615ce7c2c2b5c3ee5e3f8941c41c1e7a944.tar.bz2 dokka-e99be615ce7c2c2b5c3ee5e3f8941c41c1e7a944.zip |
Bump Gradle version, migrate to Kotlin DSL, refactor publishing
52 files changed, 619 insertions, 965 deletions
diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 35fa8667..00000000 --- a/build.gradle +++ /dev/null @@ -1,120 +0,0 @@ -allprojects { - ext { - if (!project.findProperty("dokka_version")) { - final String buildNumber = System.getenv("BUILD_NUMBER") - dokka_version = dokka_version_base + (buildNumber == null || System.getenv("FORCE_SNAPSHOT") != null ? "-SNAPSHOT" : "-$buildNumber") - } - } - - if (project == rootProject) { - println "Publication version: $dokka_version" - } - - group 'org.jetbrains.dokka' - version dokka_version - - - buildscript { - repositories { - mavenCentral() - maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } - maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } - maven { url "https://plugins.gradle.org/m2/" } - } - dependencies { - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' - classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1' - - classpath "com.gradle.publish:plugin-publish-plugin:0.9.10" - } - } - - repositories { - jcenter() - mavenCentral() - mavenLocal() - maven { url 'https://kotlin.bintray.com/kotlin-plugin' } - maven { url 'https://www.jetbrains.com/intellij-repository/releases' } - maven { url "https://dl.bintray.com/jetbrains/markdown" } - maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } - maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } - maven { url "https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_dev_CompilerAllPlugins/$bundled_kotlin_compiler_version/maven" } - maven { url "https://kotlin.bintray.com/kotlinx" } - maven { url "https://dl.bintray.com/kotlin/kotlinx" } - maven { url "https://dl.bintray.com/orangy/maven" } // TODO: remove this repository when kotlinx.cli is available in maven - } -} - - -def bintrayPublication(project, List<String> _publications) { - configure(project, { - apply plugin: 'com.jfrog.bintray' - - bintray { - user = System.getenv('BINTRAY_USER') - key = System.getenv('BINTRAY_KEY') - - pkg { - repo = dokka_publication_channel - name = 'dokka' - userOrg = 'kotlin' - desc = 'Dokka, the Kotlin documentation tool' - vcsUrl = 'https://github.com/kotlin/dokka.git' - licenses = ['Apache-2.0'] - version { - name = dokka_version - } - } - - publications = _publications - } - }) -} - - -configurations { - ideaIC - intellijCore -} - -repositories { - maven { url 'https://kotlin.bintray.com/kotlin-plugin' } - maven { url 'https://www.jetbrains.com/intellij-repository/snapshots' } - maven { url 'https://www.jetbrains.com/intellij-repository/releases' } -} - -dependencies { - intellijCore "com.jetbrains.intellij.idea:intellij-core:$idea_version" - ideaIC "com.jetbrains.intellij.idea:ideaIC:$idea_version" -} - -def ideaRT() { - return zipTree(project.configurations.ideaIC.singleFile).matching ({ - include("lib/idea_rt.jar") - }) -} - -def repoLocation = uri(file("$buildDir/dist-maven")) - -allprojects { - - task publishToDistMaven { - group "publishing" - description "Publishes all Maven publications to Maven repository 'distMaven'." - dependsOn tasks.withType(PublishToMavenRepository).matching { - it.repository == publishing.repositories.distMaven - } - } - - plugins.withType(MavenPublishPlugin) { - publishing { - repositories { - maven { - name 'distMaven' - url repoLocation - } - } - } - - } -}
\ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..5540184a --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,43 @@ +import org.jetbrains.configureDistMaven +import org.jetbrains.configureDokkaVersion + +plugins { + kotlin("jvm") apply false + id("com.jfrog.bintray") apply false +} + +allprojects { + configureDokkaVersion() + val dokka_version: String by this + + if (this == rootProject) { + println("Publication version: $dokka_version") + } + group = "org.jetbrains.dokka" + version = dokka_version + + val language_version: String by project + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class).all { + kotlinOptions { + freeCompilerArgs += "-Xjsr305=strict" + languageVersion = language_version + apiVersion = language_version + jvmTarget = "1.8" + } + } + + repositories { + jcenter() + mavenCentral() + mavenLocal() + maven(url = "https://dl.bintray.com/jetbrains/markdown/") + } + + configureDistMaven() +} + +subprojects { + apply { + plugin("org.jetbrains.kotlin.jvm") + } +}
\ No newline at end of file diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index b62b4150..00000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,10 +0,0 @@ -apply plugin: 'groovy' -repositories { - mavenCentral() - jcenter() - maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } - maven { url "https://dl.bintray.com/kotlin/kotlin-dev" } -} -dependencies { - compile 'com.github.jengelman.gradle.plugins:shadow:2.0.4' -} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 00000000..aeec9540 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + `kotlin-dsl` + groovy +} + +repositories { + mavenCentral() + jcenter() +} + +dependencies { + implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4") + implementation("com.github.jengelman.gradle.plugins:shadow:2.0.4") +} diff --git a/buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy b/buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy deleted file mode 100644 index 62cc3d3c..00000000 --- a/buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy +++ /dev/null @@ -1,40 +0,0 @@ -package org.jetbrains - -import org.gradle.api.Project -import org.gradle.api.artifacts.ModuleVersionIdentifier -import org.gradle.api.artifacts.ProjectDependency -import org.gradle.api.artifacts.SelfResolvingDependency -import org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectDependencyPublicationResolver -import org.gradle.api.publish.maven.MavenPom -import org.gradle.api.publish.maven.MavenPublication - -//https://github.com/johnrengelman/shadow/issues/334 -static void configure(MavenPublication publication, Project project) { - publication.artifact(project.tasks.shadowJar) - - - publication.pom { MavenPom pom -> - pom.withXml { xml -> - def dependenciesNode = xml.asNode().appendNode('dependencies') - - project.configurations.shadow.allDependencies.each { - if (it instanceof ProjectDependency) { - final ProjectDependencyPublicationResolver projectDependencyResolver = project.gradle.services.get(ProjectDependencyPublicationResolver) - final ModuleVersionIdentifier identifier = projectDependencyResolver.resolve(ModuleVersionIdentifier, it) - addDependency(dependenciesNode, identifier) - } else if (!(it instanceof SelfResolvingDependency)) { - addDependency(dependenciesNode, it) - } - - } - } - } -} - -private static void addDependency(Node dependenciesNode, dep) { - def dependencyNode = dependenciesNode.appendNode('dependency') - dependencyNode.appendNode('groupId', dep.group) - dependencyNode.appendNode('artifactId', dep.name) - dependencyNode.appendNode('version', dep.version) - dependencyNode.appendNode('scope', 'compile') -} diff --git a/buildSrc/src/main/groovy/org/jetbrains/DependenciesVersionGetter.groovy b/buildSrc/src/main/groovy/org/jetbrains/DependenciesVersionGetter.groovy deleted file mode 100644 index 194f11af..00000000 --- a/buildSrc/src/main/groovy/org/jetbrains/DependenciesVersionGetter.groovy +++ /dev/null @@ -1,14 +0,0 @@ -package org.jetbrains - -import org.gradle.api.Project - -class DependenciesVersionGetter { - static Properties getVersions(Project project, String artifactVersionSelector) { - def dep = project.dependencies.create(group: 'teamcity', name: 'dependencies', version: artifactVersionSelector, ext: 'properties') - def file = project.configurations.detachedConfiguration(dep).resolve().first() - - def prop = new Properties() - prop.load(new FileReader(file)) - return prop - } -} diff --git a/buildSrc/src/main/groovy/org/jetbrains/PluginXmlTransformer.groovy b/buildSrc/src/main/groovy/org/jetbrains/PluginXmlTransformer.groovy deleted file mode 100644 index e711388f..00000000 --- a/buildSrc/src/main/groovy/org/jetbrains/PluginXmlTransformer.groovy +++ /dev/null @@ -1,71 +0,0 @@ -package org.jetbrains - -import com.github.jengelman.gradle.plugins.shadow.relocation.RelocateClassContext -import com.github.jengelman.gradle.plugins.shadow.relocation.Relocator -import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer -import com.github.jengelman.gradle.plugins.shadow.transformers.TransformerContext -import groovy.xml.XmlUtil -import org.gradle.api.file.FileTreeElement -import shadow.org.apache.tools.zip.ZipEntry -import shadow.org.apache.tools.zip.ZipOutputStream - -public class PluginXmlTransformer implements Transformer { - private Map<String, Node> transformedPluginXmlFiles = new HashMap<>(); - - @Override - boolean canTransformResource(FileTreeElement fileTreeElement) { - return fileTreeElement.relativePath.segments.contains("META-INF") && fileTreeElement.name.endsWith(".xml") - } - - @Override - void transform(TransformerContext context) { - def path = context.path - def inputStream = context.is - System.out.println(path) - Node node = new XmlParser().parse(inputStream) - relocateXml(node, context) - transformedPluginXmlFiles.put(path, node) - } - - @Override - boolean hasTransformedResource() { - return !transformedPluginXmlFiles.isEmpty() - } - - @Override - void modifyOutputStream(ZipOutputStream zipOutputStream) { - for (Map.Entry<String, Node> entry : transformedPluginXmlFiles.entrySet()) { - zipOutputStream.putNextEntry(new ZipEntry(entry.key)) - XmlUtil.serialize(entry.value, zipOutputStream) - } - } - - private static void relocateXml(Node node, TransformerContext context) { - Map attributes = node.attributes() - RelocateClassContext relocateClassContext = new RelocateClassContext() - relocateClassContext.stats = context.stats - for (Map.Entry entry : attributes.entrySet()) { - relocateClassContext.setClassName((String) entry.getValue()) - entry.setValue(relocateClassName(relocateClassContext, context)) - } - List<String> localText = node.localText() - if (localText.size() == 1) { - relocateClassContext.setClassName(localText[0]) - node.setValue(relocateClassName(relocateClassContext, context)) - } - node.children().each { - if (it instanceof Node) { - relocateXml((Node) it, context) - } - } - } - - private static String relocateClassName(RelocateClassContext relocateContext, TransformerContext context) { - for (Relocator relocator : context.relocators) { - if (relocator.canRelocateClass(relocateContext)) { - return relocator.relocateClass(relocateContext) - } - } - return relocateContext.className - } -}
\ No newline at end of file diff --git a/buildSrc/src/main/kotlin/org/jetbrains/BintrayPublishing.kt b/buildSrc/src/main/kotlin/org/jetbrains/BintrayPublishing.kt new file mode 100644 index 00000000..19e032a8 --- /dev/null +++ b/buildSrc/src/main/kotlin/org/jetbrains/BintrayPublishing.kt @@ -0,0 +1,29 @@ +package org.jetbrains + +import com.jfrog.bintray.gradle.BintrayExtension +import org.gradle.api.Project +import org.gradle.kotlin.dsl.provideDelegate + +fun Project.configureBintrayPublication(publication: String) = configureBintrayPublication(listOf(publication)) + +fun Project.configureBintrayPublication(publications: List<String>) { + val dokka_version: String by this + val dokka_publication_channel: String by this + extensions.configure<BintrayExtension>("bintray") { + user = System.getenv("BINTRAY_USER") + key = System.getenv("BINTRAY_KEY") + + pkg = PackageConfig().apply { + repo = dokka_publication_channel + name = "dokka" + userOrg = "kotlin" + desc = "Dokka, the Kotlin documentation tool" + vcsUrl = "https://github.com/kotlin/dokka.git" + setLicenses("Apache-2.0") + version = VersionConfig().apply { + name = dokka_version + } + } + setPublications(*publications.toTypedArray()) + } +}
\ No newline at end of file diff --git a/buildSrc/src/main/kotlin/org/jetbrains/DistMavenPublishing.kt b/buildSrc/src/main/kotlin/org/jetbrains/DistMavenPublishing.kt new file mode 100644 index 00000000..ec536bd7 --- /dev/null +++ b/buildSrc/src/main/kotlin/org/jetbrains/DistMavenPublishing.kt @@ -0,0 +1,28 @@ +package org.jetbrains + +import org.gradle.api.Project +import org.gradle.api.artifacts.repositories.MavenArtifactRepository +import org.gradle.api.publish.PublishingExtension +import org.gradle.api.publish.maven.tasks.PublishToMavenRepository + +fun Project.configureDistMaven() { // TODO: This can probably be written cleaner + val repoLocation = uri(file("${rootProject.buildDir}/dist-maven")) + var distMaven: MavenArtifactRepository? = null + pluginManager.withPlugin("maven-publish") { + this@configureDistMaven.extensions.findByType(PublishingExtension::class.java)?.let { + it.repositories { + distMaven = maven { + name = "distMaven" + url = repoLocation + } + } + } + } + tasks.register("publishToDistMaven") { + group = "publishing" + description = "Publishes all Maven publications to Maven repository 'distMaven'" + dependsOn(tasks.withType(PublishToMavenRepository::class.java).matching { + it.repository == distMaven + }) + } +}
\ No newline at end of file diff --git a/buildSrc/src/main/kotlin/org/jetbrains/DokkaVersion.kt b/buildSrc/src/main/kotlin/org/jetbrains/DokkaVersion.kt new file mode 100644 index 00000000..5bd35415 --- /dev/null +++ b/buildSrc/src/main/kotlin/org/jetbrains/DokkaVersion.kt @@ -0,0 +1,19 @@ +package org.jetbrains + +import org.gradle.api.Project +import org.gradle.kotlin.dsl.extra +import org.gradle.kotlin.dsl.provideDelegate + +fun Project.configureDokkaVersion(): String { + var dokka_version: String? by this.extra + if (dokka_version == null) { + val buildNumber = System.getenv("BUILD_NUMBER") + val dokka_version_base: String by this + dokka_version = dokka_version_base + if (buildNumber == null || System.getenv("FORCE_SNAPSHOT") != null) { + "-SNAPSHOT" + } else { + "-$buildNumber" + } + } + return dokka_version!! +}
\ No newline at end of file diff --git a/core/build.gradle b/core/build.gradle deleted file mode 100644 index a7379595..00000000 --- a/core/build.gradle +++ /dev/null @@ -1,72 +0,0 @@ -import javax.tools.ToolProvider - -buildscript { - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - apply plugin: 'kotlin' - - sourceCompatibility = 1.8 - - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - languageVersion = language_version - apiVersion = language_version - jvmTarget = "1.8" - } - } -} - -dependencies { - testCompile project(':testApi') - compile project(":integration") - compile project(path: ":coreDependencies", configuration: "shadow") - - compile "org.jetbrains.kotlin:kotlin-stdlib:$bundled_kotlin_compiler_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$bundled_kotlin_compiler_version" - - compile group: 'com.google.inject', name: 'guice', version: '3.0' - implementation "org.jsoup:jsoup:1.12.1" - - compile "org.jetbrains.kotlin:kotlin-compiler:$bundled_kotlin_compiler_version" - compile "org.jetbrains.kotlin:kotlin-script-runtime:$bundled_kotlin_compiler_version" - - compile "org.jetbrains:markdown:0.1.41" - - compile 'org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.10' - - - //tools.jar -// def toolsJar = files(((URLClassLoader) ToolProvider.getSystemToolClassLoader()).getURLs().findAll { it.path.endsWith("jar") }) -// compileOnly toolsJar -// testCompile toolsJar - - - testCompile group: 'junit', name: 'junit', version: '4.12' - testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlin_version - testCompile "com.nhaarman:mockito-kotlin-kt1.1:1.5.0" - implementation "com.google.code.gson:gson:$gson_version" - - testImplementation "org.jetbrains.kotlin:kotlin-stdlib-js:$bundled_kotlin_compiler_version" - testImplementation "org.jetbrains.kotlin:kotlin-stdlib-common:$bundled_kotlin_compiler_version" -// testImplementation project(":core:testApi") - - testCompile ideaRT() -} - -apply plugin: 'maven-publish' - -publishing { - publications { - dokkaCore(MavenPublication) { publication -> - artifactId = 'dokka-core' - - from components.java - } - } -} - -bintrayPublication(project, ["dokkaCore"]) diff --git a/core/build.gradle.kts b/core/build.gradle.kts new file mode 100644 index 00000000..06610a38 --- /dev/null +++ b/core/build.gradle.kts @@ -0,0 +1,49 @@ +import org.jetbrains.configureBintrayPublication + +plugins { + id("com.github.johnrengelman.shadow") + `maven-publish` + id("com.jfrog.bintray") +} + +dependencies { + implementation(project(":coreDependencies", configuration = "shadow")) + + val kotlin_version: String by project + implementation("org.jetbrains.kotlin:kotlin-compiler:$kotlin_version") + implementation("org.jetbrains.kotlin:kotlin-script-runtime:$kotlin_version") + implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version") + implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version") + implementation("org.jsoup:jsoup:1.12.1") + implementation("com.google.code.gson:gson:2.8.5") + implementation("org.jetbrains:markdown:0.1.40") + implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.10") + + testImplementation(project(":testApi")) + testImplementation("junit:junit:4.13") +} + +tasks { + shadowJar { + val dokka_version: String by project + archiveFileName.set("dokka-core-$dokka_version.jar") + archiveClassifier.set("") + } +} + +val sourceJar by tasks.registering(Jar::class) { + archiveClassifier.set("sources") + from(sourceSets["main"].allSource) +} + +publishing { + publications { + register<MavenPublication>("dokkaCore") { + artifactId = "dokka-core" + project.shadow.component(this) + artifact(sourceJar.get()) + } + } +} + +configureBintrayPublication("dokkaCore") diff --git a/integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt b/core/src/main/kotlin/DokkaBootstrap.kt index b78eb9c6..b78eb9c6 100644 --- a/integration/src/main/kotlin/org/jetbrains/dokka/DokkaBootstrap.kt +++ b/core/src/main/kotlin/DokkaBootstrap.kt diff --git a/core/src/main/kotlin/Java/JavadocParser.kt b/core/src/main/kotlin/Java/JavadocParser.kt index 5058634a..856cfa04 100644 --- a/core/src/main/kotlin/Java/JavadocParser.kt +++ b/core/src/main/kotlin/Java/JavadocParser.kt @@ -4,16 +4,12 @@ import com.intellij.psi.* import com.intellij.psi.impl.source.tree.JavaDocElementType import com.intellij.psi.javadoc.* import com.intellij.psi.util.PsiTreeUtil -import com.intellij.util.containers.isNullOrEmpty -import kotlinx.html.P import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.utilities.DokkaLogger -import org.jetbrains.kotlin.utils.keysToMap import org.jsoup.Jsoup import org.jsoup.nodes.Element import org.jsoup.nodes.Node import org.jsoup.nodes.TextNode -import java.net.URI interface JavaDocumentationParser { fun parseDocumentation(element: PsiNamedElement): DocumentationNode diff --git a/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt b/core/src/main/kotlin/configuration.kt index 8c6d35e8..8c6d35e8 100644 --- a/integration/src/main/kotlin/org/jetbrains/dokka/configuration.kt +++ b/core/src/main/kotlin/configuration.kt diff --git a/integration/src/main/kotlin/org/jetbrains/dokka/defaultConfiguration.kt b/core/src/main/kotlin/defaultConfiguration.kt index 6c797fcd..6c797fcd 100644 --- a/integration/src/main/kotlin/org/jetbrains/dokka/defaultConfiguration.kt +++ b/core/src/main/kotlin/defaultConfiguration.kt diff --git a/core/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt b/core/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt index ad165cdb..f9431bbb 100644 --- a/core/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt +++ b/core/src/test/kotlin/multiplatform/BasicMultiplatformTest.kt @@ -1,8 +1,8 @@ package multiplatform +import org.junit.Assert.assertEquals import org.junit.Test import testApi.testRunner.AbstractCoreTest -import kotlin.test.assertEquals class BasicMultiplatformTest : AbstractCoreTest() { diff --git a/coreDependencies/build.gradle b/coreDependencies/build.gradle deleted file mode 100644 index 2b166a93..00000000 --- a/coreDependencies/build.gradle +++ /dev/null @@ -1,45 +0,0 @@ -def intellijCoreAnalysis() { - return zipTree(project(":").configurations.intellijCore.singleFile).matching ({ - include("intellij-core-analysis.jar") - }) -} - -apply plugin: 'java' -apply plugin: 'com.github.johnrengelman.shadow' - -dependencies { - compile intellijCoreAnalysis() - compile "org.jetbrains.kotlin:kotlin-plugin-ij193:$kotlin_plugin_version" //TODO: parametrize ij version after 1.3.70 -} - -shadowJar { - baseName = 'dokka-dependencies' - classifier = '' - - configurations { - exclude compileOnly - } - - - exclude 'colorScheme/**' - exclude 'fileTemplates/**' - exclude 'inspectionDescriptions/**' - exclude 'intentionDescriptions/**' - exclude 'tips/**' - exclude 'messages/**' - - exclude 'src/**' -} - -apply plugin: 'maven-publish' - -publishing { - publications { - dokkaDependencies(MavenPublication) { publication -> - artifactId = 'dokka-dependencies' - project.shadow.component(publication) - } - } -} - -bintrayPublication(project, ["dokkaDependencies"])
\ No newline at end of file diff --git a/coreDependencies/build.gradle.kts b/coreDependencies/build.gradle.kts new file mode 100644 index 00000000..514c7ae1 --- /dev/null +++ b/coreDependencies/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + id("com.github.johnrengelman.shadow") + `maven-publish` +} + +val intellijCore: Configuration by configurations.creating + +repositories { + maven(url = "https://www.jetbrains.com/intellij-repository/snapshots") + maven(url = "https://www.jetbrains.com/intellij-repository/releases") + maven(url = "https://kotlin.bintray.com/kotlin-plugin") +} + +fun intellijCoreAnalysis() = zipTree(intellijCore.singleFile).matching { + include("intellij-core-analysis.jar") +} + +dependencies { + val idea_version: String by project + intellijCore("com.jetbrains.intellij.idea:intellij-core:$idea_version") + val kotlin_plugin_version: String by project + implementation(intellijCoreAnalysis()) + implementation("org.jetbrains.kotlin:kotlin-plugin-ij193:$kotlin_plugin_version") { + //TODO: parametrize ij version after 1.3.70 + isTransitive = false + } +} + +tasks { + shadowJar { + val dokka_version: String by project + archiveFileName.set("dokka-dependencies-$dokka_version.jar") + archiveClassifier.set("") + + exclude("colorScheme/**") + exclude("fileTemplates/**") + exclude("inspectionDescriptions/**") + exclude("intentionDescriptions/**") + exclude("tips/**") + exclude("messages/**") + exclude("src/**") + } +} diff --git a/gradle.properties b/gradle.properties index b0c74348..57ddc095 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,11 +2,9 @@ dokka_version_base=0.11.0 dokka_publication_channel=dokka # Kotlin compiler and plugin -bundled_kotlin_compiler_version=1.3.61 kotlin_version=1.3.61 kotlin_plugin_version=1.3.61-release-180 idea_version=192.5728.98 -kotlin_for_gradle_runtime_version=1.3.61 language_version=1.3 ant_version=1.9.6 @@ -14,12 +12,7 @@ ant_version=1.9.6 # Maven plugin dependencies maven_version=3.5.0 maven_archiver_version=2.5 -plexus_utils_version=3.0.22 -plexus_archiver_version=3.4 maven_plugin_tools_version=3.5.2 # For CI -mvn=mvn - -# For serialization -gson_version=2.8.5
\ No newline at end of file +mvn=mvn
\ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differindex 5c2d1cf0..f3d88b1c 100644 --- a/gradle/wrapper/gradle-wrapper.jar +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f9fe22d1..a869af2d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ -#Wed Sep 18 14:13:14 CEST 2019 -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip +#Wed Jan 29 14:26:26 CET 2020 +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists @@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -175,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/integration-tests/build.gradle b/integration-tests/build.gradle deleted file mode 100644 index 23d232d2..00000000 --- a/integration-tests/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -subprojects { - buildscript { - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } - } -}
\ No newline at end of file diff --git a/integration-tests/build.gradle.kts b/integration-tests/build.gradle.kts new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/integration-tests/build.gradle.kts diff --git a/integration-tests/gradle-integration-tests/build.gradle b/integration-tests/gradle-integration-tests/build.gradle deleted file mode 100644 index 70213d8b..00000000 --- a/integration-tests/gradle-integration-tests/build.gradle +++ /dev/null @@ -1,60 +0,0 @@ -apply plugin: 'kotlin' - -sourceCompatibility = 1.8 - -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - freeCompilerArgs += "-Xjsr305=strict" - languageVersion = language_version - apiVersion = language_version - jvmTarget = "1.8" - } -} - -configurations { - dokkaPlugin - dokkaFatJar - kotlinGradle -} - -dependencies { - - testCompileOnly group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_for_gradle_runtime_version - testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlin_for_gradle_runtime_version - testCompile ideaRT() - - dokkaPlugin project(path: ':runners:gradle-plugin', configuration: 'shadow') - dokkaFatJar project(path: ":runners:fatjar", configuration: 'shadow') - - kotlinGradle "org.jetbrains.kotlin:kotlin-gradle-plugin" - - testCompile group: 'junit', name: 'junit', version: '4.12' - testCompile gradleTestKit() -} - - - -task createClasspathManifest { - def outputDir = file("$buildDir/$name") - - inputs.files(configurations.dokkaPlugin + configurations.dokkaFatJar) - outputs.dir outputDir - - doLast { - outputDir.mkdirs() - file("$outputDir/dokka-plugin-classpath.txt").text = configurations.dokkaPlugin.join("\n") - file("$outputDir/fatjar.txt").text = configurations.dokkaFatJar.join("\n") - file("$outputDir/kotlin-gradle.txt").text = configurations.kotlinGradle.join("\n") - } -} - - -createClasspathManifest.mustRunAfter project(":runners:fatjar").getTasksByName("shadowJar", true) -testClasses.dependsOn project(":runners:fatjar").shadowJar -testClasses.dependsOn createClasspathManifest - -test { - systemProperty "android.licenses.overwrite", project.findProperty("android.licenses.overwrite") ?: "" - inputs.dir(file('testData')) - exclude '*' // TODO: Remove this exclude when tests are migrated -}
\ No newline at end of file diff --git a/integration-tests/gradle-integration-tests/build.gradle.kts b/integration-tests/gradle-integration-tests/build.gradle.kts new file mode 100644 index 00000000..6a3fc690 --- /dev/null +++ b/integration-tests/gradle-integration-tests/build.gradle.kts @@ -0,0 +1,52 @@ +val dokkaPlugin by configurations.creating +val dokkaCore by configurations.creating +val kotlinGradle by configurations.creating + +dependencies { + val kotlin_version: String by project + testCompileOnly(group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version = kotlin_version) + testImplementation( + group = "org.jetbrains.kotlin", + name = "kotlin-test-junit", + version = kotlin_version + ) + testImplementation(project(":coreDependencies")) + dokkaPlugin(project(path = ":runners:gradle-plugin")) + dokkaCore(project(path = ":core", configuration = "shadow")) + + kotlinGradle("org.jetbrains.kotlin:kotlin-gradle-plugin") + + testImplementation(group = "junit", name = "junit", version = "4.13") + testImplementation(gradleTestKit()) +} + + +val createClasspathManifest by tasks.registering { + dependsOn(project(":core").getTasksByName("shadowJar", true)) + + val outputDir = file("$buildDir/$name") + inputs.files(dokkaPlugin + dokkaCore) + outputs.dir(outputDir) + + doLast { + outputDir.mkdirs() + file("$outputDir/dokka-plugin-classpath.txt").writeText(dokkaPlugin.joinToString("\n")) + file("$outputDir/fatjar.txt").writeText(dokkaCore.joinToString("\n")) + file("$outputDir/kotlin-gradle.txt").writeText(kotlinGradle.joinToString("\n")) + } +} + +val testClasses by tasks.getting + +testClasses.dependsOn(project(":core").getTasksByName("shadowJar", true)) +testClasses.dependsOn(createClasspathManifest) + +tasks { + test { + systemProperty("android.licenses.overwrite", project.findProperty("android.licenses.overwrite") ?: "") + inputs.dir(file("testData")) + exclude("*") // TODO: Remove this exclude when tests are migrated + } +} + +// TODO: see if this file makes any sense
\ No newline at end of file diff --git a/integration/build.gradle b/integration/build.gradle deleted file mode 100644 index ce25d9bf..00000000 --- a/integration/build.gradle +++ /dev/null @@ -1,25 +0,0 @@ -buildscript { - repositories { jcenter() } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -apply plugin: 'kotlin' - -sourceCompatibility = 1.8 - -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - languageVersion = language_version - apiVersion = language_version - jvmTarget = "1.8" - } -} - -dependencies { - compileOnly group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_for_gradle_runtime_version - compileOnly group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_runtime_version - implementation "com.google.code.gson:gson:$gson_version" -}
\ No newline at end of file diff --git a/plugins/build.gradle b/plugins/build.gradle deleted file mode 100644 index a0bc5ee1..00000000 --- a/plugins/build.gradle +++ /dev/null @@ -1,25 +0,0 @@ -buildscript { - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - apply plugin: 'kotlin' - - sourceCompatibility = 1.8 - - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - languageVersion = language_version - apiVersion = language_version - jvmTarget = "1.8" - } - } -} - -subprojects { - dependencies { - testCompile project(':testApi') - } -}
\ No newline at end of file diff --git a/plugins/build.gradle.kts b/plugins/build.gradle.kts new file mode 100644 index 00000000..5f2f6dcb --- /dev/null +++ b/plugins/build.gradle.kts @@ -0,0 +1,11 @@ +subprojects { + apply { + plugin("maven-publish") + } + + dependencies { + compileOnly(project(":core")) + compileOnly(kotlin("stdlib-jdk8")) + testImplementation(project(":testApi")) + } +}
\ No newline at end of file diff --git a/plugins/mathjax/build.gradle b/plugins/mathjax/build.gradle deleted file mode 100644 index 6578ff45..00000000 --- a/plugins/mathjax/build.gradle +++ /dev/null @@ -1,17 +0,0 @@ -import javax.tools.ToolProvider - -apply plugin: 'maven-publish' - -dependencies { - compileOnly project(':core') -} - -publishing { - publications { - dokkaCore(MavenPublication) { publication -> - artifactId = 'mathjax-plugin' - - from components.java - } - } -}
\ No newline at end of file diff --git a/plugins/mathjax/build.gradle.kts b/plugins/mathjax/build.gradle.kts new file mode 100644 index 00000000..0e9a16d0 --- /dev/null +++ b/plugins/mathjax/build.gradle.kts @@ -0,0 +1,8 @@ +publishing { + publications { + register<MavenPublication>("mathjaxPlugin") { + artifactId = "mathjax-plugin" + from(components["java"]) + } + } +}
\ No newline at end of file diff --git a/plugins/xml/build.gradle b/plugins/xml/build.gradle deleted file mode 100644 index ed4adb92..00000000 --- a/plugins/xml/build.gradle +++ /dev/null @@ -1,17 +0,0 @@ -import javax.tools.ToolProvider - -apply plugin: 'maven-publish' - -dependencies { - compileOnly project(':core') -} - -publishing { - publications { - dokkaCore(MavenPublication) { publication -> - artifactId = 'xml-plugin' - - from components.java - } - } -}
\ No newline at end of file diff --git a/plugins/xml/build.gradle.kts b/plugins/xml/build.gradle.kts new file mode 100644 index 00000000..cd65cfe4 --- /dev/null +++ b/plugins/xml/build.gradle.kts @@ -0,0 +1,8 @@ +publishing { + publications { + register<MavenPublication>("xmlPlugin") { + artifactId = "xml-plugin" + from(components["java"]) + } + } +}
\ No newline at end of file diff --git a/runners/build.gradle b/runners/build.gradle deleted file mode 100644 index 23d232d2..00000000 --- a/runners/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -subprojects { - buildscript { - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } - } -}
\ No newline at end of file diff --git a/runners/build.gradle.kts b/runners/build.gradle.kts new file mode 100644 index 00000000..57081149 --- /dev/null +++ b/runners/build.gradle.kts @@ -0,0 +1,6 @@ +subprojects { + apply { + plugin("maven-publish") + plugin("com.jfrog.bintray") + } +}
\ No newline at end of file diff --git a/runners/cli/build.gradle b/runners/cli/build.gradle deleted file mode 100644 index 24db0b1e..00000000 --- a/runners/cli/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -apply plugin: 'kotlin' - -sourceCompatibility = 1.8 - -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - languageVersion = language_version - apiVersion = language_version - jvmTarget = "1.8" - } -} - -dependencies { - implementation "org.jetbrains.kotlinx:kotlinx-cli-jvm:0.1.0-dev-3" - implementation project(":core") -} diff --git a/runners/cli/build.gradle.kts b/runners/cli/build.gradle.kts new file mode 100644 index 00000000..4b39d64c --- /dev/null +++ b/runners/cli/build.gradle.kts @@ -0,0 +1,37 @@ +import org.jetbrains.configureBintrayPublication + +plugins { + id("com.github.johnrengelman.shadow") +} + +repositories { + maven(url = "https://dl.bintray.com/orangy/maven") +} + +dependencies { + implementation("org.jetbrains.kotlinx:kotlinx-cli-jvm:0.1.0-dev-3") + implementation(project(":core")) +} + + +tasks { + shadowJar { + val dokka_version: String by project + archiveFileName.set("dokka-cli-$dokka_version.jar") + archiveClassifier.set("") + manifest { + attributes("Main-Class" to "org.jetbrains.dokka.MainKt") + } + } +} + +publishing { + publications { + register<MavenPublication>("dokkaCli") { + artifactId = "dokka-cli" + project.shadow.component(this) + } + } +} + +configureBintrayPublication("dokkaCli")
\ No newline at end of file diff --git a/runners/fatjar/build.gradle b/runners/fatjar/build.gradle deleted file mode 100644 index cab64c0f..00000000 --- a/runners/fatjar/build.gradle +++ /dev/null @@ -1,78 +0,0 @@ -import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer -import org.jetbrains.PluginXmlTransformer -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar - -apply plugin: 'java' -apply plugin: 'com.github.johnrengelman.shadow' - -dependencies { - compile project(":runners:cli") - compile project(":runners:ant") -} - -jar { - manifest { - attributes 'Main-Class': 'org.jetbrains.dokka.MainKt' - } -} - -shadowJar { - baseName = 'dokka-fatjar' - classifier = '' - configurations { - exclude compileOnly - } - - transform(ServiceFileTransformer) - transform(PluginXmlTransformer) - - exclude 'colorScheme/**' - exclude 'fileTemplates/**' - exclude 'inspectionDescriptions/**' - exclude 'intentionDescriptions/**' - - exclude 'src/**' - -// relocate('kotlin.reflect.full', 'kotlin.reflect') -} - -task apiShadow(type: ShadowJar) { - baseName = 'dokka-fatapi' - classifier = '' - - configurations = [project.configurations.compile] - configurations { - exclude compileOnly - } - - transform(ServiceFileTransformer) - transform(PluginXmlTransformer) - - exclude 'kotlin/**' - exclude 'colorScheme/**' - exclude 'fileTemplates/**' - exclude 'inspectionDescriptions/**' - exclude 'intentionDescriptions/**' - - exclude 'src/**' - -// relocate('kotlin.reflect.full', 'kotlin.reflect') -} - -apply plugin: 'maven-publish' - -publishing { - publications { - dokkaFatJar(MavenPublication) { publication -> - artifactId = 'dokka-fatjar' - project.shadow.component(publication) - } - - dokkaFatApi(MavenPublication) {publication -> - artifactId = 'dokka-fatapi' - publication.artifact(project.tasks.apiShadow) - } - } -} - -bintrayPublication(project, ["dokkaFatJar"])
\ No newline at end of file diff --git a/runners/gradle-plugin/build.gradle b/runners/gradle-plugin/build.gradle deleted file mode 100644 index ceb03bae..00000000 --- a/runners/gradle-plugin/build.gradle +++ /dev/null @@ -1,108 +0,0 @@ -import com.gradle.publish.DependenciesBuilder - -apply plugin: 'java' -apply plugin: 'kotlin' - - -apply plugin: 'com.github.johnrengelman.shadow' -apply plugin: "com.gradle.plugin-publish" - -sourceCompatibility = 1.8 - -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - freeCompilerArgs += "-Xjsr305=strict" - languageVersion = language_version - apiVersion = language_version - jvmTarget = "1.8" - } -} - -repositories { - jcenter() - google() -} - -dependencies { - testCompile group: 'junit', name: 'junit', version: '4.12' - - shadow group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_for_gradle_runtime_version - shadow group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_runtime_version - - compile project(":integration") - - compileOnly "org.jetbrains.kotlin:kotlin-gradle-plugin" - compileOnly("com.android.tools.build:gradle:3.0.0") - compileOnly("com.android.tools.build:gradle-core:3.0.0") - compileOnly("com.android.tools.build:builder-model:3.0.0") - compileOnly gradleApi() - compileOnly localGroovy() - implementation "com.google.code.gson:gson:$gson_version" -} - -task sourceJar(type: Jar) { - from sourceSets.main.allSource -} - -processResources { - eachFile { - if (it.name == "org.jetbrains.dokka.properties") { - it.filter { line -> - line.replace("<version>", dokka_version) - } - } - } -} - -shadowJar { - baseName = 'dokka-gradle-plugin' - classifier = '' -} - -apply plugin: 'maven-publish' - -publishing { - publications { - dokkaGradlePlugin(MavenPublication) { publication -> - artifactId = 'dokka-gradle-plugin' - - artifact sourceJar { - classifier "sources" - } - - project.shadow.component(publication) - } - } -} - -bintrayPublication(project, ['dokkaGradlePlugin']) - -configurations.archives.artifacts.clear() -artifacts { - archives shadowJar -} - -pluginBundle { - website = 'https://www.kotlinlang.org/' - vcsUrl = 'https://github.com/kotlin/dokka.git' - description = 'Dokka, the Kotlin documentation tool' - tags = ['dokka', 'kotlin', 'kdoc', 'android'] - - plugins { - dokkaGradlePlugin { - id = 'org.jetbrains.dokka' - displayName = 'Dokka plugin' - } - } - - withDependencies { List<Dependency> list -> - list.clear() - def builder = new DependenciesBuilder() - builder.addUniqueScopedDependencies(list, configurations.shadow, "compile") - } - - mavenCoordinates { - groupId = "org.jetbrains.dokka" - artifactId = "dokka-gradle-plugin" - } -}
\ No newline at end of file diff --git a/runners/gradle-plugin/build.gradle.kts b/runners/gradle-plugin/build.gradle.kts new file mode 100644 index 00000000..0d68a525 --- /dev/null +++ b/runners/gradle-plugin/build.gradle.kts @@ -0,0 +1,74 @@ +import org.jetbrains.configureBintrayPublication + +plugins { + id("com.gradle.plugin-publish") +} + +repositories { + google() +} + +dependencies { + implementation(project(":core")) + compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin") + compileOnly("com.android.tools.build:gradle:3.0.0") + compileOnly("com.android.tools.build:gradle-core:3.0.0") + compileOnly("com.android.tools.build:builder-model:3.0.0") + compileOnly(gradleApi()) + constraints { + val kotlin_version: String by project + compileOnly("org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}") { + because("kotlin-gradle-plugin and :core both depend on this") + } + } +} + +tasks { + processResources { + val dokka_version: String by project + eachFile { + if (name == "org.jetbrains.dokka.properties") { + filter { line -> + line.replace("<version>", dokka_version) + } + } + } + } +} + +val sourceJar by tasks.registering(Jar::class) { + archiveClassifier.set("sources") + from(sourceSets["main"].allSource) +} + +publishing { + publications { + register<MavenPublication>("dokkaGradlePlugin") { + artifactId = "dokka-gradle-plugin" + from(components["java"]) + artifact(sourceJar.get()) + } + } +} + +configureBintrayPublication("dokkaGradlePlugin") // TODO check if this publishes correctly + +pluginBundle { + // TODO check if this publishes correctly + website = "https://www.kotlinlang.org/" + vcsUrl = "https://github.com/kotlin/dokka.git" + description = "Dokka, the Kotlin documentation tool" + tags = listOf("dokka", "kotlin", "kdoc", "android") + + plugins { + create("dokkaGradlePlugin") { + id = "org.jetbrains.dokka" + displayName = "Dokka plugin" + } + } + + mavenCoordinates { + groupId = "org.jetbrains.dokka" + artifactId = "dokka-gradle-plugin" + } +}
\ No newline at end of file diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt index 940c496e..65b0f4b3 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt @@ -89,17 +89,9 @@ open class DokkaTask : DefaultTask() { private var outputDiagnosticInfo: Boolean = false // Workaround for Gradle, which fires some methods (like collectConfigurations()) multiple times in its lifecycle - private fun tryResolveFatJar(configuration: Configuration?): Set<File> { - return try { - configuration!!.resolve() - } catch (e: Exception) { - project.parent?.let { tryResolveFatJar(configuration) } ?: throw e - } - } - private fun loadFatJar() { if (ClassloaderContainer.fatJarClassLoader == null) { - val jars = tryResolveFatJar(dokkaRuntime).toList() + val jars = dokkaRuntime!!.resolve() ClassloaderContainer.fatJarClassLoader = URLClassLoader(jars.map { it.toURI().toURL() }.toTypedArray(), ClassLoader.getSystemClassLoader().parent) } } diff --git a/integration/src/main/kotlin/org/jetbrains/dokka/ReflectDsl.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ReflectDsl.kt index 1984a3e5..1984a3e5 100644 --- a/integration/src/main/kotlin/org/jetbrains/dokka/ReflectDsl.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/ReflectDsl.kt diff --git a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt index d75d3b21..71a02843 100644 --- a/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt +++ b/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/main.kt @@ -25,7 +25,7 @@ open class DokkaPlugin : Plugin<Project> { private fun addConfiguration(project: Project) = project.configurations.create("dokkaRuntime").apply { - defaultDependencies{ dependencies -> dependencies.add(project.dependencies.create("org.jetbrains.dokka:dokka-fatjar:${DokkaVersion.version}")) } + defaultDependencies{ dependencies -> dependencies.add(project.dependencies.create("org.jetbrains.dokka:dokka-core:${DokkaVersion.version}")) } } private fun addTasks( diff --git a/runners/maven-plugin/build.gradle b/runners/maven-plugin/build.gradle deleted file mode 100644 index 76fab68d..00000000 --- a/runners/maven-plugin/build.gradle +++ /dev/null @@ -1,161 +0,0 @@ -import groovy.io.FileType -import org.jetbrains.CorrectShadowPublishing -import org.jetbrains.CrossPlatformExec - -import java.nio.file.Files -import java.nio.file.StandardCopyOption - -apply plugin: 'kotlin' -apply plugin: 'com.github.johnrengelman.shadow' - -sourceCompatibility = 1.8 - -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - freeCompilerArgs += "-Xjsr305=strict" - languageVersion = "1.2" - apiVersion = languageVersion - jvmTarget = "1.8" - } -} - -configurations { - maven -} - -dependencies { - maven group: "org.apache.maven", name: 'apache-maven', version: maven_version, classifier: 'bin', ext: 'zip' - - shadow project(":runners:fatjar") - shadow "org.apache.maven:maven-core:$maven_version" - shadow "org.apache.maven:maven-model:$maven_version" - shadow "org.apache.maven:maven-plugin-api:$maven_version" - shadow "org.apache.maven:maven-archiver:$maven_archiver_version" - shadow "org.codehaus.plexus:plexus-utils:$plexus_utils_version" - shadow "org.codehaus.plexus:plexus-archiver:$plexus_archiver_version" - shadow "org.apache.maven.plugin-tools:maven-plugin-annotations:$maven_plugin_tools_version" - shadow "com.github.olivergondza:maven-jdk-tools-wrapper:0.1" -} - -final File mavenHome = new File(buildDir, "maven-bin") -final File mvn = new File(mavenHome, "apache-maven-$maven_version/bin/mvn") - -tasks.clean.doLast { - delete mavenHome -} - -task setupMaven(type: Sync) { - from configurations.maven.collect{ zipTree(it) } - 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(mavenBuildDir, "pom.xml")) - doLast { - final pomTemplate = new File(projectDir, "pom.tpl.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 syncKotlinClasses(type: Sync, dependsOn: compileKotlin) { - from "$buildDir/classes/kotlin" - into "$mavenBuildDir/classes/java" - - preserve { - include '**/*.class' - } -} - -task syncJavaClasses(type: Sync, dependsOn: compileJava) { - from "$buildDir/classes/java" - into "$mavenBuildDir/classes/java" - - preserve { - include '**/*.class' - } -} - -task helpMojo(type: CrossPlatformExec, dependsOn: setupMaven) { - workingDir mavenBuildDir - commandLine mvn, '-e', '-B', 'org.apache.maven.plugins:maven-plugin-plugin:helpmojo' - - 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/maven/generated-sources/plugin") -compileJava.dependsOn helpMojo -processResources.dependsOn pluginDescriptor - -pluginDescriptor.dependsOn generatePom - -shadowJar { - baseName = 'dokka-maven-plugin' - classifier = '' -} - -shadowJar.dependsOn pluginDescriptor - - -task sourceJar(type: Jar) { - from sourceSets.main.allSource -} - -apply plugin: 'maven-publish' - -publishing { - publications { - dokkaMavenPlugin(MavenPublication) { MavenPublication publication -> - artifactId = 'dokka-maven-plugin' - - artifact sourceJar { - classifier "sources" - } - - CorrectShadowPublishing.configure(publication, project) - } - } -} - -bintrayPublication(project, ['dokkaMavenPlugin']) diff --git a/runners/maven-plugin/build.gradle.kts b/runners/maven-plugin/build.gradle.kts new file mode 100644 index 00000000..2dffd71c --- /dev/null +++ b/runners/maven-plugin/build.gradle.kts @@ -0,0 +1,115 @@ +import org.jetbrains.configureBintrayPublication + +/** + * [mavenBin] configuration is used to download Maven Plugin Plugin + * for generating plugin-help.xml and plugin.xml files + */ +val mavenBin: Configuration by configurations.creating + +val maven_version: String by project + +dependencies { + implementation(project(":core")) + implementation("org.apache.maven:maven-core:$maven_version") + implementation("org.apache.maven:maven-plugin-api:$maven_version") + val maven_plugin_tools_version: String by project + implementation("org.apache.maven.plugin-tools:maven-plugin-annotations:$maven_plugin_tools_version") + val maven_archiver_version: String by project + implementation("org.apache.maven:maven-archiver:$maven_archiver_version") + + mavenBin(group = "org.apache.maven", name = "apache-maven", version = maven_version, classifier = "bin", ext = "zip") + compileOnly(kotlin("stdlib-jdk8")) +} + +val mavenBinDir = "$buildDir/maven-bin" +val mavenBuildDir = "$buildDir/maven" +val mvn = File(mavenBinDir, "apache-maven-$maven_version/bin/mvn") + +tasks.named<Delete>("clean") { + delete(mavenBinDir) +} + +/** + * Copy Maven Plugin Plugin to [mavenBinDir] directory + */ +val setupMaven by tasks.registering(Sync::class) { + from(mavenBin.map { zipTree(it) }) + into(mavenBinDir) +} + +/** + * Generate pom.xml for Maven Plugin Plugin + */ +val generatePom by tasks.registering(Copy::class) { + val dokka_version: String by project + val maven_plugin_tools_version: String by project + + from("$projectDir/pom.tpl.xml") { + rename("(.*).tpl.xml", "$1.xml") + } + into(mavenBuildDir) + + eachFile { + filter { line -> + line.replace("<maven.version></maven.version>", "<maven.version>$maven_version</maven.version>") + } + filter { line -> + line.replace("<version>dokka_version</version>", "<version>$dokka_version</version>") + } + filter { line -> + line.replace("<version>maven-plugin-plugin</version>", "<version>$maven_plugin_tools_version</version>") + } + } +} + +/** + * Copy compiled classes to [mavenBuildDir] for Maven Plugin Plugin + */ +val syncClasses by tasks.registering(Sync::class) { + dependsOn(tasks.compileKotlin, tasks.compileJava) + from("$buildDir/classes/kotlin", "$buildDir/classes/java") + into("$mavenBuildDir/classes/java") + + preserve { + include("**/*.class") + } +} + +val helpMojo by tasks.registering(org.jetbrains.CrossPlatformExec::class) { + dependsOn(setupMaven, generatePom, syncClasses) + workingDir(mavenBuildDir) + commandLine(mvn, "-e", "-B", "org.apache.maven.plugins:maven-plugin-plugin:helpmojo") +} + +val pluginDescriptor by tasks.registering(org.jetbrains.CrossPlatformExec::class) { + dependsOn(setupMaven, generatePom, syncClasses) + workingDir(mavenBuildDir) + commandLine(mvn, "-e", "-B", "org.apache.maven.plugins:maven-plugin-plugin:descriptor") +} + +val sourceJar by tasks.registering(Jar::class) { + archiveClassifier.set("sources") + from(sourceSets["main"].allSource) +} + +tasks.named<Jar>("jar") { + dependsOn(pluginDescriptor, helpMojo) + metaInf { + from("$mavenBuildDir/classes/java/main/META-INF") + } + manifest { + attributes("Class-Path" to configurations.runtimeClasspath.get().files.joinToString(" ") { it.name }) + } +} + +publishing { + publications { + register<MavenPublication>("dokkaMavenPlugin") { + artifactId = "dokka-maven-plugin" + from(components["java"]) + artifact(sourceJar.get()) + } + } +} + +configureBintrayPublication("dokkaMavenPlugin") diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index fb11ecac..67188325 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -189,7 +189,8 @@ abstract class AbstractDokkaMojo : AbstractMojo() { impliedPlatforms = impliedPlatforms, cacheRoot = cacheRoot, passesConfigurations = listOf(passConfiguration), - generateIndexPages = generateIndexPages + generateIndexPages = generateIndexPages, + pluginsClasspath = emptyList() //TODO fix this ) val gen = DokkaGenerator(configuration, MavenDokkaLogger(log)) diff --git a/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt b/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt index a535c807..950af3e0 100644 --- a/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt +++ b/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt @@ -1,17 +1,21 @@ package org.jetbrains.dokka.maven import org.apache.maven.plugin.logging.Log -import org.jetbrains.dokka.DokkaLogger +import org.jetbrains.dokka.utilities.DokkaLogger class MavenDokkaLogger(val log: Log) : DokkaLogger { override fun error(message: String) { log.error(message) } + override fun debug(message: String) = log.debug(message) + override fun info(message: String) { log.info(message) } + override fun progress(message: String) = log.info(message) + override fun warn(message: String) { log.warn(message) } diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 323af4b9..00000000 --- a/settings.gradle +++ /dev/null @@ -1,16 +0,0 @@ -rootProject.name = "dokka" - -include 'core', -// 'core:testApi', - 'coreDependencies', - 'integration', - 'runners:gradle-integration-tests', - 'runners:fatjar', - 'runners:ant', - 'runners:cli', -// 'runners:maven-plugin', - 'runners:gradle-plugin', -// 'plugins:javadoc8' - 'plugins:mathjax', - 'plugins:xml', - 'testApi' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..364a96ad --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,29 @@ +rootProject.name = "dokka" + +include("core") +include("coreDependencies") +include("testApi") +include("runners:gradle-plugin") +include("runners:cli") +include("runners:maven-plugin") +include("plugins:xml") +include("plugins:mathjax") +//include("integration-tests:gradle-integration-tests") + + +pluginManagement { + val kotlin_version: String by settings + plugins { + id("org.jetbrains.kotlin.jvm") version kotlin_version + id("com.github.johnrengelman.shadow") version "5.2.0" + id("com.jfrog.bintray") version "1.8.4" + id("com.gradle.plugin-publish") version "0.10.1" + } + + repositories { + mavenLocal() + mavenCentral() + jcenter() + gradlePluginPortal() + } +}
\ No newline at end of file diff --git a/testApi/build.gradle b/testApi/build.gradle deleted file mode 100644 index 5425b7bc..00000000 --- a/testApi/build.gradle +++ /dev/null @@ -1,12 +0,0 @@ -buildscript { - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} -apply plugin: 'kotlin' - -dependencies { - implementation project(':core') - implementation group: 'junit', name: 'junit', version: '4.12' - implementation group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlin_version -}
\ No newline at end of file diff --git a/testApi/build.gradle.kts b/testApi/build.gradle.kts new file mode 100644 index 00000000..db861b90 --- /dev/null +++ b/testApi/build.gradle.kts @@ -0,0 +1,29 @@ +import org.jetbrains.configureBintrayPublication + +plugins { + `maven-publish` + id("com.jfrog.bintray") +} + +dependencies { + implementation(project(":core")) + implementation("junit:junit:4.13") // TODO: remove dependency to junit + implementation(kotlin("stdlib")) +} + +val sourceJar by tasks.registering(Jar::class) { + archiveClassifier.set("sources") + from(sourceSets["main"].allSource) +} + +publishing { + publications { + register<MavenPublication>("dokkaTestAPI") { + artifactId = "dokka-test-api" + components["java"] + artifact(sourceJar.get()) + } + } +} + +configureBintrayPublication("dokkaTestAPI")
\ No newline at end of file |