Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unbundle mobile tools #1055

Closed
ulfjack opened this issue Mar 17, 2016 · 13 comments
Closed

Unbundle mobile tools #1055

ulfjack opened this issue Mar 17, 2016 · 13 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) team-Android Issues for Android team type: process

Comments

@ulfjack
Copy link
Contributor

ulfjack commented Mar 17, 2016

We're about to add another tool for Android builds to do sharded dex compilation, and that depends on having an Android SDK available. If we put it into @bazel_tools, then we'd implicitly require every user of Bazel to also have an Android SDK, whether they work with Android or not.

After talking to @ahumesky and others, it seems to me that the right solution is to unbundle the Android tools - all of them. This requires that all devs who work with Android now also need to depend on the android tools repository (@android_tools?), but that's better than the alternative.

I think we have to do this before we can declare a 1.0, and if we want to ship further improvements to Android builds, sooner rather than later.

@ulfjack ulfjack added P1 I'll work on this now. (Assignee required) Mobile type: process labels Mar 17, 2016
@ulfjack
Copy link
Contributor Author

ulfjack commented Mar 17, 2016

@lberki @damienmg

@damienmg
Copy link
Contributor

SGTM we used to have it.

We could take the opportunity to put that android tooling outside of bazel completely and people would just fetch it when declaring a android_sdk_repository

@lberki
Copy link
Contributor

lberki commented Mar 18, 2016

LGTM. This is probably the sanest solution of them all.

We should also unbundle the tools for other languages. Linux users won't find j2objc and objc very useful.

@aragos

@helenalt
Copy link
Contributor

@ahumesky is this still in progress (and P1)?

@ahumesky
Copy link
Contributor

Yes, for example we've put the tools for android_device and android_instrumentation_test in separate repositories. We're moving the rest of the rules to skylark, and once those are ready we'll move the tooling out of bazel.

@aiuto aiuto added team-Android Issues for Android team and removed category: misc > release / binary labels Dec 10, 2018
@ahumesky ahumesky added P2 We'll consider working on this in future. (Assignee optional) and removed P1 I'll work on this now. (Assignee required) labels Dec 11, 2018
@meisterT
Copy link
Member

meisterT commented Feb 4, 2019

You can already move the tooling out while the rules are still native. @iirina is doing the same currently for the Java rules.

@meisterT
Copy link
Member

@iirina is done with the changes for the java tools (next to other improvements) and we are now below 100 MB on all platforms. Looking what to do next to improve binary size, this bug is the next logical step.

These are the biggest files in the bazel binary:

   388Ki process-wrapper
   395Ki linux-sandbox
   452Ki embedded_tools/tools/jdk/singlejar/singlejar
   761Ki embedded_tools/third_party/java/proguard/proguard5.3.3/lib/proguard.jar
   934Ki embedded_tools/tools/android/desugar_jdk_libs.jar
   3.3Mi embedded_tools/jdk/lib/ct.sym
   3.8Mi embedded_tools/tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator/all_lcov_merger_tools_deploy.jar
   5.7Mi embedded_tools/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/ImportDepsChecker_deploy.jar
   7.2Mi embedded_tools/jdk/lib/server/libjvm.so
   11Mi embedded_tools/src/tools/android/java/com/google/devtools/build/android/all_android_tools_deploy.jar
   18Mi embedded_tools/jdk/lib/modules
   35Mi A-server.jar

Side note: out of the modules file, ~10MB is the java.desktop module which is necessary for android_sdk_repository (and maven_jar which already is on the way out, see #6799).

So with unbundling the android tools we could save ~28MB of the binary size (~30%).

@jin
Copy link
Member

jin commented Feb 21, 2019

What exactly is the dep from android_sdk_repository to java.desktop? I'm not familiar with how Java modules work.

@meisterT
Copy link
Member

I filed #7502 as a separate issue for the desktop dependency.

@jin
Copy link
Member

jin commented Mar 14, 2019

Taking a stab at this.

@jin jin added P1 I'll work on this now. (Assignee required) and removed P2 We'll consider working on this in future. (Assignee optional) labels Mar 15, 2019
@jin
Copy link
Member

jin commented Mar 29, 2019

Together with -c opt and unbundling ImportDepsChecker and all_android_tools_deploy.jar:

$ ls -l --block-size=M bazel-bin/src/bazel
-r-xr-xr-x 1 jingwen primarygroup 74M Mar 29 13:20 bazel-bin/src/bazel

@jin
Copy link
Member

jin commented Apr 2, 2019

Re-opening this, the CL just unbundled some of the Android tools. The Android rules and tools are not completely out of the Bazel source yet.

@jin jin reopened this Apr 2, 2019
@jin
Copy link
Member

jin commented Apr 28, 2019

The following Android tools have been removed from the binary:

   934Ki embedded_tools/tools/android/desugar_jdk_libs.jar
   5.7Mi embedded_tools/src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps/ImportDepsChecker_deploy.jar
   11Mi embedded_tools/src/tools/android/java/com/google/devtools/build/android/all_android_tools_deploy.jar

@jin jin closed this as completed Apr 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) team-Android Issues for Android team type: process
Projects
None yet
Development

No branches or pull requests

8 participants