Non-android scripts use these helpers, so this moves them
outside of the //build/android directory.
This also modifies the helpers in the following ways:
* Renamed them.
* Added more assert checks about valid paths
* Fixed zip_directory() adding \s instead of /s on windows
* Merged in zipalign logic
* Changed compress_fn -> compress= (was unused)
* Do not call atomic_output from zip_directory()
* Updated all callers to do so explicitly.
Bug: 1428082
Change-Id: I9ad5df6cc2491efb974bc914ddbcc6d9de2d4657
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4386354
Reviewed-by: Sam Maier <smaier@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Owners-Override: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1124879}
As a temporary fix for android webview regression b/157318961 this cl
rolls back the protobuf lite runtime to 3.0.1 using the codegen plugin.
Binary-Size: This is temporary and there is not really much we could do.
Bug: 1093059, b/157318961
Change-Id: I2bbaf6d3b434221b667901423c4616e26a7550c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2238872
Reviewed-by: Dan H <harringtond@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#777495}
This rolls in the new version 3.11.4 of the protobuf javalite runtime.
The package name changed so this also fixes all references in gn files.
A similar internal commit exists at crrev.com/i/1676922
This also changes how protoc is called to ask for the java lite runtime.
The protoc javalite code gen plugin is no longer needed and will be
removed in a followup cl.
but reduces them per generated proto.
Binary-Size: new runtime increases the number of methods in the runtime
Bug: 988512
Change-Id: I8dd2ba97badea0b7dbaa8282afeb1da40636aee5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1762684
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Peter Wen <wnwen@chromium.org>
Reviewed-by: John Budorick <jbudorick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747540}
protoc the protobuf compiler now requires using a separate plugin for
compiling protos for the java lite runtime. The lite java runtime is now
also separate from the main java runtime and is distributed separately.
This cl switches java proto compilation for lite protos to this new
mode.
TBR=android_webview/BUILD.gn
Bug: 782237, 800281
Change-Id: I31c2d073bed51109dffeea133495679deef3186b
Reviewed-on: https://chromium-review.googlesource.com/c/1340522
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Reviewed-by: Pavel Yatsuk <pavely@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Reviewed-by: Peter Wen <wnwen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612720}
NOTE: This is a reland of the following CL which was reverted:
https://chromium-review.googlesource.com/c/chromium/src/+/1131190
The revert was due to a problem with an internal clank/DEPS runhooks
step that calls jinja_template.py (see BUG entry below for details).
The new CL was checking inputs by defaults, which would raise an
error during gclient sync.
To ease review, the first CL on gerrit is the original one,
unmodified, and the second fixes the issue.
---- end of NOTE ------
ProTip: start by looking at the action_with_pydefps() definition
in internal_rules.gni to review changes in this CL.
This CL tries to make "gn analyze" smarter by ensuring that
it knows about Python module dependencies, for any python
script under //build.
At the moment, these dependencies are computed by
build_utils.WriteDepFile() automatically (unless the
add_pydeps=False argument is passed). This adds all imported
module paths to the generated .d file written by the script.
Unfortunately, because this .d file is generated by the
actions, the corresponding Python sources are not part of
the target's inputs, known by GN at parse time, and thus do
not appear in "gn analyze" properly.
This CL tries to solve the problem by adding a new template
named "action_with_pydeps", which acts as "action", but also
expects a foo.pydeps file for every foo.py invoked through
the 'script' scope variable.
This '.pydeps' file is read directly at GN parse time and
added to the action's target inputs.
These .pydeps contain the path of each imported module, one
per line, and are generated with build/print_python_deps.py
Benchmarking shows no significant difference in the time
taken to perform a "gn gen out/Release" on a full Chrome
for Android checkout.
This also needs a PRESUBMIT.py step that ensures that all .pydeps
files are up-to-date with regards to their corresponding .py source
files (this can be done with 'gen_pydeps.py --check .../foo.py')
+ Remove some --depfile options on a few Python scripts that
don't need it anymore (e.g. when their inputs and outputs
are now fully known by GN at parse time).
+ Remove uses of compute_inputs_for_analyze in rules.gni and
internal_rules.gni (as well as exec_script() calls to
print_python_deps.py). Note that the variable itself is still
needed for grit inputs, see tools/grit/grit_rule.gni for
details).
BUG=870845,843562
R=agrieve@chromium.org, estevenson@chromium.org
Change-Id: Id1f606a0c9df9e4e8971fd885ac0394103ca7b03
Reviewed-on: https://chromium-review.googlesource.com/1163512
Reviewed-by: agrieve <agrieve@chromium.org>
Reviewed-by: Eric Stevenson <estevenson@chromium.org>
Commit-Queue: David Turner <digit@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581158}
This reverts commit df2048be14.
Reason for revert: Causing gclient sync failures https://crbug.com/870845
Original change's description:
> android: build: Use .pydeps file to store Python dependencies.
>
> ProTip: start by looking at the pythonic_action() definition
> in internal_rules.gni to review changes in this CL.
>
> This CL tries to make "gn analyze" smarter by ensuring that
> it knows about Python module dependencies, for any python
> script under //build.
>
> At the moment, these dependencies are computed by
> build_utils.WriteDepFile() automatically (unless the
> add_pydeps=False argument is passed). This adds all imported
> module paths to the generated .d file written by the script.
>
> Unfortunately, because this .d file is generated by the
> actions, the corresponding Python sources are not part of
> the target's inputs, known by GN at parse time, and thus do
> not appear in "gn analyze" properly.
>
> This CL tries to solve the problem by adding a new template
> named "action_with_pydeps", which acts as "action", but also
> expects a foo.pydeps file for every foo.py invoked through
> the 'script' scope variable.
>
> This '.pydeps' file is read directly at GN parse time and
> added to the action's target inputs.
>
> These .pydeps contain the path of each imported module, one
> per line, and are generated with build/print_python_deps.py
>
> Benchmarking shows no significant difference in the time
> taken to perform a "gn gen out/Release" on a full Chrome
> for Android checkout.
>
> + Add --inplace option to print_python_deps.py in order to
> make its usage more human-friendly (the new mode cannot
> become the default because PRESUBMIT.py depends on the
> current behaviour).
>
> + Remove some --depfile options on a few Python scripts that
> don't need it anymore (e.g. when their inputs and outputs
> are now fully known by GN at parse time).
>
> + Remove uses of compute_inputs_for_analyze in rules.gni and
> internal_rules.gni (as well as exec_script() calls to
> print_python_deps.py). Note that the variable itself is still
> needed for grit inputs, see tools/grit/grit_rule.gni for
> details).
>
> BUG=NONE
> R=agrieve@chromium.org
>
> Change-Id: I8d7c07ab93b032fdc0c7f9dbeb2173767f52eeff
> Reviewed-on: https://chromium-review.googlesource.com/1131190
> Commit-Queue: David Turner <digit@chromium.org>
> Reviewed-by: agrieve <agrieve@chromium.org>
> Reviewed-by: Eric Stevenson <estevenson@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#580545}
TBR=digit@chromium.org,agrieve@chromium.org,estevenson@chromium.org
Change-Id: I626eb8997c8808fc91aec9115287be34d17d493e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: NONE
Reviewed-on: https://chromium-review.googlesource.com/1162522
Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580639}
ProTip: start by looking at the pythonic_action() definition
in internal_rules.gni to review changes in this CL.
This CL tries to make "gn analyze" smarter by ensuring that
it knows about Python module dependencies, for any python
script under //build.
At the moment, these dependencies are computed by
build_utils.WriteDepFile() automatically (unless the
add_pydeps=False argument is passed). This adds all imported
module paths to the generated .d file written by the script.
Unfortunately, because this .d file is generated by the
actions, the corresponding Python sources are not part of
the target's inputs, known by GN at parse time, and thus do
not appear in "gn analyze" properly.
This CL tries to solve the problem by adding a new template
named "action_with_pydeps", which acts as "action", but also
expects a foo.pydeps file for every foo.py invoked through
the 'script' scope variable.
This '.pydeps' file is read directly at GN parse time and
added to the action's target inputs.
These .pydeps contain the path of each imported module, one
per line, and are generated with build/print_python_deps.py
Benchmarking shows no significant difference in the time
taken to perform a "gn gen out/Release" on a full Chrome
for Android checkout.
+ Add --inplace option to print_python_deps.py in order to
make its usage more human-friendly (the new mode cannot
become the default because PRESUBMIT.py depends on the
current behaviour).
+ Remove some --depfile options on a few Python scripts that
don't need it anymore (e.g. when their inputs and outputs
are now fully known by GN at parse time).
+ Remove uses of compute_inputs_for_analyze in rules.gni and
internal_rules.gni (as well as exec_script() calls to
print_python_deps.py). Note that the variable itself is still
needed for grit inputs, see tools/grit/grit_rule.gni for
details).
BUG=NONE
R=agrieve@chromium.org
Change-Id: I8d7c07ab93b032fdc0c7f9dbeb2173767f52eeff
Reviewed-on: https://chromium-review.googlesource.com/1131190
Commit-Queue: David Turner <digit@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Reviewed-by: Eric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580545}
This CL takes the (almost) last step in converting java code from
protobuf nano to lite. The only remaining code with nano is
//third_party/cacheinvalidation which is deprecated and should be
replaced later this year.
We still need to keep the generate_lite variable in rules.gni because
it is used in the internal repo. After this CL, I will
- remove instances of generate_lite from the internal repo and finally
- remove generate_lite from rules.gni.
Bug: 782237
Change-Id: I65f144c59d84e8c75fe3152543c6e1941e52a3dd
Reviewed-on: https://chromium-review.googlesource.com/998033
Reviewed-by: Pavel Yatsuk <pavely@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Commit-Queue: Jan Krcal <jkrcal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549129}
Lite is the new preferred proto runtime on Android, for two reasons:
- It lends itself to better proguard optimizing
- There is only one flavor, so there is no risk in including
proto libraries with overlapping definitions that use different
flavors
This CL adds a generate_nano argument to the proto_java_library build
rule. This argument is default false, so new proto libraries will use
lite by default. However, existing libraries will be migrated in a
follow-up CL, so this change sets generate_nano to true for those
libraries.
It also adds the android_library rule that contains the runtime
library for lite protos.
For an example conversion CL for a proto target, see:
https://chromium-review.googlesource.com/c/chromium/src/+/757103
Bug: 782237
Change-Id: I8100e70c38d41add9068e493ca2a5822f7025213
Reviewed-on: https://chromium-review.googlesource.com/757134
Commit-Queue: agrieve <agrieve@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Reviewed-by: Doug Steedman <dougsteed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517268}
Ninja complains with:
expected depfile 'foo.d' to mention 'bar', got 'baz'
Running ninja twice now reports "no work to do" again.
This change required updating all calls to build_utils.WriteDepFile() so
that the output is passed in. While doing this, I also made the helper
add in GetPythonDependencies() by default.
build/android/gyp/ant.py I just deleted rather than updating since it's
GYP-only.
BUG=646165
Review-Url: https://codereview.chromium.org/2336173003
Cr-Commit-Position: refs/heads/master@{#418455}
This adds a pretty straightforward gn template corresponding to
protoc_java.gypi.
protoc_java.py is updated to actually parse options instead of just
using positional arguments.
Adds cacheinvalidation targets.
TBR=brettw, zea
BUG=359249
Review URL: https://codereview.chromium.org/580343002
Cr-Commit-Position: refs/heads/master@{#297739}
This CL adds a new dependency on the protocol buffer compiler
from the android source tree, since this compiler supports
generating Java files using the nano runtime.
The initial version of this dependency is 2.2.0a, but checked
out as what the Android 4.4.4 Release 2.0.1 tag points to.
This CL adds a new protoc binary (for compiling protos) that supports
this, and also adds a Java library with the runtime.
To simplify use of this, it also updates build/protoc_java.gypi to
support generating nano protos by specifying an optional
proto_runtime argument. The argument defaults to 'lite' which does
the same thing as before this change, and setting it to 'nano'
generates the new style Java files.
The plan is to quickly deprecate the 'lite' runtime for Java, since
it is too big and uses too many methods.
TBR=darin@chromium.org,cjhopman@chromium.org
BUG=377891,410067
Review URL: https://codereview.chromium.org/532303003
Cr-Commit-Position: refs/heads/master@{#293236}
Reason for revert:
Breaks some workflows and also should get new quota.
Original issue's description:
> Add support for Java nano protocol buffers for Android.
>
> This CL adds a new dependency on the protocol buffer compiler
> from the android source tree, since this compiler supports
> generating Java files using the nano runtime.
>
> The initial version of this dependency is 2.2.0a, but checked
> out as what the Android 4.4.4 Release 2.0.1 tag points to.
>
> This CL adds a new protoc binary (for compiling protos) that supports
> this, and also adds a Java library with the runtime.
>
> To simplify use of this, it also updates build/protoc_java.gypi to
> support generating nano protos by specifying an optional
> proto_runtime argument. The argument defaults to 'lite' which does
> the same thing as before this change, and setting it to 'nano'
> generates the new style Java files.
>
> The plan is to quickly deprecate the 'lite' runtime for Java, since
> it is too big and uses too many methods.
>
> BUG=377891
>
> Committed: d8ae0a7983TBR=cjhopman@chromium.org,darin@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=377891
Review URL: https://codereview.chromium.org/534703004
Cr-Commit-Position: refs/heads/master@{#293028}
This CL adds a new dependency on the protocol buffer compiler
from the android source tree, since this compiler supports
generating Java files using the nano runtime.
The initial version of this dependency is 2.2.0a, but checked
out as what the Android 4.4.4 Release 2.0.1 tag points to.
This CL adds a new protoc binary (for compiling protos) that supports
this, and also adds a Java library with the runtime.
To simplify use of this, it also updates build/protoc_java.gypi to
support generating nano protos by specifying an optional
proto_runtime argument. The argument defaults to 'lite' which does
the same thing as before this change, and setting it to 'nano'
generates the new style Java files.
The plan is to quickly deprecate the 'lite' runtime for Java, since
it is too big and uses too many methods.
BUG=377891
Review URL: https://codereview.chromium.org/511283003
Cr-Commit-Position: refs/heads/master@{#292965}
The cacheinvalidation_java target is also added to build/all_android.gyp to
ensure it is always built since nothing currently depends on it upstream.
When all of Android-specific sync code is upstreamed, a target for sync
should be used instead of cacheinvalidation.
BUG=158382
Review URL: https://chromiumcodereview.appspot.com/11146005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167746 0039d316-1c4b-4281-b951-d872f2087c98