diff --git a/app/build.gradle b/app/build.gradle index 6245a35..cc01918 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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 @@ -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" @@ -32,3 +40,4 @@ dependencies { androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' } +apply from: './publish.gradle' \ No newline at end of file diff --git a/app/publish.gradle b/app/publish.gradle index d189a52..822c6b5 100644 --- a/app/publish.gradle +++ b/app/publish.gradle @@ -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() { @@ -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 diff --git a/build.gradle b/build.gradle index 12bf763..862609d 100644 --- a/build.gradle +++ b/build.gradle @@ -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()