Skip to content

Commit 541c054

Browse files
Merge pull request #232 from square/zachklipp/fix-kdoc
Fixed broken kdoc links and some other warnings.
2 parents a794347 + d718aa1 commit 541c054

File tree

10 files changed

+58
-34
lines changed

10 files changed

+58
-34
lines changed

kotlin/build.gradle

+7
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ buildscript {
7474
'mockito': "com.nhaarman:mockito-kotlin-kt1.1:${versions.mockitoKotlin}"
7575
]
7676
],
77+
'dokkaAndroid': "org.jetbrains.dokka:dokka-android-gradle-plugin:${versions.dokka}",
7778
'dokka': "org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokka}",
7879
'mavenPublish': "com.vanniktech:gradle-maven-publish-plugin:${versions.mavenPublishPlugin}",
7980
'ktlint': "gradle.plugin.org.jlleitschuh.gradle:ktlint-gradle:${versions.ktlintPlugin}",
@@ -100,6 +101,7 @@ buildscript {
100101
classpath deps.android_gradle_plugin
101102
classpath deps.detekt
102103
classpath deps.dokka
104+
classpath deps.dokkaAndroid
103105
classpath deps.kotlin.gradlePlugin
104106
classpath deps.ktlint
105107
classpath deps.mavenPublish
@@ -112,6 +114,11 @@ buildscript {
112114
}
113115
}
114116

117+
rootProject.ext.defaultDokkaConfig = {
118+
outputFormat = 'gfm'
119+
outputDirectory = "$buildDir/docs"
120+
}
121+
115122
rootProject.ext.defaultAndroidConfig = {
116123
compileSdkVersion versions.targetSdkVersion
117124
buildToolsVersion versions.buildToolsVersion

kotlin/viewregistry-android/src/main/java/com/squareup/viewregistry/ModalContainer.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ abstract class ModalContainer<M : Any>
9696
.subscribe {
9797
removeAllViews()
9898
val newView = it.viewForBase(screens, viewRegistry, this)
99-
restoredBaseViewState?.let {
99+
restoredBaseViewState?.let { restoredState ->
100100
restoredBaseViewState = null
101-
newView.restoreHierarchyState(it)
101+
newView.restoreHierarchyState(restoredState)
102102
}
103103
addView(newView)
104104
}

kotlin/viewregistry/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616
apply plugin: 'java-library'
1717
apply plugin: 'kotlin'
1818
apply plugin: 'com.vanniktech.maven.publish'
19+
apply plugin: 'org.jetbrains.dokka'
1920

2021
sourceCompatibility = JavaVersion.VERSION_1_7
2122
targetCompatibility = JavaVersion.VERSION_1_7
2223

2324
kotlin.experimental.coroutines 'enable'
2425

26+
dokka rootProject.ext.defaultDokkaConfig
27+
2528
dependencies {
2629
api deps.kotlin.stdLib.jdk6
2730
api deps.okio

kotlin/workflow-core/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616
apply plugin: 'java-library'
1717
apply plugin: 'kotlin'
1818
apply plugin: 'com.vanniktech.maven.publish'
19+
apply plugin: 'org.jetbrains.dokka'
1920

2021
sourceCompatibility = JavaVersion.VERSION_1_7
2122
targetCompatibility = JavaVersion.VERSION_1_7
2223

2324
kotlin.experimental.coroutines 'enable'
2425

26+
dokka rootProject.ext.defaultDokkaConfig
27+
2528
dependencies {
2629
compileOnly deps.annotations.intellij
2730

kotlin/workflow-core/src/main/java/com/squareup/workflow/StatefulWorkflow.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ package com.squareup.workflow
1818
/**
1919
* A composable, stateful object that can [handle events][WorkflowContext.onEvent],
2020
* [delegate to children][WorkflowContext.compose], [subscribe][onReceive] to arbitrary streams from
21-
* the outside world, and be [saved][snapshotState] to a serialized form to be
22-
* [restored][restoreState] later.
21+
* the outside world, and be [saved][snapshotState] to a serialized form to be restored later.
2322
*
2423
* The basic purpose of a `Workflow` is to take some [input][InputT] and return a
2524
* [rendering][RenderingT]. To that end, a workflow may keep track of internal [state][StateT],
@@ -39,7 +38,7 @@ package com.squareup.workflow
3938
*
4039
* @param StateT Typically a data class that contains all of the internal state for this workflow.
4140
* The state is seeded via [input][InputT] in [initialState]. It can be [serialized][snapshotState]
42-
* and later used to [restore][restoreState] the workflow. **Implementations of the `Workflow`
41+
* and later used to restore the workflow. **Implementations of the `Workflow`
4342
* interface should not generally contain their own state directly.** They may inject objects like
4443
* instances of their child workflows, or network clients, but should not contain directly mutable
4544
* state. This is the only type parameter that a parent workflow needn't care about for its children,

kotlin/workflow-core/src/main/java/com/squareup/workflow/Workflow.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ package com.squareup.workflow
4343
* If your workflow needs to keep track of internal state, implement the [StatefulWorkflow]
4444
* interface. That interface has an additional type parameter, `StateT`, and allows you to specify
4545
* [how to create the initial state][StatefulWorkflow.initialState] and how to
46-
* [snapshot][StatefulWorkflow.snapshotState]/[restore][StatefulWorkflow.restoreState] your state.
46+
* [snapshot][StatefulWorkflow.snapshotState]/restore your state.
4747
*
4848
* ### [Stateless Workflows][StatelessWorkflow]
4949
*

kotlin/workflow-core/src/main/java/com/squareup/workflow/WorkflowContext.kt

+29-23
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ import kotlin.reflect.KType
4444
interface WorkflowContext<StateT : Any, in OutputT : Any> {
4545

4646
/**
47-
* Given a function that takes an [event][EventT] and can mutate the state or emit an output, returns
48-
* a function that will perform that workflow update when called with an event.
49-
* The returned function is valid until the next [compose][Workflow.compose] pass.
47+
* Given a function that takes an [event][EventT] and can mutate the state or emit an output,
48+
* returns a function that will perform that workflow update when called with an event.
49+
* The returned function is valid until the next compose pass.
5050
*
5151
* For example, if you have a rendering type of `Screen`:
5252
*
@@ -73,16 +73,16 @@ interface WorkflowContext<StateT : Any, in OutputT : Any> {
7373
): EventHandler<EventT>
7474

7575
/**
76-
* Ensures that the [channel][ReceiveChannel] returned from [channelProvider] is subscribed to, and
77-
* will send anything emitted on the channel to [handler] as a [ChannelUpdate].
76+
* Ensures that the [channel][ReceiveChannel] returned from [channelProvider] is subscribed to,
77+
* and will send anything emitted on the channel to [handler] as a [ChannelUpdate].
7878
*
7979
* This method ensures that only one subscription is active at a time for the given [type]+[key].
80-
* If this method is called in two or more consecutive [Workflow.compose] invocations with the same
81-
* key, [channelProvider] will only be invoked for the first one, and the returned channel will be
82-
* re-used for all subsequent invocations, until a [Workflow.compose] invocation does _not_ call this
83-
* method with an equal key. At that time, the channel will be [cancelled][ReceiveChannel.cancel],
84-
* with the assumption that cancelling the channel will release any resources allocated by the
85-
* [channelProvider].
80+
* If this method is called in two or more consecutive `compose` invocations with the
81+
* same key, [channelProvider] will only be invoked for the first one, and the returned channel
82+
* will be re-used for all subsequent invocations, until a `compose` invocation does
83+
* _not_ call this method with an equal key. At that time, the channel will be
84+
* [cancelled][ReceiveChannel.cancel], with the assumption that cancelling the channel will
85+
* release any resources allocated by the [channelProvider].
8686
*
8787
* @param type The [KType] that represents both the type of data source (e.g. `ReceiveChannel` or
8888
* `Deferred`) and the element type [E].
@@ -101,18 +101,21 @@ interface WorkflowContext<StateT : Any, in OutputT : Any> {
101101

102102
/**
103103
* Ensures [child] is running as a child of this workflow, and returns the result of its
104-
* [compose][Workflow.compose] method.
104+
* `compose` method.
105105
*
106-
* **Never call [Workflow.compose] directly, always do it through this context method.**
106+
* **Never call [StatefulWorkflow.compose] or [StatelessWorkflow.compose] directly, always do it
107+
* through this context method.**
107108
*
108109
* 1. If the child _wasn't_ already running, it will be started either from
109110
* [initialState][Workflow.initialState] or its snapshot.
110-
* 2. If the child _was_ already running, The workflow's [onInputChanged][Workflow.onInputChanged]
111-
* method is invoked with the previous input and this one.
112-
* 3. The child's [compose][Workflow.compose] method is invoked with `input` and the child's state.
111+
* 2. If the child _was_ already running, The workflow's
112+
* [onInputChanged][StatefulWorkflow.onInputChanged] method is invoked with the previous input
113+
* and this one.
114+
* 3. The child's `compose` method is invoked with `input` and the child's state.
113115
*
114116
* After this method returns, if something happens that trigger's one of `child`'s handlers, and
115-
* that handler emits an output, the function passed as [handler] will be invoked with that output.
117+
* that handler emits an output, the function passed as [handler] will be invoked with that
118+
* output.
116119
*
117120
* @param key An optional string key that is used to distinguish between workflows of the same
118121
* type.
@@ -130,14 +133,15 @@ interface WorkflowContext<StateT : Any, in OutputT : Any> {
130133
* will send anything emitted on the channel to [handler] as a [ChannelUpdate].
131134
*
132135
* This method ensures that only one subscription is active at a time for the given key.
133-
* If this method is called in two or more consecutive [Workflow.compose] invocations with the same
136+
* If this method is called in two or more consecutive `compose` invocations with the same
134137
* key+[channelProvider] type, the provider will only be invoked for the first one, and the returned
135-
* channel will be re-used for all subsequent invocations, until a [Workflow.compose] invocation does
136-
* _not_ call this method with an equal key+type. At that time, the channel will be
138+
* channel will be re-used for all subsequent invocations, until a `compose` invocation
139+
* does _not_ call this method with an equal key+type. At that time, the channel will be
137140
* [cancelled][ReceiveChannel.cancel], with the assumption that cancelling the channel will release
138141
* any resources allocated by the [channelProvider].
139142
*
140-
* @param key An optional string key that is used to distinguish between subscriptions of the same type.
143+
* @param key An optional string key that is used to distinguish between subscriptions of the same
144+
* type.
141145
* @param handler A function that returns the [WorkflowAction] to perform when the channel emits.
142146
*
143147
* @see WorkflowContext.onReceive
@@ -168,7 +172,8 @@ fun <StateT : Any, OutputT : Any, ChildOutputT : Any, ChildRenderingT : Any>
168172
// @formatter:on
169173

170174
/**
171-
* Convenience alias of [WorkflowContext.compose] for workflows that don't take input or emit output.
175+
* Convenience alias of [WorkflowContext.compose] for workflows that don't take input or emit
176+
* output.
172177
*/
173178
fun <InputT : Any, StateT : Any, OutputT : Any, ChildRenderingT : Any>
174179
WorkflowContext<StateT, OutputT>.compose(
@@ -182,7 +187,8 @@ fun <InputT : Any, StateT : Any, OutputT : Any, ChildRenderingT : Any>
182187
// @formatter:on
183188

184189
/**
185-
* Convenience alias of [WorkflowContext.compose] for workflows that don't take input or emit output.
190+
* Convenience alias of [WorkflowContext.compose] for workflows that don't take input or emit
191+
* output.
186192
*/
187193
fun <StateT : Any, OutputT : Any, ChildRenderingT : Any>
188194
WorkflowContext<StateT, OutputT>.compose(

kotlin/workflow-host/src/main/java/com/squareup/workflow/WorkflowHost.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ import kotlin.coroutines.experimental.EmptyCoroutineContext
3737
interface WorkflowHost<out OutputT : Any, out RenderingT : Any> {
3838

3939
/**
40-
* Output from a [WorkflowHost]. Emitted from [WorkflowHost.updates] after every
41-
* [compose][Workflow.compose] pass.
40+
* Output from a [WorkflowHost]. Emitted from [WorkflowHost.updates] after every compose pass.
4241
*/
4342
data class Update<out OutputT : Any, out RenderingT : Any>(
4443
val rendering: RenderingT,
@@ -61,11 +60,12 @@ interface WorkflowHost<out OutputT : Any, out RenderingT : Any> {
6160
/**
6261
* Creates a [WorkflowHost] to run [workflow].
6362
*
64-
* The workflow's initial state is determined by passing [input] to [Workflow.initialState].
63+
* The workflow's initial state is determined by passing [input] to
64+
* [StatefulWorkflow.initialState].
6565
*
6666
* @param workflow The workflow to start.
67-
* @param input Passed to [Workflow.initialState] to determine the root workflow's initial state.
68-
* If [InputT] is `Unit`, you can just omit this argument.
67+
* @param input Passed to [StatefulWorkflow.initialState] to determine the root workflow's
68+
* initial state. If [InputT] is `Unit`, you can just omit this argument.
6969
* @param snapshot If not null, used to restore the workflow.
7070
* @param context The [CoroutineContext] used to run the workflow tree. Added to the [Factory]'s
7171
* context.

kotlin/workflow-rx2/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616
apply plugin: 'java-library'
1717
apply plugin: 'kotlin'
1818
apply plugin: 'com.vanniktech.maven.publish'
19+
apply plugin: 'org.jetbrains.dokka'
1920

2021
sourceCompatibility = JavaVersion.VERSION_1_7
2122
targetCompatibility = JavaVersion.VERSION_1_7
2223

2324
kotlin.experimental.coroutines 'enable'
2425

26+
dokka rootProject.ext.defaultDokkaConfig
27+
2528
dependencies {
2629
compileOnly deps.annotations.intellij
2730

kotlin/workflow-testing/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616
apply plugin: 'java-library'
1717
apply plugin: 'kotlin'
1818
apply plugin: 'com.vanniktech.maven.publish'
19+
apply plugin: 'org.jetbrains.dokka'
1920

2021
sourceCompatibility = JavaVersion.VERSION_1_7
2122
targetCompatibility = JavaVersion.VERSION_1_7
2223

2324
kotlin.experimental.coroutines 'enable'
2425

26+
dokka rootProject.ext.defaultDokkaConfig
27+
2528
dependencies {
2629
compileOnly deps.annotations.intellij
2730

0 commit comments

Comments
 (0)