Skip to content

Commit

Permalink
Dokka
Browse files Browse the repository at this point in the history
  • Loading branch information
motorro committed Sep 15, 2022
1 parent c203f36 commit af121f0
Show file tree
Hide file tree
Showing 485 changed files with 23,785 additions and 119 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ out/
build/
testaction/output/

# Logs
*.log

# Node.js
node_modules/
kotlin-js-store/
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# KeepLink
Kotlin multiplatform deep-link management
44 changes: 43 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
@file:Suppress("EXPERIMENTAL_API_USAGE", "DSL_SCOPE_VIOLATION")

import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
alias(libs.plugins.kotlin.multiplatform) apply(false)
alias(libs.plugins.kotlin.serialization) apply(false)
alias(libs.plugins.kotlin.dokka) apply(false)
alias(libs.plugins.kotlin.dokka)
alias(libs.plugins.nexus.publish)
alias(libs.plugins.git)
}
Expand Down Expand Up @@ -53,6 +56,33 @@ allprojects {
}
}

subprojects {
tasks {
withType<DokkaTask>().configureEach {
suppressInheritedMembers.set(true)
dokkaSourceSets.configureEach {
includeNonPublic.set(false)
skipEmptyPackages.set(true)
if (platform.get() == Platform.native) {
displayName.set("native")
}
includes.from("moduledoc.md")
}
}
withType<DokkaTaskPartial>().configureEach {
suppressInheritedMembers.set(true)
dokkaSourceSets.configureEach {
includeNonPublic.set(false)
skipEmptyPackages.set(true)
if (platform.get() == Platform.native) {
displayName.set("native")
}
includes.from("moduledoc.md")
}
}
}
}

val displayVersion by tasks.creating(Jar::class) {
group = "documentation"
description = "Display application version name"
Expand All @@ -72,3 +102,15 @@ nexusPublishing {
}
}
}

val docDir = projectDir.resolve("doc")
tasks {
dokkaHtmlMultiModule {
outputDirectory.set(docDir.resolve("html"))
includes.from("README.md")
}
dokkaGfmMultiModule {
outputDirectory.set(docDir.resolve("gfm"))
includes.from("README.md")
}
}
25 changes: 0 additions & 25 deletions deeplink/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
@file:Suppress("UNUSED_VARIABLE", "EXPERIMENTAL_API_USAGE")

import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.gradle.DokkaTask
import java.net.URI
import java.time.Duration

plugins {
id("org.jetbrains.kotlin.multiplatform")
Expand Down Expand Up @@ -110,28 +107,6 @@ kotlin {
}
}

tasks.withType<DokkaTask>().configureEach {
val output = rootProject.rootDir.resolve("doc").resolve(name)

outputDirectory.set(output)
doFirst {
delete(output)
}

setProperty("timeout", Duration.ofMinutes(3))

dokkaSourceSets {
configureEach {
includes.from(rootProject.file("moduledoc.md").path)
includeNonPublic.set(false)
skipEmptyPackages.set(false)
if (platform.get() == Platform.native) {
displayName.set("native")
}
}
}
}

val libId = "deeplink"
val libName = "deeplink"
val libDesc = "Multiplatform deep-link operations"
Expand Down
7 changes: 7 additions & 0 deletions deeplink/moduledoc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Module deeplink

Build a typesafe deep-link hierarchy with sealed classes

# Package com.motorro.keeplink.deeplink

Contains tools to build deep-link actions and some useful action parsers
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[ActionParser](index.md)

# ActionParser

[common]\
fun interface [ActionParser](index.md)&lt;out [A](index.md) : [Action](../-action/index.md)&gt;

Parses action from action components

## Functions

| Name | Summary |
|---|---|
| [parse](parse.md) | [common]<br>abstract fun [parse](parse.md)(components: [PshComponents](../../../../uri/uri/com.motorro.keeplink.uri.data/-psh-components/index.md), pathIndex: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)): [A](index.md)?<br>Tries to parse given path |

## Inheritors

| Name |
|---|
| [BranchActionParser](../-branch-action-parser/index.md) |
| [DefaultActionParser](../-default-action-parser/index.md) |
| [SegmentCheckParser](../-segment-check-parser/index.md) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[ActionParser](index.md)/[parse](parse.md)

# parse

[common]\
abstract fun [parse](parse.md)(components: [PshComponents](../../../../uri/uri/com.motorro.keeplink.uri.data/-psh-components/index.md), pathIndex: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)): [A](index.md)?

Tries to parse given path

## Parameters

common

| | |
|---|---|
| components | Source action components |
| pathIndex | Path index to start parsing at |
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[Action](index.md)/[Action](-action.md)

# Action

[common]\
fun [Action](-action.md)()
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[Action](index.md)/[getHash](get-hash.md)

# getHash

[common]\
open override fun [getHash](get-hash.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)

Hash component - what to display. Represents extra action to do in activity.

For example, you may instruct your document activity to scroll to specified anchor:

`/open/settings#background_location`
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[Action](index.md)/[getPath](get-path.md)

# getPath

[common]\
open override fun [getPath](get-path.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)&lt;[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)&gt;

Path component - where to go. Represents a path to activity in an application: screen, action, etc. Parameters exactly identifying the activity may be represented as path.

For example, the following link opens chat with ID 123:

`/open/chat/123`
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[Action](index.md)/[getSearch](get-search.md)

# getSearch

[common]\
open override fun [getSearch](get-search.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)&lt;[Param](../../../../uri/uri/com.motorro.keeplink.uri.data/-param/index.md)&gt;

Search component - what to do. Represents parameters to activity specified by [getPath](get-path.md) which instruct activity what to do.

For example, the following link opens search activity and instructs it to search with specific parameters:

`/open/search?type=TRAIN&from=MOSCOW&to=PARIS&date=2021-01-28`
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[Action](index.md)

# Action

[common]\
abstract class [Action](index.md) : [PshComponents](../../../../uri/uri/com.motorro.keeplink.uri.data/-psh-components/index.md)

Deep link action marker class.

Represents an action part of deep-link - what needs to be done by application. Extend with a sealed class

For example:

-
To open some application page
-
To run data update

## Constructors

| | |
|---|---|
| [Action](-action.md) | [common]<br>fun [Action](-action.md)() |

## Functions

| Name | Summary |
|---|---|
| [getHash](get-hash.md) | [common]<br>open override fun [getHash](get-hash.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)<br>Hash component - what to display. Represents extra action to do in activity. |
| [getPath](get-path.md) | [common]<br>open override fun [getPath](get-path.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)&lt;[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)&gt;<br>Path component - where to go. Represents a path to activity in an application: screen, action, etc. Parameters exactly identifying the activity may be represented as path. |
| [getSearch](get-search.md) | [common]<br>open override fun [getSearch](get-search.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)&lt;[Param](../../../../uri/uri/com.motorro.keeplink.uri.data/-param/index.md)&gt;<br>Search component - what to do. Represents parameters to activity specified by [getPath](get-path.md) which instruct activity what to do. |

## Properties

| Name | Summary |
|---|---|
| [isValid](is-valid.md) | [common]<br>open val [isValid](is-valid.md): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) = true<br>True if action is valid to execute |
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[Action](index.md)/[isValid](is-valid.md)

# isValid

[common]\
open val [isValid](is-valid.md): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) = true

True if action is valid to execute
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[BranchActionParser](index.md)/[BranchActionParser](-branch-action-parser.md)

# BranchActionParser

[common]\
fun &lt;[A](index.md) : [Action](../-action/index.md)&gt; [BranchActionParser](-branch-action-parser.md)(vararg children: [ActionParser](../-action-parser/index.md)&lt;[A](index.md)&gt;)

Constructor with no default action

## Parameters

common

| | |
|---|---|
| children | Children to pass parsing. First non-null result is used as a return value from [parse](parse.md) |

[common]\
fun &lt;[A](index.md) : [Action](../-action/index.md)&gt; [BranchActionParser](-branch-action-parser.md)(children: [Iterable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterable/index.html)&lt;[ActionParser](../-action-parser/index.md)&lt;[A](index.md)&gt;&gt;, default: [ActionParser](../-action-parser/index.md)&lt;[A](index.md)&gt;)

## Parameters

common

| | |
|---|---|
| children | Children to pass parsing. First non-null result is used as a return value from [parse](parse.md) |
| default | Called when no child parser matches given components |
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[BranchActionParser](index.md)

# BranchActionParser

[common]\
open class [BranchActionParser](index.md)&lt;[A](index.md) : [Action](../-action/index.md)&gt;(children: [Iterable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterable/index.html)&lt;[ActionParser](../-action-parser/index.md)&lt;[A](index.md)&gt;&gt;, default: [ActionParser](../-action-parser/index.md)&lt;[A](index.md)&gt;) : [ActionParser](../-action-parser/index.md)&lt;[A](index.md)&gt;

Parser to parse path branch

## Parameters

common

| | |
|---|---|
| children | Children to pass parsing. First non-null result is used as a return value from [parse](parse.md) |
| default | Called when no child parser matches given components |

## Constructors

| | |
|---|---|
| [BranchActionParser](-branch-action-parser.md) | [common]<br>fun &lt;[A](index.md) : [Action](../-action/index.md)&gt; [BranchActionParser](-branch-action-parser.md)(vararg children: [ActionParser](../-action-parser/index.md)&lt;[A](index.md)&gt;)<br>Constructor with no default action |
| [BranchActionParser](-branch-action-parser.md) | [common]<br>fun &lt;[A](index.md) : [Action](../-action/index.md)&gt; [BranchActionParser](-branch-action-parser.md)(children: [Iterable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterable/index.html)&lt;[ActionParser](../-action-parser/index.md)&lt;[A](index.md)&gt;&gt;, default: [ActionParser](../-action-parser/index.md)&lt;[A](index.md)&gt;) |

## Functions

| Name | Summary |
|---|---|
| [parse](parse.md) | [common]<br>open override fun [parse](parse.md)(components: [PshComponents](../../../../uri/uri/com.motorro.keeplink.uri.data/-psh-components/index.md), pathIndex: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)): [A](index.md)?<br>Handles parsing to registered children Parser increments [pathIndex](parse.md) for children as it counts current index as its own |
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[BranchActionParser](index.md)/[parse](parse.md)

# parse

[common]\
open override fun [parse](parse.md)(components: [PshComponents](../../../../uri/uri/com.motorro.keeplink.uri.data/-psh-components/index.md), pathIndex: [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)): [A](index.md)?

Handles parsing to registered children Parser increments [pathIndex](parse.md) for children as it counts current index as its own

## Parameters

common

| | |
|---|---|
| components | Source action components |
| pathIndex | Path index to start parsing at |
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[DeepLinkSerializer](index.md)/[DeepLinkSerializer](-deep-link-serializer.md)

# DeepLinkSerializer

[common]\
fun &lt;[A](index.md) : [Action](../-action/index.md)&gt; [DeepLinkSerializer](-deep-link-serializer.md)(builder: [LinkBuilder](../-link-builder/index.md)&lt;[A](index.md)&gt;, parser: [LinkParser](../-link-parser/index.md)&lt;[A](index.md)&gt;)

## Parameters

common

| | |
|---|---|
| builder | Link builder |
| parser | Link parser |
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[DeepLinkSerializer](index.md)/[descriptor](descriptor.md)

# descriptor

[common]\
open override val [descriptor](descriptor.md): SerialDescriptor

Descriptor
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//[deeplink](../../../index.md)/[com.motorro.keeplink.deeplink](../index.md)/[DeepLinkSerializer](index.md)/[deserialize](deserialize.md)

# deserialize

[common]\
open override fun [deserialize](deserialize.md)(decoder: Decoder): [DeepLink](../-deep-link/index.md)&lt;[A](index.md)&gt;

Deserializes from components and parses using internal parser
Loading

0 comments on commit af121f0

Please sign in to comment.