Skip to content

Commit

Permalink
Require an android_local_tools_repository stanza in the WORKSPACE fil…
Browse files Browse the repository at this point in the history
…e so that Bazel finds Android tools and update the tools themselves to handle their new location.

This paves the way for eventually referencing every tool this way.

We have to figure out if android_http_tools_repository is the right way to distribute the Android tools, but now that we don't have a binary distribution yet, it's not an immediate problem.

This will break existing users of Android support in Bazel, whom I'll inform over bazel-discuss.

Fixes bazelbuild#384.

--
MOS_MIGRATED_REVID=101456190
  • Loading branch information
lberki committed Aug 26, 2015
1 parent 4c43b0e commit d5079a5
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 23 deletions.
4 changes: 4 additions & 0 deletions examples/android/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
In order to build these examples, add the following two rules to the top-level `WORKSPACE` file (two directories above this file):

```python
android_local_tools_repository(
name="android_tools",
path="<full path to the source tree of Bazel>")

android_sdk_repository(
name="androidsdk",
path="<full path to your Android SDK>",
Expand Down
6 changes: 0 additions & 6 deletions scripts/bootstrap/init_workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ rm -f "${base_workspace}/tools" && ln -s "$(pwd)/tools" "${base_workspace}/tools
rm -f "${base_workspace}/third_party" && ln -s "$(pwd)/third_party" "${base_workspace}/third_party"
rm -f "${base_workspace}/examples" && ln -s "$(pwd)/examples" "${base_workspace}/examples"
rm -rf "${base_workspace}/src"
mkdir -p ${base_workspace}/src/tools
ln -s $(pwd)/src/tools/android ${base_workspace}/src/tools/android
# TODO(bazel-team): Remove the src/main/java symlink once the android tools
# don't depend on src/main/java:options.
mkdir -p ${base_workspace}/src/main
ln -s $(pwd)/src/main/java ${base_workspace}/src/main/java

# Create a bazelrc file with the base_workspace directory in the package path.
bazelrc='build --package_path %workspace%:'${base_workspace}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
bind(name = "android/proguard_whitelister", actual = "//tools/android:proguard_whitelister")
bind(name = "android/merge_manifests", actual = "//tools/android:merge_manifests")
bind(name = "android/build_incremental_dexmanifest", actual = "//tools/android:build_incremental_dexmanifest")
bind(name = "android/stubify_manifest", actual = "//tools/android:stubify_manifest")
bind(name = "android/incremental_install", actual = "//tools/android:incremental_install")
bind(name = "android/build_split_manifest", actual = "//tools/android:build_split_manifest")
bind(name = "android/strip_resources", actual = "//tools/android:strip_resources")
bind(name = "android/incremental_stub_application", actual = "//tools/android:incremental_stub_application")
bind(name = "android/incremental_split_stub_application", actual = "//tools/android:incremental_split_stub_application")
bind(name = "android/resources_processor", actual = "//tools/android:resources_processor")
bind(name = "android/aar_generator", actual = "//tools/android:aar_generator")
bind(name = "android/shuffle_jars", actual = "//tools/android:shuffle_jars")
bind(name = "android/merge_dexzips", actual = "//tools/android:merge_dexzips")
# bind(name = "android/proguard_whitelister", actual = "//tools/android:proguard_whitelister")
# bind(name = "android/merge_manifests", actual = "//tools/android:merge_manifests")
# bind(name = "android/build_incremental_dexmanifest", actual = "//tools/android:build_incremental_dexmanifest")
# bind(name = "android/stubify_manifest", actual = "//tools/android:stubify_manifest")
# bind(name = "android/incremental_install", actual = "//tools/android:incremental_install")
# bind(name = "android/build_split_manifest", actual = "//tools/android:build_split_manifest")
# bind(name = "android/strip_resources", actual = "//tools/android:strip_resources")
# bind(name = "android/incremental_stub_application", actual = "//tools/android:incremental_stub_application")
# bind(name = "android/incremental_split_stub_application", actual = "//tools/android:incremental_split_stub_application")
# bind(name = "android/resources_processor", actual = "//tools/android:resources_processor")
# bind(name = "android/aar_generator", actual = "//tools/android:aar_generator")
# bind(name = "android/shuffle_jars", actual = "//tools/android:shuffle_jars")
# bind(name = "android/merge_dexzips", actual = "//tools/android:merge_dexzips")
bind(name = "android/sdk")
bind(name = "android/crosstool", actual = "//tools/cpp:toolchain")
bind(name = "android/appcompat_v4")
Expand Down
7 changes: 6 additions & 1 deletion tools/android/aar_generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@
# 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.
exec ${TEST_SRCDIR-$0.runfiles}/src/tools/android/java/com/google/devtools/build/android/AarGeneratorAction "$@"
if echo $0 | grep -sq /external/; then
PREFIX="external/$(echo $0 | sed 's_^.*external/\([^/]*\)/.*$_\1_')"
else
PREFIX=""
fi
exec ${TEST_SRCDIR-$0.runfiles}/$PREFIX/src/tools/android/java/com/google/devtools/build/android/AarGeneratorAction "$@"
7 changes: 6 additions & 1 deletion tools/android/merge_dexzips.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,10 @@
# 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.
if echo $0 | grep -sq /external/; then
PREFIX="external/$(echo $0 | sed 's_^.*external/\([^/]*\)/.*$_\1_')"
else
PREFIX=""
fi
JAVA_PACKAGE=com/google/devtools/build/android/ziputils
exec ${TEST_SRCDIR-$0.runfiles}/src/tools/android/java/${JAVA_PACKAGE}/reducer "$@"
exec ${TEST_SRCDIR-$0.runfiles}/$PREFIX/src/tools/android/java/${JAVA_PACKAGE}/reducer "$@"
8 changes: 7 additions & 1 deletion tools/android/resources_processor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@
# 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.
exec ${TEST_SRCDIR-$0.runfiles}/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessingAction "$@"
if echo $0 | grep -sq /external/; then
PREFIX="external/$(echo $0 | sed 's_^.*external/\([^/]*\)/.*$_\1_')"
else
PREFIX=""
fi

exec ${TEST_SRCDIR-$0.runfiles}/$PREFIX/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessingAction "$@"
7 changes: 6 additions & 1 deletion tools/android/shuffle_jars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,10 @@
# 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.
if echo $0 | grep -sq /external/; then
PREFIX="external/$(echo $0 | sed 's_^.*external/\([^/]*\)/.*$_\1_')"
else
PREFIX=""
fi
JAVA_PACKAGE=com/google/devtools/build/android/ziputils
exec ${TEST_SRCDIR-$0.runfiles}/src/tools/android/java/${JAVA_PACKAGE}/mapper "$@"
exec ${TEST_SRCDIR-$0.runfiles}/$PREFIX/src/tools/android/java/${JAVA_PACKAGE}/mapper "$@"

0 comments on commit d5079a5

Please sign in to comment.