Skip to content

Commit 13fad82

Browse files
authored
Merge pull request #1 from EndlessCodeGroup/feature/update-kotlin
Update Kotlin and Coroutines
2 parents b6e7409 + 0e5f90a commit 13fad82

34 files changed

Lines changed: 198 additions & 268 deletions
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import internal.java
2+
import internal.kotlin
23
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
34

45
// Java version
@@ -7,19 +8,23 @@ java {
78
targetCompatibility = JavaVersion.VERSION_1_8
89
}
910

11+
kotlin {
12+
explicitApi()
13+
}
14+
1015
repositories {
1116
jcenter()
1217
}
1318

1419
dependencies {
1520
"implementation"(kotlin("stdlib-jdk8"))
16-
"implementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3")
21+
"implementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2")
1722
}
1823

1924
tasks.withType<KotlinCompile>().configureEach {
2025
kotlinOptions {
2126
jvmTarget = "1.8"
22-
apiVersion = "1.3"
23-
languageVersion = "1.3"
27+
apiVersion = "1.4"
28+
languageVersion = "1.4"
2429
}
2530
}

buildSrc/src/main/kotlin/dependencies.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const val sentry = "io.sentry:sentry:1.7.29"
44

55
object fuel {
66
private const val group = "com.github.kittinunf.fuel"
7-
private const val version = "2.2.1"
7+
private const val version = "2.3.1"
88
const val self = "$group:fuel:$version"
99
const val coroutines = "$group:fuel-coroutines:$version"
1010
}

buildSrc/src/main/kotlin/internal/accessors.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ package internal
33
import org.gradle.api.Project
44
import org.gradle.api.plugins.JavaPluginExtension
55
import org.gradle.kotlin.dsl.configure
6+
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
67

78
internal fun Project.java(configure: JavaPluginExtension.() -> Unit) {
89
extensions.configure(configure)
910
}
11+
12+
internal fun Project.kotlin(configure: KotlinProjectExtension.() -> Unit) {
13+
extensions.configure(configure)
14+
}

inspector-api/src/main/kotlin/Annotations.kt

Lines changed: 0 additions & 6 deletions
This file was deleted.

inspector-api/src/main/kotlin/dsl/Markdown.kt

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ internal class Line(private val text: String) : Element {
1414
internal annotation class MarkdownMarker
1515

1616
@MarkdownMarker
17-
abstract class Group(
17+
public abstract class Group internal constructor(
1818
private val indent: String,
1919
private val firstLine: String?,
20-
private val lastLine: String? = firstLine
20+
private val lastLine: String? = firstLine,
2121
) : Element {
2222
private val children = arrayListOf<Element>()
2323

@@ -35,11 +35,11 @@ abstract class Group(
3535
lastLine?.let { builder.append("$it\n") }
3636
}
3737

38-
operator fun String?.unaryPlus() {
38+
public operator fun String?.unaryPlus() {
3939
children.add(Line(this ?: ""))
4040
}
4141

42-
operator fun List<String>?.unaryPlus() {
42+
public operator fun List<String>?.unaryPlus() {
4343
this?.forEach { +it }
4444
}
4545

@@ -50,27 +50,21 @@ abstract class Group(
5050
}
5151
}
5252

53-
abstract class TextGroup : Group(indent = "", firstLine = null) {
53+
public abstract class TextGroup internal constructor() : Group(indent = "", firstLine = null) {
5454

55-
fun b(text: String): String {
56-
return "**$text**"
57-
}
55+
public fun b(text: String): String = "**$text**"
5856

59-
fun it(text: String): String {
60-
return "*$text*"
61-
}
57+
public fun it(text: String): String = "*$text*"
6258

63-
fun hr(): String {
64-
return "---"
65-
}
59+
public fun hr(): String = "---"
6660
}
6761

68-
class Markdown : TextGroup() {
69-
fun code(lang: String = "", init: Code.() -> Unit) = initGroup(Code(lang), init)
62+
public class Markdown internal constructor() : TextGroup() {
63+
public fun code(lang: String = "", init: Code.() -> Unit): Code = initGroup(Code(lang), init)
7064
}
7165

72-
class Code(lang: String) : Group(indent = "", firstLine = "```$lang", lastLine = "```")
66+
public class Code internal constructor(lang: String) : Group(indent = "", firstLine = "```$lang", lastLine = "```")
7367

74-
fun markdown(init: Markdown.() -> Unit): Markdown {
68+
public fun markdown(init: Markdown.() -> Unit): Markdown {
7569
return Markdown().also(init)
7670
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package ru.endlesscode.inspector

inspector-api/src/main/kotlin/report/CachingReporter.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import ru.endlesscode.inspector.util.similarTo
99
/**
1010
* Reporter that filters if he already reported similar exception.
1111
*/
12-
abstract class CachingReporter : Reporter {
12+
public abstract class CachingReporter : Reporter {
1313

1414
private val reportedCauses = mutableListOf<Throwable>()
1515
private val handlers = CompoundReportHandler()
@@ -52,10 +52,10 @@ abstract class CachingReporter : Reporter {
5252
* @param onSuccess Will be called on successful report
5353
* @param onError Will be called on error during report
5454
*/
55-
abstract suspend fun report(
55+
public abstract suspend fun report(
5656
title: String,
5757
exceptionData: ExceptionData,
5858
onSuccess: (String, ExceptionData) -> Unit,
59-
onError: (Throwable) -> Unit
59+
onError: (Throwable) -> Unit,
6060
)
6161
}

inspector-api/src/main/kotlin/report/CompoundReportHandler.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package ru.endlesscode.inspector.report
33
/**
44
* Handler that dispatches events to many handlers.
55
*/
6-
class CompoundReportHandler : ReportHandler {
6+
public class CompoundReportHandler : ReportHandler {
77

88
private val handlers = mutableListOf<ReportHandler>()
99

@@ -22,7 +22,7 @@ class CompoundReportHandler : ReportHandler {
2222
/**
2323
* Add given [handler] to list of handlers that should receive events.
2424
*/
25-
fun addHandler(handler: ReportHandler) {
25+
public fun addHandler(handler: ReportHandler) {
2626
handlers.add(handler)
2727
}
2828
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package ru.endlesscode.inspector.report
22

3-
class ExceptionData(
4-
val exception: Exception,
5-
var times: Int = 1
3+
public class ExceptionData(
4+
public val exception: Exception,
5+
public var times: Int = 1,
66
)
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package ru.endlesscode.inspector.report
22

3-
interface ReportEnvironment {
3+
public interface ReportEnvironment {
44

5-
companion object {
6-
val EMPTY = object : ReportEnvironment {
5+
public companion object {
6+
public val EMPTY: ReportEnvironment = object : ReportEnvironment {
77
override val appVersion: String = ""
88
override val reporterId: String = ""
99
override val fields: Map<String, ReportField> = emptyMap()
@@ -14,20 +14,20 @@ interface ReportEnvironment {
1414
/**
1515
* Version of app that uses Inspector.
1616
*/
17-
val appVersion: String
17+
public val appVersion: String
1818

1919
/**
2020
* Unique identifier of reporter.
2121
*/
22-
val reporterId: String
22+
public val reporterId: String
2323

2424
/**
2525
* Environment-related [fields][ReportField]. Stored as relation "name -> field".
2626
*/
27-
val fields: Map<String, ReportField>
27+
public val fields: Map<String, ReportField>
2828

2929
/**
3030
* Indicates that inspector enabled.
3131
*/
32-
val isInspectorEnabled: Boolean
32+
public val isInspectorEnabled: Boolean
3333
}

0 commit comments

Comments
 (0)