Skip to content

Commit

Permalink
Enable explicit API mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
ychescale9 committed Aug 15, 2020
1 parent 4a0dbf0 commit 9db8f91
Show file tree
Hide file tree
Showing 52 changed files with 229 additions and 143 deletions.
10 changes: 10 additions & 0 deletions blueprint-async-coroutines/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ plugins {
id 'org.jetbrains.dokka'
}

kotlin.explicitApi = 'strict'

compileKotlin {
kotlinOptions {
freeCompilerArgs += [
'-Xexplicit-api=strict',
]
}
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import kotlinx.coroutines.CoroutineDispatcher
* on different threads, but they don't need to know about the underlying implementation.
* A single-threaded version for example can be injected for testing.
*/
class CoroutineDispatcherProvider(
public class CoroutineDispatcherProvider(
/**
* Dispatcher for IO-bound work
*/
val io: CoroutineDispatcher,
public val io: CoroutineDispatcher,
/**
* Dispatcher for computational work
*/
val computation: CoroutineDispatcher,
public val computation: CoroutineDispatcher,
/**
* Dispatcher for UI work
*/
val ui: CoroutineDispatcher
public val ui: CoroutineDispatcher
)
10 changes: 10 additions & 0 deletions blueprint-async-rx2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ plugins {
id 'org.jetbrains.dokka'
}

kotlin.explicitApi = 'strict'

compileKotlin {
kotlinOptions {
freeCompilerArgs += [
'-Xexplicit-api=strict',
]
}
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import io.reactivex.Scheduler
* on different threads, but they don't need to know about the underlying implementation.
* A single-threaded version for example can be injected for testing.
*/
class SchedulerProvider(
public class SchedulerProvider(
/**
* Scheduler for IO-bound work
*/
val io: Scheduler,
public val io: Scheduler,
/**
* Scheduler for computational work
*/
val computation: Scheduler,
public val computation: Scheduler,
/**
* Scheduler for UI work
*/
val ui: Scheduler
public val ui: Scheduler
)
10 changes: 10 additions & 0 deletions blueprint-async-rx3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ plugins {
id 'org.jetbrains.dokka'
}

kotlin.explicitApi = 'strict'

compileKotlin {
kotlinOptions {
freeCompilerArgs += [
'-Xexplicit-api=strict',
]
}
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import io.reactivex.rxjava3.core.Scheduler
* on different threads, but they don't need to know about the underlying implementation.
* A single-threaded version for example can be injected for testing.
*/
class SchedulerProvider(
public class SchedulerProvider(
/**
* Scheduler for IO-bound work
*/
val io: Scheduler,
public val io: Scheduler,
/**
* Scheduler for computational work
*/
val computation: Scheduler,
public val computation: Scheduler,
/**
* Scheduler for UI work
*/
val ui: Scheduler
public val ui: Scheduler
)
10 changes: 10 additions & 0 deletions blueprint-interactor-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ plugins {
id 'org.jetbrains.dokka'
}

kotlin.explicitApi = 'strict'

compileKotlin {
kotlinOptions {
freeCompilerArgs += [
'-Xexplicit-api=strict',
]
}
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ package reactivecircus.blueprint.interactor
* Interface representing params to be passed in for each interactor.
* Implement this for each interactor that requires specific params.
*/
interface InteractorParams
public interface InteractorParams

/**
* A special [InteractorParams] representing empty params.
* Use this when the interactor requires no params.
*/
object EmptyParams : InteractorParams
public object EmptyParams : InteractorParams
10 changes: 10 additions & 0 deletions blueprint-interactor-coroutines/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ plugins {
id 'org.jetbrains.dokka'
}

kotlin.explicitApi = 'strict'

compileKotlin {
kotlinOptions {
freeCompilerArgs += [
'-Xexplicit-api=strict',
]
}
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import reactivecircus.blueprint.interactor.InteractorParams
*
* Work will be executed on thread as specified by the [dispatcher] of the interactor.
*/
abstract class FlowInteractor<in P : InteractorParams, out R> {
public abstract class FlowInteractor<in P : InteractorParams, out R> {

/**
* The coroutine context this interactor should execute on.
*/
abstract val dispatcher: CoroutineDispatcher
public abstract val dispatcher: CoroutineDispatcher

/**
* Create a [Flow] for this interactor.
Expand All @@ -26,5 +26,5 @@ abstract class FlowInteractor<in P : InteractorParams, out R> {
/**
* Build a new [Flow] from this interactor.
*/
fun buildFlow(params: P): Flow<R> = createFlow(params).flowOn(dispatcher)
public fun buildFlow(params: P): Flow<R> = createFlow(params).flowOn(dispatcher)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import reactivecircus.blueprint.interactor.InteractorParams
*
* Work will be executed on thread as specified by the [dispatcher] of the interactor.
*/
abstract class SuspendingInteractor<in P : InteractorParams, out R> {
public abstract class SuspendingInteractor<in P : InteractorParams, out R> {

/**
* The coroutine context this interactor should execute on.
*/
abstract val dispatcher: CoroutineDispatcher
public abstract val dispatcher: CoroutineDispatcher

/**
* Define the work to be performed by this interactor.
Expand All @@ -25,7 +25,7 @@ abstract class SuspendingInteractor<in P : InteractorParams, out R> {
/**
* Execute the the interactor.
*/
suspend fun execute(params: P): R = withContext(context = dispatcher) {
public suspend fun execute(params: P): R = withContext(context = dispatcher) {
doWork(params)
}
}
10 changes: 10 additions & 0 deletions blueprint-interactor-rx2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ plugins {
id 'org.jetbrains.dokka'
}

kotlin.explicitApi = 'strict'

compileKotlin {
kotlinOptions {
freeCompilerArgs += [
'-Xexplicit-api=strict',
]
}
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import reactivecircus.blueprint.interactor.InteractorParams
* Upon subscription a use case will execute its job in the thread specified by the [ioScheduler].
* and will post the result to the thread specified by [uiScheduler].
*/
abstract class CompletableInteractor<P : InteractorParams>(
public abstract class CompletableInteractor<P : InteractorParams>(
private val ioScheduler: Scheduler,
private val uiScheduler: Scheduler
) {
Expand All @@ -23,7 +23,7 @@ abstract class CompletableInteractor<P : InteractorParams>(
/**
* Build a use case with the provided execution thread and post execution thread
*/
fun buildCompletable(params: P): Completable {
public fun buildCompletable(params: P): Completable {
return createInteractor(params)
.subscribeOn(ioScheduler)
.observeOn(uiScheduler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import reactivecircus.blueprint.interactor.InteractorParams
* Upon subscription a use case will execute its job in the thread specified by the [ioScheduler].
* and will post the result to the thread specified by [uiScheduler].
*/
abstract class ObservableInteractor<P : InteractorParams, T>(
public abstract class ObservableInteractor<P : InteractorParams, T>(
private val ioScheduler: Scheduler,
private val uiScheduler: Scheduler
) {
Expand All @@ -23,7 +23,7 @@ abstract class ObservableInteractor<P : InteractorParams, T>(
/**
* Build a use case with the provided execution thread and post execution thread
*/
fun buildObservable(params: P): Observable<T> {
public fun buildObservable(params: P): Observable<T> {
return createInteractor(params)
.subscribeOn(ioScheduler)
.observeOn(uiScheduler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import reactivecircus.blueprint.interactor.InteractorParams
* Upon subscription a use case will execute its job in the thread specified by the [ioScheduler].
* and will post the result to the thread specified by [uiScheduler].
*/
abstract class SingleInteractor<P : InteractorParams, T>(
public abstract class SingleInteractor<P : InteractorParams, T>(
private val ioScheduler: Scheduler,
private val uiScheduler: Scheduler
) {
Expand All @@ -25,7 +25,7 @@ abstract class SingleInteractor<P : InteractorParams, T>(
* @param params - parameters required for this interactor
* @param blocking - when set to true the single will be subscribed and observed on the current thread
*/
fun buildSingle(params: P, blocking: Boolean = false): Single<T> {
public fun buildSingle(params: P, blocking: Boolean = false): Single<T> {
return if (blocking) {
createInteractor(params)
} else {
Expand Down
10 changes: 10 additions & 0 deletions blueprint-interactor-rx3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ plugins {
id 'org.jetbrains.dokka'
}

kotlin.explicitApi = 'strict'

compileKotlin {
kotlinOptions {
freeCompilerArgs += [
'-Xexplicit-api=strict',
]
}
}

afterEvaluate { project ->
project.tasks.dokka {
outputDirectory = "$rootDir/docs/api"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import reactivecircus.blueprint.interactor.InteractorParams
* Upon subscription a use case will execute its job in the thread specified by the [ioScheduler].
* and will post the result to the thread specified by [uiScheduler].
*/
abstract class CompletableInteractor<P : InteractorParams>(
public abstract class CompletableInteractor<P : InteractorParams>(
private val ioScheduler: Scheduler,
private val uiScheduler: Scheduler
) {
Expand All @@ -23,7 +23,7 @@ abstract class CompletableInteractor<P : InteractorParams>(
/**
* Build a use case with the provided execution thread and post execution thread
*/
fun buildCompletable(params: P): Completable {
public fun buildCompletable(params: P): Completable {
return createInteractor(params)
.subscribeOn(ioScheduler)
.observeOn(uiScheduler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import reactivecircus.blueprint.interactor.InteractorParams
* Upon subscription a use case will execute its job in the thread specified by the [ioScheduler].
* and will post the result to the thread specified by [uiScheduler].
*/
abstract class ObservableInteractor<P : InteractorParams, T>(
public abstract class ObservableInteractor<P : InteractorParams, T>(
private val ioScheduler: Scheduler,
private val uiScheduler: Scheduler
) {
Expand All @@ -23,7 +23,7 @@ abstract class ObservableInteractor<P : InteractorParams, T>(
/**
* Build a use case with the provided execution thread and post execution thread
*/
fun buildObservable(params: P): Observable<T> {
public fun buildObservable(params: P): Observable<T> {
return createInteractor(params)
.subscribeOn(ioScheduler)
.observeOn(uiScheduler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import reactivecircus.blueprint.interactor.InteractorParams
* Upon subscription a use case will execute its job in the thread specified by the [ioScheduler].
* and will post the result to the thread specified by [uiScheduler].
*/
abstract class SingleInteractor<P : InteractorParams, T>(
public abstract class SingleInteractor<P : InteractorParams, T>(
private val ioScheduler: Scheduler,
private val uiScheduler: Scheduler
) {
Expand All @@ -25,7 +25,7 @@ abstract class SingleInteractor<P : InteractorParams, T>(
* @param params - parameters required for this interactor
* @param blocking - when set to true the single will be subscribed and observed on the current thread
*/
fun buildSingle(params: P, blocking: Boolean = false): Single<T> {
public fun buildSingle(params: P, blocking: Boolean = false): Single<T> {
return if (blocking) {
createInteractor(params)
} else {
Expand Down
7 changes: 7 additions & 0 deletions blueprint-testing-robot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ android {
testApplicationId 'reactivecircus.blueprint.testing.testapp'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

kotlin.explicitApi = 'strict'
kotlinOptions {
freeCompilerArgs += [
'-Xexplicit-api=strict',
]
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import java.util.concurrent.atomic.AtomicReference
/**
* Finds the activity in the foreground (if any).
*/
fun currentActivity(): Activity? {
public fun currentActivity(): Activity? {
val currentActivityReference = AtomicReference<Activity>()
getInstrumentation().runOnMainSync {
val resumedActivities = ActivityLifecycleMonitorRegistry.getInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.junit.runners.model.Statement
* TestRule to execute tests multiple times.
* This can be used to debug flaky tests.
*/
class RepeatRule(private val iterations: Int) : TestRule {
public class RepeatRule(private val iterations: Int) : TestRule {

init {
require(iterations > 0) { "iterations < 1: $iterations" }
Expand Down
Loading

0 comments on commit 9db8f91

Please sign in to comment.