grab / grab-bazel-common

Common rules and macros for Grab's Android projects built with Bazel.

Home Page:https://grab.github.io/grazel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

target 'org_jetbrains_kotlin_kotlin_parcelize_runtime' not declared

jeraldsun opened this issue · comments

I'm using grazel to migrate my gradle project to bazel.
After ./gradlew migrateToBazel, I ran bazelisk mobile-install and got the following error:

ERROR: */doc-android-client/BUILD.bazel:31:16: no such target '@maven//:org_jetbrains_kotlin_kotlin_parcelize_runtime': target 'org_jetbrains_kotlin_kotlin_parcelize_runtime' not declared in package '' defined by /private/var/tmp/_bazel_sunjuntao/738fc54fee5051b993b283099c23f8de/external/maven/BUILD and referenced by '//:parcelize'

It seems that here's something wrong with grab-bazel-common:

// doc-android-client/BUILD.bazel
load("@grab_bazel_common//tools/parcelize:parcelize.bzl", "parcelize_rules")

parcelize_rules()

I'm using grazel 0.3.2, and the grazel extension I configured is:

grazel {
    android {
        ndkEnable = false
    }
    rules {
        bazelCommon {
            gitRepository {
                commit = "3568b6190f4f805d2c18af243e79b506dd99bfce"
                remote = "https://github.com/grab/grab-bazel-common.git"
            }
        }
        mavenInstall {
            httpArchiveRepository {
                sha256 = "f36441aa876c4f6427bfb2d1f2d723b48e9d930b62662bf723ddfb8fc80f0140"
                stripPrefix = "rules_jvm_external-4.1"
                url = "https://github.com/bazelbuild/rules_jvm_external/archive/4.1.zip"
            }
            resolveTimeout = 5400
            artifactPinning {
                enabled.set(true)
            }
            versionConflictPolicy = "pinned"
        }
        kotlin {
            gitRepository {
                commit = "eae21653baad4b403fee9e8a706c9d4fbd0c27c6"
                remote = "https://github.com/bazelbuild/rules_kotlin.git"
            }
            compiler {
                version = "1.4.20"
                sha = "46720991a716e90bfc0cf3f2c81b2bd735c14f4ea6a5064c488e04fd76e6b6c7"
            }
            kotlinC {
                useIr = false
            }
            toolchain {
                enabled = true
                apiVersion = "1.4"
                reportUnusedDeps = "off"
                strictKotlinDeps = "off"
                abiJars = true
                multiplexWorkers = true
                languageVersion = "1.4"
                jvmTarget = "1.8"
            }
        }
    }
}

Is anything wrong with my configuration?
Look forward to your kind reply.

Thanks for reporting, it seems like grazel generated rules for Android Extensions parcelize but did not generate the maven dependency in WORKSPACE file.

Do you use Android Extensions' Parcelize in your app?

If yes,

  • Could you confirm if your generated WORKSPACE has this entry?
  • If not please add implementation("org.jetbrains.kotlin:kotlin-parcelize-runtime:1.4.32") to you application build.gradle and run migrateToBazel again.

In no,

  • You can remove parcelize_rules() call in BUILD.bazel

Although I am still curious how this got generated so input on your android extensions setup or even a small sample project will help a lot.

Thanks for reporting, it seems like grazel generated rules for Android Extensions parcelize but did not generate the maven dependency in WORKSPACE file.

Do you use Android Extensions' Parcelize in your app?

If yes,

  • Could you confirm if your generated WORKSPACE has this entry?
  • If not please add implementation("org.jetbrains.kotlin:kotlin-parcelize-runtime:1.4.32") to you application build.gradle and run migrateToBazel again.

In no,

  • You can remove parcelize_rules() call in BUILD.bazel

Although I am still curious how this got generated so input on your android extensions setup or even a small sample project will help a lot.

Thanks for your replay. By 'the maven dependency in WORKSPACE file', you mean artifacts inside maven_install?
After I removed parcelize_rules(), here are some other maven targets could not be found.
Maybe I can checkout the maven_install's generating logic?

Yes I meant that, does adding implementation("org.jetbrains.kotlin:kotlin-parcelize-runtime:1.4.32") to application build.gradle help?

Yes I meant that, does adding implementation("org.jetbrains.kotlin:kotlin-parcelize-runtime:1.4.32") to application build.gradle help?

Update: Yeah, adding implementation("org.jetbrains.kotlin:kotlin-parcelize-runtime:1.4.32") to application build.gradle can help. As we don't use kotlin-parcelize plugin, I think it's better to change the following code in grazel:
截屏2022-05-26 11 06 02
截屏2022-05-26 11 06 10

We are planning to remove custom logic for compiler plugins and annotation processors in Grazel. Will address it as part of that effort.