aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/android
Commit message (Collapse)AuthorAge
...
* aar_import creates res/values/empty.xml if it contains no resources.Gravatar ajmichael2017-08-29
| | | | | | | | | To do this, add a new tool that is used instead of zipper to get the resources out of the AAR. This tool creates res/values/empty.xml if there are no resources in the AAR. Also, some general cleaning of the code. RELNOTES: None PiperOrigin-RevId: 166768607
* Busybox all the Bazel Android tools.Gravatar ajmichael2017-08-25
| | | | | | | | | This change reduces the size taken up in the bazel binary by Android tools deploy jars from 38.2 mb to 9.8 mb, which is 15% of the bazel binary size. Also, some minor cleanups of our BUILD files. https://github.com/bazelbuild/bazel/issues/2385 RELNOTES: None PiperOrigin-RevId: 166373241
* Android,tools: don't open zip file in binary modeGravatar laszlocsomor2017-08-10
| | | | | | | | Zip files are always opened in binary mode and the ctor doesn't accept "b" in the mode string. RELNOTES: none PiperOrigin-RevId: 164832193
* Android,tools: open all files in binary modeGravatar Laszlo Csomor2017-08-10
| | | | | | | | | | | | | | | Always open files in binary mode to avoid automatic conversion between LF and CRLF on Windows, which is particularly problematic when a file is written on Windows but consumed on Android or when a binary file is opened for reading in text mode and if it happens to have an LF byte it would be converted to CRLF. See https://github.com/bazelbuild/bazel/issues/3264 Change-Id: I4d9d885a488b9693eeb3f6d929e3396ef8406d62 PiperOrigin-RevId: 164826587
* Windows,Android: mobile-install fully worksGravatar Laszlo Csomor2017-08-10
| | | | | | | | | | | | | | | | One of the output files in the incremental apk (stub_application_data.txt) was using CRLF on Windows, so the mobile-install'ed app was crashing on startup. Fix is to open the output file in binary mode so line endings are not converted to the host-platform-native one. See https://github.com/bazelbuild/bazel/issues/3264 Change-Id: Id7d4b5aa4362a21e699517b97dd24858c396eaa7 PiperOrigin-RevId: 164722314
* Windows, Android: fix mobile-installGravatar Laszlo Csomor2017-08-08
| | | | | | | | | | | The Adb command needs the SYSTEMROOT environment variable (as does Bazel), otherwise it produces weird errors. So add that to Adb's environment. See https://github.com/bazelbuild/bazel/issues/3264 Change-Id: Ia393f32ef00e21c90e4fc6d4a3188b7987aa89b0 PiperOrigin-RevId: 164454924
* Remove old intellij aspect code bundled with BazelGravatar Googler2017-07-31
| | | | PiperOrigin-RevId: 163538636
* Make $jarjar_bin point to //tools/android:jarjar_bin.Gravatar ajmichael2017-07-24
| | | | | | | Fixes TODO in AndroidRuleClasses.java. RELNOTES: None PiperOrigin-RevId: 162955052
* zip_manifest_creator: fix rlocation on WindowsGravatar Laszlo Csomor2017-07-14
| | | | | | | | | | | | Apparently `rlocation` is not defined in the environment of regular sh_binary rules, only in tests. So this commit adds an implementation for it. See https://github.com/bazelbuild/bazel/issues/3264 Change-Id: I70ecb91cef5e1b66679e6ba04823831183da5cd9 PiperOrigin-RevId: 161775438
* Fix #3326 by making sure only one zipper is selected.Gravatar John Cater2017-07-10
| | | | | Change-Id: Ib061c85900e577f3548d47e8fa86086dfec9654a PiperOrigin-RevId: 161360338
* zip_manifest_creator: more info if $ZIPPER missingGravatar Laszlo Csomor2017-07-07
| | | | | | | | | | | | Add extra debugging info to zip_manifest_creator.sh in case ZIPPER is not found. This'll help diagnosing https://github.com/bazelbuild/bazel/issues/3326 RELNOTES: none Change-Id: I60884b43c1aa10a9f67843628f1fadc74959059d PiperOrigin-RevId: 161208218
* Android: zip_manifest_creator now runs on WindowsGravatar Laszlo Csomor2017-07-05
| | | | | | | | | And so does its test. See https://github.com/bazelbuild/bazel/issues/3264 Change-Id: I32dd906b94747d601254ab55e7962bf6cda058f4 PiperOrigin-RevId: 160953063
* Android tooling: host/target path distinctionGravatar Laszlo Csomor2017-06-30
| | | | | | | | | | | | | Introduce host and target path separation in the Android incremental_install.py. This will allow running this script (and use bazel mobile-install) on platforms with non-POSIX path semantics (e.g. Windows). See https://github.com/bazelbuild/bazel/issues/3264 Change-Id: If6ec09f100dd2e0be3389dce25cb1a13305226e9 PiperOrigin-RevId: 160531950
* Windows, Android: update android_sdk_repositoryGravatar Laszlo Csomor2017-06-28
| | | | | | | | | | | | | | | | | | | | | The android_sdk_repository now uses the native Android build tools (e.g. aapt.exe, aidl.exe) when --host_cpu is one of x64_windows{,_msys,_msvc}. On Linux/MacOS we create a wrapper script for these tools and data-depend on SDK/build-tools/VERSION/lib/*, but on Windows we have no runfiles support and Bazel just creates a junction to SDK/build-tools, so all the actual tools are there where the binaries expect them. Also change the ":fail" target to select srcs on the host platform and use a .cmd file on Windows. See https://github.com/bazelbuild/bazel/issues/3264 Change-Id: Ica586fa1fd4914f4795b4387b449f1c5562164e0 PiperOrigin-RevId: 160383278
* Automated g4 rollback of commit dba22f337a20d3e8f3ac8dfd23bc6fa69e4528da.Gravatar xingao2017-06-02
| | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Use Java implementation of singlejar on FreeBSD, and roll forward change 157473007. *** Original change description *** Automated g4 rollback of commit d894345ed88f8adce600b66a310b5210d0bcb59c. *** Reason for rollback *** Breaks Bazel on FreeBSD: http://ci.bazel.io/view/Dashboard/job/Bazel/JAVA_VERSION=1.8,PLATFORM_NAME=freebsd-11/1542/console *** Original change description *** Use cc implementation of singlejar except on Windows. Change-Id: Ie4a2db2a6fa1ea86f4bdd42cd806f6804a0c56d4 PiperOrigin-RevId: 157729503
* Add //external:has_androidsdk config_setting.Gravatar ajmichael2017-06-01
| | | | | | | | | | | | | | | | | | This will be used to add some tests and targets to the Bazel codebase that build and run successfully when android_sdk_repository is in the WORKSPACE and silently skip if it is not. Example deps of a library that links against dx.jar: ``` deps = select({ "//external:has_androidsdk": ["//external:android/dx_jar_import"], "//conditions:default": [], }), ``` Also adds tests that config_setting works as expected when propagated through an alias or bind rule. RELNOTES: None PiperOrigin-RevId: 157627472
* Automated g4 rollback of commit d894345ed88f8adce600b66a310b5210d0bcb59c.Gravatar laszlocsomor2017-05-31
| | | | | | | | | | | | | *** Reason for rollback *** Breaks Bazel on FreeBSD: http://ci.bazel.io/view/Dashboard/job/Bazel/JAVA_VERSION=1.8,PLATFORM_NAME=freebsd-11/1542/console *** Original change description *** Use cc implementation of singlejar except on Windows. Change-Id: Ie4a2db2a6fa1ea86f4bdd42cd806f6804a0c56d4 PiperOrigin-RevId: 157567871
* Use cc implementation of singlejar except on Windows.Gravatar Xin Gao2017-05-31
| | | | | Change-Id: Ie4a2db2a6fa1ea86f4bdd42cd806f6804a0c56d4 PiperOrigin-RevId: 157473007
* Set the correct main class on the desugar java_binary target in Bazel.Gravatar ajmichael2017-05-10
| | | | | | | | | | | | | | | | | | This will make it easier to build the desugarer tool from the Bazel source tree as an executable (deploy) jar and then use it for something else. For example, with this CL, you can do the following steps to get a standalone desugarer binary: 1. git clone https://github.com/bazelbuild/bazel 2. bazel build //src/tools/android/java/com/google/devtools/build/android/desugar:desugar_bin_deploy.jar 3. cp bazel-bin/src/tools/android/java/com/google/devtools/build/android/desugar/desugar_bin_deploy.jar ~/bin/desugar.jar And then you can invoke desugar without bazel with `java -jar ~/bin/desugar.jar`. https://github.com/bazelbuild/bazel/issues/2975 RELNOTES: None PiperOrigin-RevId: 155629711
* Allow android compilations to use type annotationsGravatar cushon2017-05-08
| | | | PiperOrigin-RevId: 155287620
* Add compile_jars for Skylark to JavaProviderGravatar Stephen Twigg2017-05-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add compile_jars Skylark accessor to JavaProvider. This outputs the non-recursive set of jars needed to build with this target. Allows Skylark tools to get the same set of compile_jars that JavaLibrary is getting. Added test that verifies Skylark was getting lists from both compile_jars and transitive_runtime_jars of the expected length. Then, verified (via test code) those nested sets were identical to the ones provided by the java_library. To reviewers: First, would like to add documentation flags to these fields in JavaProvider. Is it possible, instead of adding them to this map to follow use the @SkylarkCallable annotation to expose methods on JavaProvider instead? It would then also be nice to mark these as experimental since won't really know the final API until java_skylark_library sandwich is done. I also tested this locally via bazel build //src:bazel and then doing ~/bazelsandbox/bazel/bazel-bin/src/bazel test SomeTarget in a different repo that had a .bzl file trying to use compile_jars. Change-Id: I1779c1b6303f36e50076c3479bfcb15a25aa95d8 PiperOrigin-RevId: 155191816
* Improve error message when building Android rules without an SDK.Gravatar ajmichael2017-05-05
| | | | | | | | | | | | | | | | | | | | Fixes https://github.com/bazelbuild/bazel/issues/509. Example output: ``` $ bazel build //:all INFO: Found 1 target... ERROR: /usr/local/google/home/ajmichael/.cache/bazel/_bazel_ajmichael/7fcc7480abc634522e5c0cfe6b85b583/external/bazel_tools/tools/android/BUILD:236:1: Executing genrule @bazel_tools//tools/android:no_android_sdk_repository_error failed: Process exited with status 1 [sandboxed]. This build requires an Android SDK. Please add the android_sdk_repository rule to your WORKSPACE. Use --strategy=Genrule=standalone to disable sandboxing for the failing actions. Target //:lib failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 0.327s, Critical Path: 0.10s ``` RELNOTES: Attempting to build an Android target without setting up android_sdk_repository will now produce a helpful error message. PiperOrigin-RevId: 155158667
* Stop using zip and unzip in android shell tests.Gravatar ajmichael2017-05-04
| | | | | | | Also, open source two more tests. RELNOTES: None PiperOrigin-RevId: 155129416
* Expose Bazel's Android data binding support to users.Gravatar gregce2017-04-18
| | | | | | | | | | | | The logic is already in Bazel but wasn't available to build rules. This change makes it available, but still requires data binding's {build|run}time libraries to be checked into appropriate depot spots for everything to work. Followup changes will make those libraries easily available. Issue: #2694 PiperOrigin-RevId: 153359861
* Make android_sdk_repository generate filegroups containing system image ↵Gravatar ajmichael2017-04-12
| | | | | | | | | | | | | | | | | | files for all android system images installed in the SDK. For system images that are not installed, create genrule "poison pills" that print a helpful error message if you attempt to build them. These filegroups are intended to be used as the system_image attribute of the android_device rule. Example: $ bazel build @android_test_support//tools/android/emulated_devices/pixel:android_25_x86 Extracting Bazel installation... . INFO: Found 1 target... ERROR: /usr/local/google/home/ajmichael/.cache/bazel/_bazel_ajmichael/efa32264346ef1fc4fec492202b88b31/external/androidsdk/BUILD.bazel:56:1: Executing genrule @androidsdk//:emulator_images_android_25_x86 failed: Process exited with status 1 [sandboxed]. This rule requires that the Android SDK used by Bazel has the following system image installed: emulator_images_android_25_x86. Please install this system image through the Android SDK Manager and try again. RELNOTES: None PiperOrigin-RevId: 152889824
* Remove apkbuilder from Bazel's android_sdk.Gravatar ajmichael2017-04-06
| | | | | | RELNOTES: None PiperOrigin-RevId: 152292294
* Remove jack tools from Bazel.Gravatar ajmichael2017-04-05
| | | | | | | | #1391 RELNOTES: None PiperOrigin-RevId: 152179305
* Make mobile-install wait for debuggerGravatar Googler2017-03-17
| | | | | | -- PiperOrigin-RevId: 150372383 MOS_MIGRATED_REVID=150372383
* Rollback of commit adf051ead3b747081639600fb4a9e043a798b2df.Gravatar Googler2017-03-16
| | | | | | | | | | | | | | | *** Reason for rollback *** this flag isn't needed with unknown commit *** Original change description *** Add --activity_name_file flag and modify --start flag in incremental_install. This is a first step to add the ability for mobile-install to wait for the debugger before starting the app. -- PiperOrigin-RevId: 150340712 MOS_MIGRATED_REVID=150340712
* Replace all instances of org_unified_launcher with android_test_support.Gravatar Adam Michael2017-03-16
| | | | | | -- PiperOrigin-RevId: 150194430 MOS_MIGRATED_REVID=150194430
* Add emulator_images_%s filegroups for Bazel Android devices.Gravatar Adam Michael2017-03-15
| | | | | | | | A previous change added this filegroup with the name %s_files. Recent discussions have suggested changing the naming convention to be a prefix instead before it is too late. -- PiperOrigin-RevId: 150117207 MOS_MIGRATED_REVID=150117207
* Add --activity_name_file flag and modify --start flag in ↵Gravatar Googler2017-03-14
| | | | | | | | | | incremental_install. This is a first step to add the ability for mobile-install to wait for the debugger before starting the app. -- PiperOrigin-RevId: 149897848 MOS_MIGRATED_REVID=149897848
* Improve AndroidSdkRepositoryTest.Gravatar Adam Michael2017-02-20
| | | | | | | | | | Also, remove some tests from android_integration_test.sh that are now covered by AndroidSdkRepositoryTest. This should hopefully reduce breakages of android_integration_test.sh that are not caught until the change makes its way to Jenkins. I haven't yet figured out how to move the environment variable settings tests into AndroidSdkRepositoryTest. -- PiperOrigin-RevId: 147864723 MOS_MIGRATED_REVID=147864723
* Make android_device pass --android_sdk_path to unified launcher.Gravatar Adam Michael2017-02-14
| | | | | | | | Creates filegroup containing sdk path in Bazel embedded Android SDK repository. -- PiperOrigin-RevId: 147426838 MOS_MIGRATED_REVID=147426838
* gen_java_lang_invoke_jar should not use java from $PATH.Gravatar Adam Michael2017-02-13
| | | | | | | | | | This caused a failure in http://ci.bazel.io/job/Gerrit-bazel-tests/368/BAZEL_VERSION=latest,PLATFORM_NAME=ubuntu_15.10-x86_64/console where the genrule used java from a jdk7 instead of a jdk8. -- PiperOrigin-RevId: 147198518 MOS_MIGRATED_REVID=147198518
* Open source java 8 desugarer.Gravatar Adam Michael2017-02-10
| | | | | | | | | | Fixes https://github.com/bazelbuild/bazel/issues/2222. RELNOTES: Support for Java 8 lambdas, method references, type annotations and repeated annotations in Android builds with --experimental_desugar_for_android. -- PiperOrigin-RevId: 147109786 MOS_MIGRATED_REVID=147109786
* Rollback of commit 602a98cbebeff2ba1c2d8605a9552b2c8f5622ae.Gravatar Googler2017-02-09
| | | | | | | | | | | | | | | | *** Reason for rollback *** Rolling forward with fixes for the incremental tool. *** Original change description *** Automated [] rollback of commit d11d510c571b10787856395709f9ad945ca70bb2. *** Reason for rollback *** -- PiperOrigin-RevId: 146940409 MOS_MIGRATED_REVID=146940409
* Rollback of commit d11d510c571b10787856395709f9ad945ca70bb2.Gravatar Alex Humesky2017-02-08
| | | | | | | | *** Reason for rollback *** -- PiperOrigin-RevId: 146820790 MOS_MIGRATED_REVID=146820790
* Move all the resource processing tools into a "busybox".Gravatar Googler2017-02-08
| | | | | | | | | This makes the code simpler as well as reducing the number of targets to build. It also makes testing and profiling different action strategies vastly easier. -- PiperOrigin-RevId: 146812659 MOS_MIGRATED_REVID=146812659
* Add emulator shared libs to android_device launcher runfiles.Gravatar Adam Michael2017-02-02
| | | | | | -- PiperOrigin-RevId: 146300001 MOS_MIGRATED_REVID=146300001
* Rollback of commit 932d1abfa34267a9e5abc7441c9e2a081beedd85.Gravatar Adam Michael2017-02-02
| | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Rollforward with fixes and a test. Previously AndroidSdkRepository required that system-images/ directory exist in the Android SDK. However, it does not exist until you download the first system image. *** Original change description *** Automated [] rollback of commit 06072c557290b97cb2d2e4fd255b647a9208cb5c. *** Reason for rollback *** Broke andriod_sdk_repository on ci.bazel.io See https://github.com/bazelbuild/bazel/issues/2465 *** Original change description *** Make android_sdk_repository discover all system-images directories in the sdk. This will be used by the upcoming android_device rule that launches emulators. -- PiperOrigin-RevId: 146258003 MOS_MIGRATED_REVID=146258003
* Rollback of commit 06072c557290b97cb2d2e4fd255b647a9208cb5c.Gravatar Yun Peng2017-02-01
| | | | | | | | | | | | | | | | | *** Reason for rollback *** Broke andriod_sdk_repository on ci.bazel.io See https://github.com/bazelbuild/bazel/issues/2465 *** Original change description *** Make android_sdk_repository discover all system-images directories in the sdk. This will be used by the upcoming android_device rule that launches emulators. -- PiperOrigin-RevId: 146235800 MOS_MIGRATED_REVID=146235800
* Make android_sdk_repository discover all system-images directories in the sdk.Gravatar Adam Michael2017-02-01
| | | | | | | | This will be used by the upcoming android_device rule that launches emulators. -- PiperOrigin-RevId: 146183077 MOS_MIGRATED_REVID=146183077
* Make the Bazel unified launcher alias point to unified_launcher_head.Gravatar Adam Michael2017-02-01
| | | | | | -- PiperOrigin-RevId: 146142811 MOS_MIGRATED_REVID=146142811
* Create aliases for tools for upcoming android_device rule.Gravatar Adam Michael2017-01-27
| | | | | | | | Note that these aliases are intentionally not yet functional. Nothing should be trying to build them. -- PiperOrigin-RevId: 145746166 MOS_MIGRATED_REVID=145746166
* Fix build_split_manifest.py to not include the versionCode or versionNameGravatar Alex Humesky2017-01-27
| | | | | | | | attributes if they aren't present in the original manifest. Before, it would make them None, and aapt would fail. -- PiperOrigin-RevId: 145726642 MOS_MIGRATED_REVID=145726642
* Don't bundle android tests into the Bazel binary.Gravatar Adam Michael2017-01-20
| | | | | | | | Saves 12kB! :) -- PiperOrigin-RevId: 144997917 MOS_MIGRATED_REVID=144997917
* Make android_sdk_repository create one android_sdk per api level in the SDK.Gravatar Adam Michael2017-01-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | api_level is no longer required. It now sets the default android_sdk that is used if the --android_sdk flag is not passed. If it is not set, the highest api_level will be used as the default. The new behavior is demonstrated by the following example: $ ls $ANDROID_HOME/platforms android-21 android-22 android-23 $ cat WORKSPACE android_sdk_repository( name = "foo", ) $ bazel build //java/my/app # uses api level 23 $ bazel build --android_sdk=@foo//:sdk-22 //java/my/app # uses api level 22 $ cat > WORKSPACE <<EOF android_sdk_repository( name = "foo", api_level = 21, ) EOF $ bazel build //java/my/app # uses api level 21 $ bazel build --android_sdk=@foo//:sdk-23 //java/my/app # uses api level 23 See https://github.com/bazelbuild/bazel/issues/2284 for the master plan for android_sdk_repository. RELNOTES: android_sdk_repository no longer requires api_level. If one is not specified, the highest android platform installed will be used. Furthermore, android_sdk's are created for all android platforms installed and can be specified with the --android_sdk flag. -- PiperOrigin-RevId: 144258881 MOS_MIGRATED_REVID=144258881
* Remove filegroups in tools/android/BUILD.tools in favor of aliases.Gravatar Adam Michael2017-01-09
| | | | | | -- PiperOrigin-RevId: 143825037 MOS_MIGRATED_REVID=143825037
* Split tools/android/BUILD into BUILD and BUILD.tools.Gravatar Adam Michael2017-01-05
| | | | | | | | | | | | | | This should help clear up the confusion that caused https://github.com/bazelbuild/bazel/issues/2283. Now all of the following work: bazel build //tools/android/... bazel test //tools/android/... bazel build @bazel_tools//tools/android/... -- PiperOrigin-RevId: 143666995 MOS_MIGRATED_REVID=143666995