A Gradle plugin that builds modules using Bazel.
- 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 inlocal.properties
:bazel.bin.path=/usr/local/bin/bazel
- Open this project using Android Studio.
- Read the Known Issues section.
app - an Android app which is built using Gradle
|
|_ lib1 - a Java lib that is built using Gradle
| |
| |_ Lib2 - a Java lib that is build using Bazel
|
|_ lib3 - a Java lib that is built using Bazel
| |
| |_ lib4 - a Java lib that is built using Bazel
|
|_ andlib - an Android lib that is built using Bazel
| |
| |_ innerandlib - an Android lib that is built using Bazel
|
|_ gandlib - an Android lib that is built using Gradle
|
|_ innerandlib - an Android lib that is built using Bazel
|
|_ lib4 - a Java lib that is built using Bazel
For each module that is built using Bazel:
- create a
build.gradle
file for the module - apply the
bazel-leaf
plugin:
apply plugin: 'bazelleaf'
- add build configuration, and specify which target should be built with Bazel:
bazel {
target = 'jar'
}
- you may add a test-target, which will be used when
./gradlew test
is called:
bazel {
target = 'jar'
testTarget = 'AllTests'
}
- Support for running tests using Robolectric.
- Support for remote (Maven?) dependencies.
- 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.
Copyright 2018 Spotify
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.