0
Commit Graph

30 Commits

Author SHA1 Message Date
Andrew Grieve
3dec34616a Copy zip-related funcs build_utils -> zip_helpers
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}
2023-03-31 20:31:29 +00:00
Andrew Grieve
4bc50e2da1 Android: Use action_helpers instead of build_utils when applicable
Bug: 1428082
Change-Id: Ie23e6c0e94a4cc637d757ba842b4142d5cc8bc9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4383307
Owners-Override: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Sam Maier <smaier@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1124543}
2023-03-31 02:25:57 +00:00
Takuto Ikuta
df413c2e2b build: remove 'from __future__ import print_function'
I think we don't need this line anymore.

Bug: 1406153
Change-Id: Id161854458d131645bb4b54e9ed69b1c171319ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4078643
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1092171}
2023-01-13 01:00:01 +00:00
Takuto Ikuta
3dab32e086 build: update shebang to python3
This assumes that CQ has enough coverage for these scripts if they are
important.

Derived from https://crrev.com/c/4078643/4/build/android/pylib/symbols/mock_addr2line/mock_addr2line#1

This is made by
$ rg -l '#!.*python$' build | \
  xargs sed -i 's/\(#!.*\)python$/\1python3/'

Bug: 1406153
Change-Id: I3df47e000c690ce8af341ff317539c4faa58e3bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4159758
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1091953}
2023-01-12 18:52:00 +00:00
David Bengoa
b846350e01 Remove overrideLatest from grpc-java deps, update build config
Change-Id: Ib0a493b4e1475af3a4ccb1ed3877a8d35cb2daea
Bug: b:245087054
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3873634
Reviewed-by: Xinghui Lu <xinghuilu@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: David Bengoa <dbengoa@google.com>
Cr-Commit-Position: refs/heads/main@{#1056328}
2022-10-07 15:50:13 +00:00
Avi Drissman
73a09d1a67 Update copyright headers in build/, build_overrides/, and buildtools/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c34.

An earlier version of this CL, https://crrev.com/c/3879808,
was reverted due to an issue that was resolved with
https://crrev.com/c/3881211.

No-Try: true
Bug: 1098010
Change-Id: I91174ff0a9dd8b6dee79e6cba8209b614ce2b712
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3884220
Reviewed-by: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1044745}
2022-09-08 20:33:38 +00:00
Rebekah Potter
184a820046 Revert "Update copyright headers in build/, build_overrides/, and buildtools/"
This reverts commit 8996d5a5ca.

Reason for revert: Breaks android-binary-size bot, see
https://bugs.chromium.org/p/chromium/issues/detail?id=1361092

Original change's description:
> Update copyright headers in build/, build_overrides/, and buildtools/
>
> The methodology used to generate this CL is documented in
> https://crbug.com/1098010#c21.
>
> No-Try: true
> Bug: 1098010
> Change-Id: I0323d0734081fc1aaf3b9ec3b8184411fe1a368a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3879808
> Auto-Submit: Avi Drissman <avi@chromium.org>
> Commit-Queue: Avi Drissman <avi@chromium.org>
> Owners-Override: Avi Drissman <avi@chromium.org>
> Reviewed-by: Mark Mentovai <mark@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1044227}

Bug: 1098010
Change-Id: Ie1b5a07d859e98588c1497220aac54834ea5d7f0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3880816
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Nidhi Jaju <nidhijaju@chromium.org>
Commit-Queue: Nidhi Jaju <nidhijaju@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1044284}
2022-09-08 01:08:54 +00:00
Avi Drissman
8996d5a5ca Update copyright headers in build/, build_overrides/, and buildtools/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c21.

No-Try: true
Bug: 1098010
Change-Id: I0323d0734081fc1aaf3b9ec3b8184411fe1a368a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3879808
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1044227}
2022-09-07 22:46:30 +00:00
Mohamed Heikal
8e87c01219 Enforce that all java protos explicitly specify java_package
Also:
- updates build/protoc_java.py to use argparse instead of optparse.
- removes deprecated references to proto nano

Bug: 1114836
Change-Id: I184e6e262159ecb79cdf980a8c48e9d7f28c7d12
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2434908
Auto-Submit: Mohamed Heikal <mheikal@chromium.org>
Reviewed-by: Peter Wen <wnwen@chromium.org>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811662}
2020-09-29 13:13:08 +00:00
Andrew Grieve
5a01ad3dbc Finish converting all scripts from depfile -> .pydeps
Removes option to add pydeps via build_utils.WriteDepfile().

TBR=agrieve  # Refactored method signature

Bug: None
Change-Id: I5fb2d4e15c2739344bcb89ebd1906efb10a7c149
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2265504
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782541}
2020-06-25 18:06:00 +00:00
Mohamed Heikal
25f926b7a7 Revert "Rollback protobuf lite runtime to 3.0.1"
This reverts commit 8a3e6a2898.

Reason for revert: Revert before next branch cut, was only required for a cherry-pick to M84

Original change's description:
> Rollback protobuf lite runtime to 3.0.1
> 
> 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}

TBR=yfriedman@chromium.org,agrieve@chromium.org,mheikal@chromium.org,harringtond@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1093059, b/157318961
Change-Id: Ieda4530327ff3de513601ae3fe0ad5e9c99eeed0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2264466
Reviewed-by: Mohamed Heikal <mheikal@chromium.org>
Reviewed-by: Dan H <harringtond@chromium.org>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782219}
2020-06-25 02:58:48 +00:00
Mohamed Heikal
8a3e6a2898 Rollback protobuf lite runtime to 3.0.1
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}
2020-06-11 21:24:18 +00:00
Mohamed Heikal
0221b0c7ff Roll protobuf javalite runtime + fix gn package name
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}
2020-03-06 02:48:50 +00:00
Sky Malice
439555283c Added support for Java protobuf targets to depend on other targets.
Added import_dirs, and deps now pass through to the generated
android_library target. This brings Java proto_java_library closer to
its C++ counterpart.

Bug: 1039010
Change-Id: I9b8bf8995d8cfa17c9eb624e2a1a8a46f7cfacf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986955
Reviewed-by: Albert J. Wong <ajwong@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Ramin Halavati <rhalavati@chromium.org>
Commit-Queue: Sky Malice <skym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729045}
2020-01-07 19:55:56 +00:00
Raul Tambre
9e24293bf2 //build: Convert print statements to Python 3 style
Ran "2to3 -w -n -f print ./base" and manually added imports.
There are no intended behaviour changes.

Bug: 941669
Change-Id: Ie2830e213eae3a5d7753ce503020e02811b726d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1585890
Commit-Queue: Raul Tambre <raul@tambre.ee>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
Cr-Commit-Position: refs/heads/master@{#658917}
2019-05-12 06:11:07 +00:00
oysteine
cabc7f4186 Reland "[protoc] Use protoc's lite java plugin and runtime"
This reverts commit 8121da4a45.

Reason for revert: Builder turned green while the revert was in flight, and the revert seems to have broken it.

Original change's description:
> Revert "[protoc] Use protoc's lite java plugin and runtime"
> 
> This reverts commit 8aa669efad.
> 
> Reason for revert: crbug.com/910759
> 
> Original change's description:
> > [protoc] Use protoc's lite java plugin and runtime
> > 
> > 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}
> 
> TBR=pkasting@chromium.org,michaelbai@chromium.org,wnwen@chromium.org,pavely@chromium.org,agrieve@chromium.org,mheikal@chromium.org
> 
> Change-Id: Ie2dce6e8c5ad03e6a75607a02e234c813f3072a5
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 782237, 800281
> Reviewed-on: https://chromium-review.googlesource.com/c/1357571
> Reviewed-by: oysteine <oysteine@chromium.org>
> Commit-Queue: oysteine <oysteine@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#612826}

TBR=pkasting@chromium.org,michaelbai@chromium.org,wnwen@chromium.org,oysteine@chromium.org,pavely@chromium.org,agrieve@chromium.org,mheikal@chromium.org

Change-Id: Ia8b508fd7ab9c7c42cc976dc0827683da81a435f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 782237, 800281
Reviewed-on: https://chromium-review.googlesource.com/c/1357641
Reviewed-by: oysteine <oysteine@chromium.org>
Commit-Queue: oysteine <oysteine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612863}
2018-12-01 00:08:52 +00:00
oysteine
8121da4a45 Revert "[protoc] Use protoc's lite java plugin and runtime"
This reverts commit 8aa669efad.

Reason for revert: crbug.com/910759

Original change's description:
> [protoc] Use protoc's lite java plugin and runtime
> 
> 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}

TBR=pkasting@chromium.org,michaelbai@chromium.org,wnwen@chromium.org,pavely@chromium.org,agrieve@chromium.org,mheikal@chromium.org

Change-Id: Ie2dce6e8c5ad03e6a75607a02e234c813f3072a5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 782237, 800281
Reviewed-on: https://chromium-review.googlesource.com/c/1357571
Reviewed-by: oysteine <oysteine@chromium.org>
Commit-Queue: oysteine <oysteine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612826}
2018-11-30 22:49:19 +00:00
Mohamed Heikal
8aa669efad [protoc] Use protoc's lite java plugin and runtime
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}
2018-11-30 19:23:11 +00:00
David 'Digit' Turner
0006f47376 android: build: Use .pydeps file to store Python dependencies.
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}
2018-08-07 07:12:36 +00:00
Brian Sheedy
bd2e72e209 Revert "android: build: Use .pydeps file to store Python dependencies."
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}
2018-08-03 20:35:09 +00:00
David 'Digit' Turner
df2048be14 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}
2018-08-03 14:56:59 +00:00
Jan Krcal
dc072552bd [protobuf] Switch the default java protobuf generator from nano to lite
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}
2018-04-09 08:52:16 +00:00
Florian Uunk
cc12c7a952 Enable using lite protos for Android.
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}
2017-11-17 03:11:07 +00:00
agrieve
4eb18a55cd Fix android depfiles to always list GN's outputs[0]
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}
2016-09-14 02:06:20 +00:00
cjhopman
a3f2d3f681 Add proto_java_library to gn
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}
2014-10-01 23:49:49 +00:00
nyquist
cca2bcd58f Remove protobuf lite for java.
Since the introduction of nano protobufs for Java in
https://codereview.chromium.org/532303003 (and updated in
https://codereview.chromium.org/549543002), there is no need for the
lite protocol buffers anymore.

This CL removes the checked out files initially introduced when
protobuf lite support for Java was added in
https://chromiumcodereview.appspot.com/11347026 and cleans up the
infrastructure regarding generating protocol buffers.

Since lite is not supported anymore, this also removes the requirement
for setting the 'proto_runtime' variable for targets using
build/protoc_java.gypi.

BUG=377891
TBR=zea@chromium.org

Review URL: https://codereview.chromium.org/556933002

Cr-Commit-Position: refs/heads/master@{#294453}
2014-09-11 20:17:18 +00:00
nyquist
38f28ba654 Add support for Java nano protocol buffers for Android (take 2).
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}
2014-09-04 00:34:47 +00:00
nyquist
e3f2241bc1 Revert of Add support for Java nano protocol buffers for Android. (patchset id:60001 of https://codereview.chromium.org/511283003/)
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: d8ae0a7983

TBR=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}
2014-09-03 00:26:04 +00:00
nyquist
a076bf3d5a 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

Review URL: https://codereview.chromium.org/511283003

Cr-Commit-Position: refs/heads/master@{#292965}
2014-09-02 18:51:26 +00:00
nyquist@chromium.org
d339e3cbbe Add support for generating jars from protos and add cacheinvalidation_java.
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
2012-11-14 21:20:47 +00:00