Skip to content

Commit

Permalink
Add dokka to generate kotlin doc
Browse files Browse the repository at this point in the history
  • Loading branch information
xwh3238557 committed Jun 27, 2019
1 parent 9eaf3bc commit 1f584ff
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
13 changes: 11 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

apply from: './publish.gradle'
apply plugin: 'org.jetbrains.dokka'

android {
compileSdkVersion 28
Expand All @@ -21,6 +20,15 @@ android {
}
}

ext {
dokkaOutputDir = "$buildDir/javaDoc/"
}

dokka {
outputFormat = 'javadoc'
outputDirectory = dokkaOutputDir
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
Expand All @@ -32,3 +40,4 @@ dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

apply from: './publish.gradle'
18 changes: 16 additions & 2 deletions app/publish.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

version project.android.defaultConfig.versionName
version String.valueOf(project.android.defaultConfig.versionName)
group 'cn.wenhao.xia'

Properties localProperties() {
Expand All @@ -11,10 +11,24 @@ Properties localProperties() {
return localProperties
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javaDocJar(type: Jar, dependsOn: dokka) {
from dokkaOutputDir
classifier = 'javaDoc'
}

publishing {
publications {
Production(MavenPublication) {
artifact "$buildDir/outputs/aar/app-release.aar"
artifacts {
"$buildDir/outputs/aar/app-release.aar"
archives javaDocJar
archives sourcesJar
}
groupId
artifactId 'safearea'
version this.version
Expand Down
13 changes: 9 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.40'

repositories {
google()
jcenter()
}


dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
}
}

plugins {
id 'org.jetbrains.dokka' version '0.9.18' apply false
id 'com.jfrog.bintray' version '1.8.4' apply false
}


allprojects {
repositories {
google()
Expand Down

0 comments on commit 1f584ff

Please sign in to comment.