项目作者: menny

项目描述 :
A Gradle plugin that builds modules using Bazel.
高级语言: Java
项目地址: git://github.com/menny/bazel-leaf.git
创建时间: 2018-02-01T18:08:25Z
项目社区:https://github.com/menny/bazel-leaf

开源协议:Apache License 2.0

下载


🍂🐘 Bazel Leaf

A Gradle plugin that builds modules using Bazel.

Setup

Development Setup

  • This was only tested with Android Studio 3.1-alpha9, on macOS.
  • ensure you have Bazel installed. Follow the instructions here
  • (optionally) if bazel binary in not in PATH set the path to it in local.properties:
    • bazel.bin.path=/usr/local/bin/bazel
  • Open this project using Android Studio.
  • Read the Known Issues section.

Repo Structure:

  1. app - an Android app which is built using Gradle
  2. |
  3. |_ lib1 - a Java lib that is built using Gradle
  4. | |
  5. | |_ Lib2 - a Java lib that is build using Bazel
  6. |
  7. |_ lib3 - a Java lib that is built using Bazel
  8. | |
  9. | |_ lib4 - a Java lib that is built using Bazel
  10. |
  11. |_ andlib - an Android lib that is built using Bazel
  12. | |
  13. | |_ innerandlib - an Android lib that is built using Bazel
  14. |
  15. |_ gandlib - an Android lib that is built using Gradle
  16. |
  17. |_ innerandlib - an Android lib that is built using Bazel
  18. |
  19. |_ lib4 - a Java lib that is built using Bazel

Module Setup

For each module that is built using Bazel:

  • create a build.gradle file for the module
  • apply the bazel-leaf plugin:
    1. apply plugin: 'bazelleaf'
  • add build configuration, and specify which target should be built with Bazel:
    1. bazel {
    2. target = 'jar'
    3. }
  • you may add a test-target, which will be used when ./gradlew test is called:
    1. bazel {
    2. target = 'jar'
    3. testTarget = 'AllTests'
    4. }

    Road Map

  • Support for running tests using Robolectric.
  • Support for remote (Maven?) dependencies.

Known Issues

  • In most cases, you’ll need to first build the project from command line before importing it into Android Studio. For this project, run
    ./gradlew :app:assembleDebug before importing into Android Studio, or before doing gradle-sync for the first time.
  • When using a Maven dependency in Bazel, Android-Studio will not detect that.

License

  1. Copyright 2018 Spotify
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.