Skip to content

Commit

Permalink
Expose parcelize plugin and add an example for using it (#522)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex <alexburdusel@google.com>
  • Loading branch information
AlexBurdu and Alex authored Apr 25, 2021
1 parent 626d197 commit 6f5f8ce
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
34 changes: 34 additions & 0 deletions examples/plugin/src/parcelize/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
load("//kotlin:kotlin.bzl", "kt_compiler_plugin", "kt_jvm_library", "kt_jvm_test")

kt_compiler_plugin(
name = "parcelize_plugin",
compile_phase = True,
id = "org.jetbrains.kotlin.parcelize",
stubs_phase = True,
deps = [
"@com_github_jetbrains_kotlin//:parcelize-compiler-plugin",
],
)

kt_jvm_library(
name = "parcelize",
srcs = [],
exported_compiler_plugins = [":parcelize_plugin"],
plugins = [
":parcelize_plugin",
],
visibility = ["//visibility:public"],
exports = [
"@com_github_jetbrains_kotlin//:parcelize-runtime",
],
)

kt_android_library(
name = "parcelable",
srcs = [
"ParcelableObject.kt",
],
deps = [
":parcelize",
],
)
6 changes: 6 additions & 0 deletions examples/plugin/src/parcelize/ParcelableObject.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package plugins.parcelize

import android.os.Parcelable
import kotlinx.parcelize.Parcelize

@Parcelize class ParcelableObject(val name: String) : Parcelable
10 changes: 10 additions & 0 deletions kotlin/internal/repositories/BUILD.com_github_jetbrains_kotlin
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ kt_jvm_import(
jar = "lib/sam-with-receiver-compiler-plugin.jar",
)

kt_jvm_import(
name = "parcelize-compiler-plugin",
jar = "lib/parcelize-compiler.jar",
)

kt_jvm_import(
name = "parcelize-runtime",
jar = "lib/parcelize-runtime.jar",
)

# Kotlin dependencies that are internal to this repo and may be linked.
[
java_import(
Expand Down

0 comments on commit 6f5f8ce

Please sign in to comment.