Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

target 'org_jetbrains_kotlin_kotlin_parcelize_runtime' not declared #24

Open
jeraldsun opened this issue May 24, 2022 · 5 comments
Open
Labels
bug Something isn't working

Comments

@jeraldsun
Copy link

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.

@arunkumar9t2
Copy link
Contributor

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.

@arunkumar9t2 arunkumar9t2 added needs info Requires more information to proceed bug Something isn't working labels May 24, 2022
@jeraldsun
Copy link
Author

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?

@arunkumar9t2
Copy link
Contributor

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

@jeraldsun
Copy link
Author

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

@arunkumar9t2 arunkumar9t2 removed the needs info Requires more information to proceed label Jun 6, 2022
@arunkumar9t2
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants