• Stars
    star
    246
  • Rank 164,726 (Top 4 %)
  • Language
    Kotlin
  • License
    Other
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tool to migrate Android projects from Gradle to Bazel incrementally and automatically

Grazel

Grazel stands for Gradle to Bazel. A Gradle plugin to migrate Android projects to Bazel build system in an incremental and automated fashion.

Maven Central

Components

  • Gradle plugin
  • A Kotlin Starlark DSL to generate Starlark code in a type-safe way.
  • Grab Bazel Common - Custom rules to bridge the gap between Gradle/Bazel.

Features

  • Generate BUILD.bazel, WORKSPACE for given Android project and reduce the overall migration effort.
  • Setup hybrid build to build part of project graph to build with Bazel and rest with Gradle.
  • Minimal source changes to codebase - supported by Grab Bazel Common.
  • Gradle Configuration as source of truth.

For documentation and usage instructions, please visit website.

How it works

It works by automatically generating Bazel scripts for given Android project based on your Gradle configuration. For simple projects, it should be able to migrate, fully build and launch the app with bazel mobile-install //<target-name>.

For example, for the following Gradle configuration:

apply plugin: "com.android.library"
apply plugin: "kotlin-android"

android {
    compileSdkVersion rootProject.compileSdk
    defaultConfig {
        minSdkVersion rootProject.minSdk
        targetSdkVersion rootProject.targetSdk
        versionCode 1
        versionName "1.0"
    }
}

dependencies {
    implementation project(":app")
    implementation project(":base")
    implementation "androidx.test.espresso:espresso-idling-resource:3.2.0"
}

Grazel's migrateToBazel task generates the following build script:

load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library")

kt_android_library(
    name = "quiz",
    srcs = glob([
        "src/main/java/**/*.kt",
    ]),
    custom_package = "com.google.samples.apps.topeka.quiz",
    manifest = "src/main/AndroidManifest.xml",
    resource_files = glob([
        "src/main/res/**",
    ]),
    visibility = [
        "//visibility:public",
    ],
    deps = [
        "//app",
        "//base",
        "@maven//:androidx_test_espresso_espresso_idling_resource",
    ],
)

See migration capabilities for supported features. In advanced cases, where entire project might not be migratable, it migrates part of the graph and sets up hybrid build where part of the graph can be built with Bazel and rest with Gradle.

Resources

License

Copyright 2022 Grabtaxi Holdings PTE LTD (GRAB)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

front-end-guide

πŸ“š Study guide and introduction to the modern front end stack.
JavaScript
14,933
star
2

cocoapods-binary-cache

Ruby
451
star
3

cocoapods-pod-merge

Cocoapods plugin to merge pods used by your Xcode project, reducing the number of dynamic frameworks your app has to load on startup
Ruby
363
star
4

engineering-blog

πŸ“ We write about our technologies and the problems we handle at scale.
Ruby
119
star
5

swift-leak-check

Swift
109
star
6

talaria

TalariaDB is a distributed, highly available, and low latency time-series database for Presto
Go
108
star
7

secret-scanner

Go
40
star
8

grab-bazel-common

Common rules and macros for Grab's Android projects built with Bazel.
Kotlin
35
star
9

hackathon

πŸ’» Official Grabathon websites
JavaScript
29
star
10

symphony

Go
28
star
11

grabplatform-sdk-js

GrabPlatform SDK in javascript
TypeScript
27
star
12

async

Go
24
star
13

grabplatform-sdk-android

GrabPlatform SDK for android
Kotlin
20
star
14

superapp-sdk

SDK for Grab SuperApp WebView.
JavaScript
15
star
15

grabplatform-sdk-ios

GrabPlatform SDK for iOS
Swift
12
star
16

GraphBEAN

Interaction-Focused Anomaly Detection on Bipartite Node-and-Edge-Attributed Graphs
Python
11
star
17

grab-query-traces

10
star
18

grabpay-merchant-sdk

Java
9
star
19

gosm

Gosm is a golang library which implements writing OSM pbf files.
Go
9
star
20

mobile-kit-bridge-sdk

SDK for web view bridges that offers unified method signatures for Android/iOS
TypeScript
7
star
21

grabplatform-sample

Comprehensive sample for GrabPlatform-related SDKs.
JavaScript
4
star
22

blogs

Accompanying source code for our engineering blog
Ruby
4
star
23

grabplatform-sdk-golang

GrabPlatform SDK for Golang
3
star
24

grabplatform-sdk-js-example

JavaScript
1
star
25

go-showdeps

Go
1
star