Skip to content

Releases: grab/grazel

0.4.0

01 Nov 09:59
d7a3a5a
Compare
Choose a tag to compare

Full Changelog: 0.3.2...0.4.0

What's Changed

New Contributors

Full Changelog: 0.3.2...0.4.0

0.3.2

27 Apr 20:04
Compare
Choose a tag to compare

Issues Fixed

  • Partial support for dynamic features: Grazel will generate android_binary rule for modules applying dynamic features plugin.
  • Fixed case where pure Kotlin/Java module with android jar dependency in Gradle did not have android dependency generated in Bazel.

Full Changelog: 0.3.1...0.3.2

0.3.1

27 Apr 20:00
fe59f42
Compare
Choose a tag to compare

Issues fixed

  • Fix case where grab_kt_jvm_test was generated instead of grab_android_local_test even though module had android jar in its classpath.

Full Changelog: 0.3.0...0.3.1

0.3.0 - Artifact pinning and override targets

27 Apr 19:57
Compare
Choose a tag to compare

Grazel now supports rules_jvm_external's artifact pinning and ability to generate override targets in WORKSPACE's maven_install rule.

Docs:

Changes

Full Changelog: 0.2.0...0.3.0

0.2.0 - Unit tests and artifact exclusions

12 Jan 04:05
Compare
Choose a tag to compare

Changelog

Features

  • Grazel now automatically infers dependency exclude rules declared in Gradle and maps it to rules_jvm_external equivalent. For example,

    implementation("androidx.constraintlayout:constraintlayout:2.1.1") {
        exclude group: "androidx.appcompat", module: "appcompat"
    }

    will generate the following in WORKSPACE file

    maven_install(
      artifacts = [
          ...
          maven.artifact(
              group = "androidx.constraintlayout",
              artifact = "constraintlayout",
              version = "2.1.1",
              exclusions = [
                  "androidx.appcompat:appcompat",
              ],
          ),
    )
  • Grazel can generate unit test rules from bazel-common. Only Kotlin is supported at the moment. Please read readme for more details.
    For example,

    load("@grab_bazel_common//tools/test:test.bzl", "grab_kt_jvm_test")
    
    grab_kt_jvm_test(
      name = "sample-kotlin-lib-test",
      srcs = glob([
          "src/test/java/**/*.kt",
      ]),
      associates = [
          "//sample-kotlin-lib",
      ],
      visibility = [
          "//visibility:public",
      ],
      deps = [
          "@maven//:junit_junit",
      ],
    )

    For android local unit tests, grab_android_local_test will be generated that ports AGP's returnDefaultValues feature to Bazel.

    load("@grab_bazel_common//tools/test:test.bzl", "grab_android_local_test")
    
    grab_android_local_test(
      name = "grab_android_local_test",
      srcs = glob([
          "src/test/java/**/*.kt",
      ]),
      associates = [
          ":grab_android_local_test_lib_kt",
      ],
      deps = [
          "@maven//:junit_junit",
      ],
    )

    Both of the macros assumes the test files are in Kotlin, ends with *Test and file name matches the class name. Robolectric is currently not supported.

    Unit test generation is controlled by grazel.rules.test.enableTestMigration flag.

Contributors

  • Gradle 7.1.1 compatibility, thanks @msfjarvis.

Initial release - 0.1.0

28 Jul 06:20
Compare
Choose a tag to compare

Grazel

Grazel stands for Gradle to Bazel. It is a Gradle plugin that enables you to migrate Android projects to Bazel build system in an incremental and automated fashion.

Usage

Grazel is available on Maven central.

In root build.gradle file:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "com.grab.grazel:grazel-gradle-plugin:0.1.0"
    }
}
apply plugin: "com.grab.grazel"

// Grazel configuration
grazel {
    // DSL
}

See configuration for more details.

Run ./gradlew migrateToBazel to generate Bazel scripts on supported modules in the project.

Reading

Talks

  • Grab's migration journey from Gradle to Bazel - Build Meetup 2021. Watch here.