Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Issue 269943005: Add android_library template (Closed)

Created:
6 years, 7 months ago by cjhopman
Modified:
6 years, 5 months ago
Reviewers:
Nico, brettw
CC:
chromium-reviews, tfarina, bulach+watch_chromium.org, yfriedman+watch_chromium.org, ilevy-cc_chromium.org, klundberg+watch_chromium.org, erikwright+watch_chromium.org
Visibility:
Public.

Description

Add android_library template and build_configs This is the GN equivalent of build/java.gypi. It is a template for creating an Android library including java code and Android resources. It currently only compiles java files (including files in srcjars from srcjar targets like java_cpp_template) and zips them together in a .jar and creates the corresponding .jar.TOC. Some of the things still to do: proguard_preprocess, android_lint, emma coverage, dex, everything resources. Adds android_java_library rule for base_java, guava, and jsr-305. This add the --java-srcjars argument to javac.py. This will accept a .zip of .java files and include those files in the compilation. This approach is preferred over using the --src-gendirs option. Many of the parts of building Android stuff (libraries, resources, apks) require knowledge of the dependents of that thing. Examples: javac classpath, for resources aapt needs to know about all dependents, dexing for an apk needs to know about all java code going into that apk. For gyp, this is done primarily with all_dependent_settings. There is then some of this logic in two particular steps (dexing and proguard). These steps, when building an instrumentation apk, need to exclude the things in the tested apk and this is done by having the tested apk essentially write a file saying what it did in those steps and the test apk reading that file and excluding stuff. In GN, all_dependent_settings doesn't really work. This change introduces a new way of calculating and using this information. Specifically .build_config files and build_utils.ExpandFileArgs(). The build_config file for a target contains the information that depends on dependents. The logic in write_build_config and the logic in the template specification are very much tied together (in some sense, write_build_config is just the part of the template specification that can actually inspect the dependency graph). With build_utils.ExpandFileArgs() all the other build scripts are essentially unaware of the .build_config files and can just be written in a (mostly) straightforward way. A large part of the information calculated by the build_config is finding input files to later actions. This requires that those later actions writes a depfile that contains any inputs that are specified by the build_config (in the case of this change, javac and the classpath files). Since a action's script shouldn't really know about the build_config file and what information it got from that, it is safest for the action to write *all* of its inputs into the depfile (but to be correct it only has to write those that aren't explicitly specified in the build files). Depends on: https://codereview.chromium.org/341823003/ BUG=359249 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=280995

Patch Set 1 : #

Total comments: 46

Patch Set 2 : #

Patch Set 3 : Big changes. #

Patch Set 4 : Little changes #

Patch Set 5 : #

Total comments: 6

Patch Set 6 : Rebase + address comments #

Total comments: 9

Patch Set 7 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+984 lines, -33 lines) Patch
M base/BUILD.gn View 1 2 3 4 5 2 chunks +56 lines, -2 lines 0 comments Download
M build/android/gyp/jar_toc.py View 1 2 2 chunks +3 lines, -1 line 0 comments Download
M build/android/gyp/javac.py View 1 2 3 4 5 4 chunks +51 lines, -20 lines 0 comments Download
M build/android/gyp/util/build_utils.py View 1 2 3 4 5 chunks +51 lines, -0 lines 0 comments Download
A build/android/gyp/write_build_config.py View 1 2 3 4 5 1 chunk +94 lines, -0 lines 0 comments Download
M build/config/android/config.gni View 1 2 3 4 5 2 chunks +5 lines, -1 line 0 comments Download
M build/config/android/internal_rules.gni View 1 2 3 4 5 6 3 chunks +211 lines, -4 lines 0 comments Download
M build/config/android/rules.gni View 1 2 3 4 5 6 4 chunks +73 lines, -5 lines 0 comments Download
A third_party/guava/BUILD.gn View 1 2 1 chunk +403 lines, -0 lines 0 comments Download
A third_party/jsr-305/BUILD.gn View 1 chunk +37 lines, -0 lines 0 comments Download

Messages

Total messages: 18 (0 generated)
cjhopman
thakis: *
6 years, 7 months ago (2014-05-05 20:49:53 UTC) #1
Nico
(more to come) https://codereview.chromium.org/269943005/diff/20001/build/android/gn/javac.py File build/android/gn/javac.py (right): https://codereview.chromium.org/269943005/diff/20001/build/android/gn/javac.py#newcode35 build/android/gn/javac.py:35: build_utils.WriteDepfile(options.depfile, I don't see this checked ...
6 years, 7 months ago (2014-05-05 21:56:45 UTC) #2
cjhopman
On 2014/05/05 21:56:45, Nico wrote: > (more to come) > > https://codereview.chromium.org/269943005/diff/20001/build/android/gn/javac.py > File build/android/gn/javac.py ...
6 years, 7 months ago (2014-05-05 22:04:25 UTC) #3
cjhopman
This time actually replying to the comments. https://codereview.chromium.org/269943005/diff/20001/build/android/gn/javac.py File build/android/gn/javac.py (right): https://codereview.chromium.org/269943005/diff/20001/build/android/gn/javac.py#newcode35 build/android/gn/javac.py:35: build_utils.WriteDepfile(options.depfile, On ...
6 years, 7 months ago (2014-05-05 22:05:18 UTC) #4
Nico
(more to come) https://codereview.chromium.org/269943005/diff/20001/build/android/gyp/jar.py File build/android/gyp/jar.py (right): https://codereview.chromium.org/269943005/diff/20001/build/android/gyp/jar.py#newcode15 build/android/gyp/jar.py:15: def Jar(class_files, classes_dir, jar_path): docstring https://codereview.chromium.org/269943005/diff/20001/build/android/gyp/jar.py#newcode36 ...
6 years, 7 months ago (2014-05-05 22:08:10 UTC) #5
Nico
(more to come) build/rules/android.gni is empty, is that intentional?
6 years, 7 months ago (2014-05-05 22:08:30 UTC) #6
Nico
(one file left) https://codereview.chromium.org/269943005/diff/20001/build/config/android/internal_rules.gni File build/config/android/internal_rules.gni (right): https://codereview.chromium.org/269943005/diff/20001/build/config/android/internal_rules.gni#newcode51 build/config/android/internal_rules.gni:51: chromium_code = invoker.chromium_code + 0 Why ...
6 years, 7 months ago (2014-05-05 22:17:50 UTC) #7
Nico
https://codereview.chromium.org/269943005/diff/20001/build/android/gn/javac.py File build/android/gn/javac.py (right): https://codereview.chromium.org/269943005/diff/20001/build/android/gn/javac.py#newcode14 build/android/gn/javac.py:14: sys.path.append(BUILD_ANDROID_DIR) This is defined in build/android/pylib/constants.py too https://codereview.chromium.org/269943005/diff/20001/build/android/gn/javac.py#newcode38 build/android/gn/javac.py:38: ...
6 years, 7 months ago (2014-05-05 22:26:14 UTC) #8
cjhopman
Finally getting back to this. Nico, let me know if I should find another reviewer ...
6 years, 6 months ago (2014-06-25 01:20:04 UTC) #9
cjhopman
Oh, also. This is a big change in how this is being done. I've updated ...
6 years, 6 months ago (2014-06-25 01:20:32 UTC) #10
Nico
It's build-related, so I'll look at it. Ping me if I haven't replied by 2pm ...
6 years, 6 months ago (2014-06-25 01:22:06 UTC) #11
Nico
lgtm I like the .build_config thing. Maybe Brett has an opinion on gn files writing ...
6 years, 5 months ago (2014-07-01 18:24:51 UTC) #12
cjhopman
brettw, ptal at build/config for OWNERS https://codereview.chromium.org/269943005/diff/130001/build/android/gyp/javac.py File build/android/gyp/javac.py (right): https://codereview.chromium.org/269943005/diff/130001/build/android/gyp/javac.py#newcode128 build/android/gyp/javac.py:128: callback=lambda _1, _2, ...
6 years, 5 months ago (2014-07-01 22:14:02 UTC) #13
brettw
.gn stuff lgtm https://codereview.chromium.org/269943005/diff/150001/base/BUILD.gn File base/BUILD.gn (right): https://codereview.chromium.org/269943005/diff/150001/base/BUILD.gn#newcode1333 base/BUILD.gn:1333: android_library("base_java") { Looks pretty! https://codereview.chromium.org/269943005/diff/150001/build/config/android/internal_rules.gni File ...
6 years, 5 months ago (2014-07-02 00:23:29 UTC) #14
cjhopman
https://codereview.chromium.org/269943005/diff/150001/build/config/android/internal_rules.gni File build/config/android/internal_rules.gni (right): https://codereview.chromium.org/269943005/diff/150001/build/config/android/internal_rules.gni#newcode1 build/config/android/internal_rules.gni:1: import("config.gni") On 2014/07/02 00:23:28, brettw wrote: > Need copyright. ...
6 years, 5 months ago (2014-07-02 02:36:50 UTC) #15
cjhopman
The CQ bit was checked by cjhopman@chromium.org
6 years, 5 months ago (2014-07-02 02:36:54 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/cjhopman@chromium.org/269943005/190001
6 years, 5 months ago (2014-07-02 02:37:51 UTC) #17
commit-bot: I haz the power
6 years, 5 months ago (2014-07-02 10:46:52 UTC) #18
Message was sent while issue was closed.
Change committed as 280995

Powered by Google App Engine
This is Rietveld 408576698