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

BUILD.bazel not generated. #47

Open
sylwek845 opened this issue Nov 30, 2022 · 1 comment
Open

BUILD.bazel not generated. #47

sylwek845 opened this issue Nov 30, 2022 · 1 comment
Assignees

Comments

@sylwek845
Copy link

Problem 1.
Not sure why this is happening but it seems like some of my modules getting the Deleted test/test_fixtures_ui/BUILD.bazel and I don;t see the migrated BUILD.bazel file

> Task :test:test_fixtures_ui:generateBazelScripts
Deleted test/test_fixtures_ui/BUILD.bazel

> Task :test:test_fixtures:generateBazelScripts
Generated test/test_fixtures/BUILD.bazel

my config

grazel {
    android {
        features {
            dataBinding = true
        }
        variantFilter {
            this.setIgnore(name != "release" && name != "prodEnv")
        }
        ndkApiLevel = 28
    }

    rules {
        bazelCommon {
            gitRepository {
                commit = "646475fa68b984f476871f0e8073234e8cae559c" // Commit hash
                remote = "https://github.com/grab/grab-bazel-common.git"
            }
        }
        test {
            enableTestMigration = true
            detectSourceSets = true
        }
        dependencies {
            overrideArtifactVersions.add("androidx.navigation:navigation-runtime:2.3.2")
        }
        mavenInstall {
            httpArchiveRepository {
                sha256 = "b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6"
                stripPrefix = "rules_jvm_external-4.5"
                url = "https://github.com/bazelbuild/rules_jvm_external/archive/4.5.zip"
            }
            artifactPinning {
                enabled.set(false)
            }
            versionConflictPolicy = "pinned"
        }
    }

Problem 2.

When I enable artifactPinning I get dependency conflict ->

Error in fail: Error while fetching artifact with coursier: Resolution error: Conflicting dependencies:
androidx.navigation:navigation-runtime:2.3.2 or [2.3.0] or [2.4.0] wanted by

  androidx.hilt:hilt-navigation:1.0.0 wants 2.3.2
  └─ androidx.hilt:hilt-navigation-compose:1.0.0

  androidx.navigation:navigation-fragment:2.3.0 wants [2.3.0]
  └─ com.datadoghq:dd-sdk-android:1.15.0

  androidx.navigation:navigation-runtime-ktx:2.4.0 wants [2.4.0]
  ├─ androidx.navigation:navigation-compose:2.4.0 wants androidx.navigation:navigation-runtime-ktx:[2.4.0]
  │  └─ androidx.hilt:hilt-navigation-compose:1.0.0
  └─ com.datadoghq:dd-sdk-android:1.15.0 wants androidx.navigation:navigation-runtime-ktx:2.3.0

but adding overrideArtifactVersions.add("androidx.navigation:navigation-runtime:2.3.2") doesn't work at all.

and I do get the same

> Task :test:test_fixtures_ui:generateBazelScripts
Deleted test/test_fixtures_ui/BUILD.bazel

@arunkumar9t2 arunkumar9t2 self-assigned this Dec 6, 2022
@arunkumar9t2
Copy link
Contributor

Hey @sylwek845 thanks for reporting this. Adding a bit of context for this behavior, this is due to the fact that Grazel tries to do incremental migration by default. We explain it here https://grab.github.io/Grazel/migration_criteria/#migration-criteria. The problem is that the check is not as exhaustive and we don't have good tooling yet to display statistics on what was migrated. For fixing this we need two this at least

  1. Add capability to disable incremental migration or provide custom lambda in grazel {} in addition to default MigrationCriteria.
  2. Ensure Grazel generates transitive closure of maven targets in WORKSPACE as well to let versionConflictPolicy = "pinned" to work. Gradle and rules_jvm_external does dependency resolution differently, the proper way to fix it is ensure Grazel generates pinned versions of all artifacts (including transitives) in the project. Then rules_jvm_external won't throw dependency resolution conflicts. This is currently being done as part of rewrite here Part 3: Per variant maven classpath support #45. Will target this for 0.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants