1import com.gradle.publish.DependenciesBuilder 2 3apply plugin: 'java' 4apply plugin: 'kotlin' 5 6 7apply plugin: 'com.github.johnrengelman.shadow' 8apply plugin: "com.gradle.plugin-publish" 9 10sourceCompatibility = 1.8 11 12tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { 13 kotlinOptions { 14 freeCompilerArgs += "-Xjsr305=strict" 15 languageVersion = "1.2" 16 apiVersion = "1.1" 17 jvmTarget = "1.8" 18 } 19} 20 21dependencies { 22 testCompile group: 'junit', name: 'junit', version: '4.12' 23 24 shadow group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_for_gradle_runtime_version 25 shadow group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlin_for_gradle_runtime_version 26 27 compile project(":integration") 28 29 compileOnly gradleApi() 30 compileOnly localGroovy() 31} 32 33task sourceJar(type: Jar) { 34 from sourceSets.main.allSource 35} 36 37processResources { 38 inputs.property("dokka_version", dokka_version) 39 eachFile { 40 if (it.name == "org.jetbrains.dokka.properties") { 41 it.filter { line -> 42 line.replace("<version>", dokka_version) 43 } 44 } 45 } 46} 47 48shadowJar { 49 baseName = 'dokka-gradle-plugin' 50 classifier = '' 51} 52 53apply plugin: 'maven-publish' 54 55publishing { 56 publications { 57 dokkaGradlePlugin(MavenPublication) { publication -> 58 59 artifactId = 'dokka-gradle-plugin' 60 61 artifact sourceJar { 62 classifier "sources" 63 } 64 65 project.shadow.component(publication) 66 publication.pom { pom -> 67 // Add dokka-fatjar as a runtime dependency. 68 // This is a workaround until the Shadow jar can put project dependencies into the .pom: https://github.com/johnrengelman/shadow/commit/da82b37522b349aff414f571d2037682acd84f27 69 pom.withXml { xml -> 70 def node = xml.asNode() 71 def deps = null 72 node.children().each { child -> 73 if (child.name().toString() == "dependencies") { 74 deps = child 75 } 76 } 77 if (deps == null) { 78 deps = node.appendNode("dependencies") 79 } 80 def dep = deps.appendNode("dependency") 81 dep.appendNode("groupId", "org.jetbrains.dokka") 82 dep.appendNode("artifactId", "dokka-fatjar") 83 dep.appendNode("version", dokka_version) 84 dep.appendNode("scope", "runtime") 85 } 86 } 87 } 88 } 89} 90 91bintrayPublication(project, ['dokkaGradlePlugin']) 92 93configurations.archives.artifacts.clear() 94artifacts { 95 archives shadowJar 96} 97 98pluginBundle { 99 website = 'http://www.kotlinlang.org/' 100 vcsUrl = 'https://github.com/kotlin/dokka.git' 101 description = 'Dokka, the Kotlin documentation tool' 102 tags = ['dokka', 'kotlin', 'kdoc'] 103 104 plugins { 105 dokkaGradlePlugin { 106 id = 'org.jetbrains.dokka' 107 displayName = 'Dokka plugin' 108 } 109 } 110 111 withDependencies { List<Dependency> list -> 112 list.clear() 113 def builder = new DependenciesBuilder() 114 builder.addUniqueScopedDependencies(list, configurations.shadow, "compile") 115 } 116 117 mavenCoordinates { 118 groupId = "org.jetbrains.dokka" 119 artifactId = "dokka-gradle-plugin" 120 } 121} 122