Skip to content

Commit 113e91b

Browse files
authored
Support Kotlin 1.8 (#910)
* Support Kotlin 1.8 * Update Anvil to 2.4.3-1-8-0-RC * Use the latest compose release
1 parent d7cf3fd commit 113e91b

File tree

22 files changed

+467
-17
lines changed

22 files changed

+467
-17
lines changed

examples/anvil/BUILD.bazel

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ load("@io_bazel_rules_kotlin//kotlin:core.bzl", "define_kt_toolchain")
22

33
define_kt_toolchain(
44
name = "kotlin_toolchain",
5-
api_version = "1.6",
6-
language_version = "1.6",
5+
jvm_target = "1.8",
76
)

examples/anvil/WORKSPACE

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ maven_install(
6060
"com.google.dagger:dagger:2.44.2",
6161
"com.google.dagger:dagger-compiler:2.44.2",
6262
"com.google.dagger:dagger-producers:2.44.2",
63-
"com.squareup.anvil:compiler:2.4.3",
64-
"com.squareup.anvil:annotations:2.4.3",
63+
"com.squareup.anvil:compiler:2.4.4",
64+
"com.squareup.anvil:annotations:2.4.4",
6565
"androidx.activity:activity:1.0.0",
6666
"androidx.annotation:annotation:1.1.0",
6767
"androidx.appcompat:appcompat-resources:1.1.0",
@@ -76,7 +76,6 @@ maven_install(
7676
"androidx.cursoradapter:cursoradapter:1.0.0",
7777
"androidx.customview:customview:1.0.0",
7878
"androidx.drawerlayout:drawerlayout:1.0.0",
79-
"androidx.fragment:fragment:1.0.0",
8079
"androidx.fragment:fragment:1.1.0",
8180
"androidx.interpolator:interpolator:1.0.0",
8281
"androidx.lifecycle:lifecycle-common:2.1.0",

examples/jetpack_compose/BUILD

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ default_java_toolchain(
1010

1111
define_kt_toolchain(
1212
name = "kotlin_toolchain",
13-
api_version = "1.6",
1413
jvm_target = "1.8",
15-
language_version = "1.6",
1614
)
1715

1816
# Define the compose compiler plugin

examples/jetpack_compose/WORKSPACE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
22

33
_COMPOSE_VERSION = "1.2.1"
44

5-
_COMPOSE_COMPILER_VERSION = "1.3.2"
5+
_COMPOSE_COMPILER_VERSION = "1.4.0"
66

7-
_KOTLIN_COMPILER_VERSION = "1.7.20"
7+
_KOTLIN_COMPILER_VERSION = "1.8.0"
88

9-
_KOTLIN_COMPILER_SHA = "5e3c8d0f965410ff12e90d6f8dc5df2fc09fd595a684d514616851ce7e94ae7d"
9+
_KOTLIN_COMPILER_SHA = "0bb9419fac9832a56a3a19cad282f8f2d6f1237d2d467dc8dfe9bd4a2a43c42e"
1010

1111
# Setup Kotlin
1212

kotlin/internal/opts.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
# limitations under the License.
1414

1515
load(
16-
"@rkt_1_7//starlark/kotlin:opts.bzl",
16+
"@rkt_1_8//starlark/kotlin:opts.bzl",
1717
_KotlincOptions = "KotlincOptions",
1818
_kotlinc_options_to_flags = "kotlinc_options_to_flags",
1919
_kt_kotlinc_options = "kt_kotlinc_options",
2020
)
2121
load(
22-
"@rkt_1_7//starlark/jvm:opts.bzl",
22+
"@rkt_1_8//starlark/jvm:opts.bzl",
2323
_JavacOptions = "JavacOptions",
2424
_javac_options_to_flags = "javac_options_to_flags",
2525
_kt_javac_options = "kt_javac_options",

kotlin/internal/toolchains.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ _kt_toolchain = rule(
119119
),
120120
"language_version": attr.string(
121121
doc = "this is the -language_version flag [see](https://kotlinlang.org/docs/reference/compatibility.html)",
122-
default = "1.7",
122+
default = "1.8",
123123
values = [
124124
"1.1",
125125
"1.2",
@@ -132,7 +132,7 @@ _kt_toolchain = rule(
132132
),
133133
"api_version": attr.string(
134134
doc = "this is the -api_version flag [see](https://kotlinlang.org/docs/reference/compatibility.html).",
135-
default = "1.7",
135+
default = "1.8",
136136
values = [
137137
"1.1",
138138
"1.2",
@@ -141,6 +141,7 @@ _kt_toolchain = rule(
141141
"1.5",
142142
"1.6",
143143
"1.7",
144+
"1.8",
144145
],
145146
),
146147
"debug": attr.string_list(

src/main/kotlin/io/bazel/kotlin/builder/tasks/js/Kotlin2JsTaskExecutor.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class Kotlin2JsTaskExecutor @Inject constructor(
5050
it.addAll(passThroughFlagsList)
5151
it.addAll("-libraries", inputs.librariesList.joinToString(":"))
5252
it.addAll("-output", outputs.js)
53+
it.addAll("-Xuse-deprecated-legacy-compiler")
5354
it.addAll(inputs.kotlinSourcesList)
5455
}
5556
context.whenTracing { printLines("js compile args", args) }

src/main/kotlin/io/bazel/kotlin/plugin/SkipCodeGen.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension
3232
/**
3333
* SkipCodeGen registers an extension to skip code generation. Must be the last compiler plugin.
3434
*/
35+
@OptIn(org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi::class)
3536
class SkipCodeGen : ComponentRegistrar {
3637

3738
companion object {

src/main/kotlin/io/bazel/kotlin/plugin/jdeps/JdepsGenCommandLineProcessor.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor
77
import org.jetbrains.kotlin.config.CompilerConfiguration
88
import org.jetbrains.kotlin.config.CompilerConfigurationKey
99

10+
@OptIn(org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi::class)
1011
class JdepsGenCommandLineProcessor : CommandLineProcessor {
1112
companion object {
1213
val COMPILER_PLUGIN_ID = "io.bazel.kotlin.plugin.jdeps.JDepsGen"

src/main/kotlin/io/bazel/kotlin/plugin/jdeps/JdepsGenComponentRegistrar.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import org.jetbrains.kotlin.config.CompilerConfiguration
66
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
77
import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension
88

9+
@OptIn(org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi::class)
910
class JdepsGenComponentRegistrar : ComponentRegistrar {
1011

1112
override fun registerProjectComponents(

0 commit comments

Comments
 (0)