diff options
author | Lukacs Berki <lberki@google.com> | 2015-08-25 12:34:20 +0000 |
---|---|---|
committer | Lukacs Berki <lberki@google.com> | 2015-08-26 07:35:29 +0000 |
commit | d5079a59bf85d298ec8598eb3f6b002accb297ce (patch) | |
tree | 697de1e55c2ab1aa23e62e8a2605a9b8f438df81 | |
parent | 4c43b0efc1ab0797682121edfe6e5da2493dc1ca (diff) |
Require an android_local_tools_repository stanza in the WORKSPACE file 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 #384.
--
MOS_MIGRATED_REVID=101456190
-rw-r--r-- | examples/android/README.md | 4 | ||||
-rwxr-xr-x | scripts/bootstrap/init_workspace.sh | 6 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE | 26 | ||||
-rwxr-xr-x | tools/android/aar_generator.sh | 7 | ||||
-rwxr-xr-x | tools/android/merge_dexzips.sh | 7 | ||||
-rwxr-xr-x | tools/android/resources_processor.sh | 8 | ||||
-rwxr-xr-x | tools/android/shuffle_jars.sh | 7 |
7 files changed, 42 insertions, 23 deletions
diff --git a/examples/android/README.md b/examples/android/README.md index 36f3345b68..dd0a3694aa 100644 --- a/examples/android/README.md +++ b/examples/android/README.md @@ -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>", diff --git a/scripts/bootstrap/init_workspace.sh b/scripts/bootstrap/init_workspace.sh index c91e4d64a5..5fc4cfacdc 100755 --- a/scripts/bootstrap/init_workspace.sh +++ b/scripts/bootstrap/init_workspace.sh @@ -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} diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE index 27bbd95078..711409aaa6 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE @@ -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") diff --git a/tools/android/aar_generator.sh b/tools/android/aar_generator.sh index 83ee3585cb..b9b86d1ad9 100755 --- a/tools/android/aar_generator.sh +++ b/tools/android/aar_generator.sh @@ -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 "$@" diff --git a/tools/android/merge_dexzips.sh b/tools/android/merge_dexzips.sh index cc1c1333e1..a37cd9929b 100755 --- a/tools/android/merge_dexzips.sh +++ b/tools/android/merge_dexzips.sh @@ -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 "$@" diff --git a/tools/android/resources_processor.sh b/tools/android/resources_processor.sh index b27fe5ef0e..f04f10f450 100755 --- a/tools/android/resources_processor.sh +++ b/tools/android/resources_processor.sh @@ -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 "$@" diff --git a/tools/android/shuffle_jars.sh b/tools/android/shuffle_jars.sh index b7b8f209f9..0b2256adb3 100755 --- a/tools/android/shuffle_jars.sh +++ b/tools/android/shuffle_jars.sh @@ -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 "$@" |