Skip to content

Commit

Permalink
update dokka.
Browse files Browse the repository at this point in the history
remove comment out.
  • Loading branch information
wasnot committed Feb 26, 2021
1 parent 1dd0a6c commit 4872c13
Show file tree
Hide file tree
Showing 15 changed files with 137 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- run:
name: Doc check
command: |
./gradlew clean dokka # | grep 'No documentation' && { echo 'kdoc validation failed' ; exit 1; }
./gradlew dokkaHtml
- run:
name: CodeCov
command: |
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<a href="https://karte.io"><img src="https://karte.io/assets/images/common/logo_black.svg" width="270" height="80"></img></a>

[![CircleCI](https://circleci.com/gh/plaidev/karte-android-dev/tree/develop.svg?style=shield&circle-token=457a44e0e78580b5e8fff6047b938959148cabf7)](https://circleci.com/gh/plaidev/karte-android-dev/tree/develop)
[![CircleCI](https://circleci.com/gh/plaidev/karte-android-dev/tree/develop.svg?style=shield&circle-token=457a44e0e78580b5e8fff6047b938959148cabf7&a=.svg)](https://circleci.com/gh/plaidev/karte-android-dev/tree/develop)
[![codecov](https://codecov.io/gh/plaidev/karte-android-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/plaidev/karte-android-sdk)
[![License](https://img.shields.io/badge/license-Apache%202-blue)](https://github.com/plaidev/karte-android-sdk/blob/master/LICENSE)
[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://github.com/plaidev/karte-android-sdk/blob/master/LICENSE)

KARTE is a real-time user analytics & action tool.
This repository holds the source code for the Android version of KARTE SDK.
Expand Down
28 changes: 5 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,31 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.android.tools.build:gradle:3.6.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.20"

// for upload maven repo
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.22.0"

// for apply karte plugin to example project
classpath 'io.karte.android:karte-gradle-plugin'
}
}

plugins {
id 'org.jetbrains.dokka' version '0.10.1'
id 'com.jfrog.bintray' version '1.8.5'
id 'maven-publish'
id 'io.codearte.nexus-staging' version '0.22.0'
}

allprojects {
repositories {
google()
jcenter()
}
}

configure(subprojects.findAll { !it.name.startsWith("sample_") }) {
println "configure libraries: ${project.name}"

apply from: '../buildscripts/projectDokka.gradle'
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
outputFormat = 'javadoc'
outputDirectory = "$buildDir/javadoc"
}

task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
classifier = 'javadoc'
from "$buildDir/javadoc"
}

apply from: '../buildscripts/projectJacoco.gradle'

apply from: '../buildscripts/projectMaven.gradle'
Expand All @@ -62,9 +48,5 @@ task clean(type: Delete) {
apply from: 'buildscripts/ktlint.gradle'
apply from: 'buildscripts/dokka.gradle'
apply from: 'buildscripts/jacoco.gradle'
apply from: 'buildscripts/sonatype.gradle'

nexusStaging {
packageGroup ='io.karte.android'
username = ossrhUsername
password = ossrhPassword
}
17 changes: 8 additions & 9 deletions buildscripts/dokka.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
dokka {
tasks.dokka.logging.captureStandardOutput LogLevel.LIFECYCLE
subProjects = ["core", "inappmessaging", "notifications", "variables", "visualtracking"]
outputDirectory = "${buildDir}/dokka"
outputFormat = "html"
configuration {
reportUndocumented = true
}
import org.apache.tools.ant.filters.ReplaceTokens

task dokkaModuleMd(type: Copy, group: 'documentation') {
from 'buildscripts/dokka/Module.md'
into 'build/dokka'
filter(ReplaceTokens, tokens: [README: file("$rootDir/README.md").readLines('UTF-8').drop(2).join("\n")])
filteringCharset = 'UTF-8'
}

task generateDocs(type: Exec, group: 'documentation') {
subprojects.findAll { it.tasks.findByPath('dokka') }.each { dependsOn("${it.name}:dokka") }
subprojects.findAll { it.tasks.findByPath('dokka') }.each { dependsOn("${it.name}:dokkaHtml") }
commandLine "ruby", "scripts/publish_docs.rb"
standardOutput = new ByteArrayOutputStream()
ext.output = {
Expand Down
19 changes: 19 additions & 0 deletions buildscripts/dokka/Module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Module core

@README@

# Module inappmessaging

@README@

# Module notifications

@README@

# Module variables

@README@

# Module visualtracking

@README@
4 changes: 4 additions & 0 deletions buildscripts/dokka/custom-style-to-add.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
p.paragraph img {
display: inline;
margin-right: 5px;
}
17 changes: 17 additions & 0 deletions buildscripts/dokka/logo-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions buildscripts/dokka/logo-styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#logo {
background-image: url('https://karte.io/assets/images/common/logo_black.svg');
}
58 changes: 47 additions & 11 deletions buildscripts/projectDokka.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,54 @@
apply plugin: 'org.jetbrains.dokka'

dokka {
Set<ProjectDependency> deps =
project.configurations.collectMany {
it.allDependencies
}.findAll {
it instanceof ProjectDependency
}
task javadocJar(type: Jar, dependsOn: 'dokkaJavadoc', group: 'documentation') {
classifier = 'javadoc'
from "$buildDir/dokka/javadoc"
}

configuration {
deps.collect { p ->
sourceRoot {
path = "${p.getDependencyProject().projectDir.toString()}/src/main/java"
afterEvaluate {
dokkaHtml {
// failOnWarning.set(true)
dokkaSourceSets {
named("main") {
includeNonPublic.set(false)
skipDeprecated.set(false)
reportUndocumented.set(true)
skipEmptyPackages.set(true)
includes.from("$rootDir/build/dokka/Module.md")
externalDocumentationLink {
url.set(new URL("https://plaidev.github.io/karte-sdk-docs/android/core/latest/core/"))
packageListUrl.set(new URL("https://plaidev.github.io/karte-sdk-docs/android/core/latest/core/package-list"))
}
}
}
def dir = "$rootDir/buildscripts/dokka"
def configJson = """
{
"customStyleSheets":["${file("$dir/logo-styles.css")}","${file("$dir/custom-style-to-add.css")}"],
"customAssets":["${file("$dir/logo-icon.svg")}"]
}""".stripIndent().trim()
pluginsMapConfiguration.set(["org.jetbrains.dokka.base.DokkaBase": configJson])
}
dokkaHtml.dependsOn rootProject.dokkaModuleMd

dokkaHtml.doLast {
file("$buildDir/dokka/html/index.html").write(
"""
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0; url=$project.name/index.html">
<script type="text/javascript">
window.location.href = "$project.name/index.html"
</script>
<title>Documentation</title>
</head>
<body>
If you are not redirected automatically, follow <a href="$project.name/index.html">this link</a>.
</body>
</html>
""".stripIndent().trim()
)
}
}
2 changes: 1 addition & 1 deletion buildscripts/projectMavenAndroid.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ task sourcesJar(type: Jar) {
project.ext {
makePublication = { maven ->
maven.artifact sourcesJar
// maven.artifact javadocJar
maven.artifact javadocJar
maven.artifact source: file("${project.buildDir}/outputs/aar/${project.name}-release.aar")

maven.versionMapping {
Expand Down
15 changes: 11 additions & 4 deletions buildscripts/projectSonatype.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
apply plugin: 'maven'
apply plugin: 'signing'

def getPropOrDefault(name, defaultValue = "") {
if (project.ext.has(name))
return project.ext.get(name)
return defaultValue
}

artifacts {
archives sourcesJar
// archives javadocJar, sourcesJar
archives javadocJar, sourcesJar
}
signing {
sign configurations.archives
Expand All @@ -13,13 +18,15 @@ uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
def username = getPropOrDefault("ossrhUsername")
def password = getPropOrDefault("ossrhPassword")

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
authentication(userName: username, password: password)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
authentication(userName: username, password: password)
}
project.makeDeployerPom(pom)
}
Expand Down
13 changes: 13 additions & 0 deletions buildscripts/sonatype.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apply plugin: 'io.codearte.nexus-staging'

def getPropOrDefault(name, defaultValue = "") {
if (project.ext.has(name))
return project.ext.get(name)
return defaultValue
}

nexusStaging {
packageGroup = 'io.karte.android'
username = getPropOrDefault("ossrhUsername")
password = getPropOrDefault("ossrhPassword")
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Nov 21 16:47:40 JST 2019
#Tue Feb 23 07:12:38 JST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
6 changes: 3 additions & 3 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ function publish() {
local TARGET=`echo $MODULE | sed -e "s/\/version//"`
if [ $TARGET = "gradle-plugin" ]; then
./gradlew -p gradle-plugin/ bintrayUpload
# ./gradlew -p gradle-plugin/ uploadArchives
./gradlew -p gradle-plugin/ uploadArchives
else
./gradlew $TARGET:assembleRelease
./gradlew $TARGET:bintrayUpload
# ./gradlew $TARGET:uploadArchives
./gradlew $TARGET:uploadArchives
fi
done
# ./gradlew closeAndReleaseRepository
./gradlew closeAndReleaseRepository
}

##################################################
Expand Down
2 changes: 1 addition & 1 deletion scripts/publish_docs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _get_latest_document_version
end

def _get_generated_docs_dir
File.join(@module_name, "build", "dokka", @module_name)
File.join(@module_name, "build", "dokka", "html")
end

def _get_latest_dir
Expand Down

0 comments on commit 4872c13

Please sign in to comment.