Commit Graph

36 Commits (main)

Author SHA1 Message Date
Fumitoshi Ukai 61fad561d6 autoninja: check RBE project, not account
Account check would become too slow.
We'll check RBE project to use instead.

On corp machine, our policy to use @google.com account
and rbe-chrome-untrusted to build chromium/chrome.
We don't allow rbe-chromium-untrusted with @chromium.org
on corp machine.

On non-corp machine, user couldn't use rbe-chrome-untrusted
because it's @google.com only, and corp security policy
doesn't allow @google.com account on non-corp machine.

Bug: b/364318216
Change-Id: I0f3a19e105b050aef6a62e1b25b45b1722382a34
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5848450
Reviewed-by: Scott Lee <ddoman@chromium.org>
Reviewed-by: Michael Savigny <msavigny@google.com>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Junji Watanabe <jwata@google.com>
Reviewed-by: Philipp Wollermann <philwo@google.com>
6 months ago
Junji Watanabe 8552a27900 autoninja: Generate UUID for AUTONINJA_BUILD_ID inside autoninja.py
Currently, {autoninja, autoninja.bat} scripts generate AUTONINJA_BUILD_ID by calling `python3 -c "import uuid; print(uuid.uuid4())"`.
This CL moves the logic at the beginning `autoninja.py`.

This also reduces the overhead of starting Python interpreter, which
takes around 60ms on my Windows workstaion.

```
> hyperfine python3
Benchmark 1: python3
  Time (mean ± σ):      63.4 ms ±   7.8 ms    [User: 25.7 ms, System: 33.7 ms]
  Range (min … max):    51.0 ms …  80.2 ms    41 runs
```

Change-Id: I93d5b65f3c5542c3a93a3de1f27a5aa5d06c09a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5737673
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
Auto-Submit: Junji Watanabe <jwata@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
7 months ago
Junji Watanabe b12257963c autoninja: Replace ninjalog_uploader_wrapper.py and reclient_metrics.py with build_telemetry.py
This CL unifies the opt-in/opt-out handling for build telemetry collections about Reclient and Ninjalog.

The user consent message will be displayed only once at the beginning of a build.

```
❯ autoninja -C out/deterministic-andorid-dbg base
*** NOTICE ***
Google-internal telemetry (including build logs, username, and hostname) is collected on corp machines to diagnose performance and fix build issues. This reminder will be shown 9 more times. See http://go/chrome-build-telemetry for details. Hide this notice or opt out by running: build_telemetry [opt-in] [opt-out]
*** END NOTICE ***

Proxy started successfully.
...
```

Bug: 345113094
Change-Id: Ie5886287c4bd20262be0ff247508ac3869441eb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5669094
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Michael Savigny <msavigny@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
7 months ago
Takuto Ikuta cccca95d8f Revert^2 "autoninja.py: disallow external account from corp machine"
This reverts commit ed596dadf9.

Reason for revert:
Ignore exception when getting account for application default
credentials.

Original change's description:
> Revert "autoninja.py: disallow external account from corp machine"
>
> This reverts commit 0d0f28a4fc.
>
> Reason for revert:
> http://b/309720176#comment7
>
> Original change's description:
> > autoninja.py: disallow external account from corp machine
> >
> > This disallows Googler to use non-google account with reclient and
> > siso from corp machine.
> >
> > Bug: b/309720176
> > Change-Id: I8077eff8bbf47f579462e1fefa3609a5d492a013
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5035266
> > Reviewed-by: Philipp Wollermann <philwo@chromium.org>
> > Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> > Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
>
> Bug: b/309720176
> Change-Id: I62b4891b1e2e2554d088d162057982b95c8adcd7
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5065849
> Reviewed-by: Philipp Wollermann <philwo@chromium.org>
> Owners-Override: Takuto Ikuta <tikuta@chromium.org>
> Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
> Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Bug: b/309720176
Change-Id: Ib9aef1b7fa8e3c9bb20ac8d6b461c6bcff72dc83
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5065052
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
1 year ago
Takuto Ikuta ed596dadf9 Revert "autoninja.py: disallow external account from corp machine"
This reverts commit 0d0f28a4fc.

Reason for revert:
http://b/309720176#comment7

Original change's description:
> autoninja.py: disallow external account from corp machine
>
> This disallows Googler to use non-google account with reclient and
> siso from corp machine.
>
> Bug: b/309720176
> Change-Id: I8077eff8bbf47f579462e1fefa3609a5d492a013
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5035266
> Reviewed-by: Philipp Wollermann <philwo@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Commit-Queue: Takuto Ikuta <tikuta@chromium.org>

Bug: b/309720176
Change-Id: I62b4891b1e2e2554d088d162057982b95c8adcd7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5065849
Reviewed-by: Philipp Wollermann <philwo@chromium.org>
Owners-Override: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
1 year ago
Takuto Ikuta 0d0f28a4fc autoninja.py: disallow external account from corp machine
This disallows Googler to use non-google account with reclient and
siso from corp machine.

Bug: b/309720176
Change-Id: I8077eff8bbf47f579462e1fefa3609a5d492a013
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5035266
Reviewed-by: Philipp Wollermann <philwo@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
1 year ago
Philipp Wollermann 0b943400a4 Execute Ninja / Siso directly from autoninja.py.
Instead of printing a command-line, we just directly call into the respective main functions from Python. This saves spawning another interpreter and prevents things that can go wrong from having to quote, unquote, split and tunnel arguments through shells.

Part of my bigger auto{ninja,siso} refactoring.

Tested:
- Handling of the ^^ suffix on Windows still works correctly.
- Handling of error codes - i.e.; making sure
  "autoninja base_unittests && base_unittests.exe" behaves properly
  in the success/failure case.
- Make sure the command prompt title is reliably reset on exit.

I tested autoninja with all combinations of these:
- Host platform: Linux, macOS, Windows
- Remote GN args: <none>, use_goma=true, use_remoteexec=true
- Siso GN args: <none>, use_siso=true
- Targets: base, ../../base/types/expected_macros_unittest.cc^ (on Linux) and ../../base/types/expected_macros_unittest.cc^^ (on Windows)

R=brucedawson@chromium.org, jwata@google.com, tikuta@chromium.org

Bug: b/293657720
Change-Id: I275a775fdc5abb6555f79d4beab76cd0914d4bd6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4924185
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Junji Watanabe <jwata@google.com>
Commit-Queue: Philipp Wollermann <philwo@chromium.org>
1 year ago
Yannic Bonenberger 10898d51d1 [autoninja] Respect user-provided AUTONINJA_BUILD_ID
Change-Id: I2e1b14827e7ff4c1e88a211f5ae0d7a3322b6f39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3569027
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Yannic Bonenberger <yannic.bonenberger@gmail.com>
3 years ago
Sylvain Defresne 5506fbfba0 Fix "expr: syntax error" on macOS
The version of expr shipped on macOS does not support `substr`
command and prints `expr: syntax error`. Change the invocation
of `expr` to use the `:` operator which match rhs regexp into
lhs string and return the length of the match.

This should be supported by all versions of `expr` that are
POSIX compliant.

Bug: 1199260
Change-Id: Ib932702fedbbbc772d65086ebc371dc0a9023c0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2827931
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
4 years ago
Jamie Madill 5f16d6dce6 autoninja: Invoke python3, or batch file on Win.
Bug: 941669
Change-Id: I7f196860d87566cdbd2dda99da151124d9ba917f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2826237
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
4 years ago
Fumitoshi Ukai e7dc8c3a86 Revert "Make autoninja.py work again w/ Python3 and MSYS/MinGW bash."
This reverts commit 9e2dfdcc82.

Reason for revert:
build failure
https://chrome-internal-review.googlesource.com/c/goma/client/+/3683303
e.g. https://ci.chromium.org/ui/p/goma-client-internal/builders/try/Goma%20Trusty64%20Presubmit/b8852734992897102240/overview
https://logs.chromium.org/logs/goma-client-internal/buildbucket/cr-buildbucket.appspot.com/8852734992897102240/+/steps/build/0/stdout

 /b/s/w/ir/kitchen-checkout/depot_tools/autoninja: line 11: /b/s/w/ir/kitchen-checkout/depot_tools/python-bin/python3: No such file or directory
 /b/s/w/ir/kitchen-checkout/depot_tools/autoninja: line 20: /b/s/w/ir/kitchen-checkout/depot_tools/python-bin/python3: No such file or directory
 /b/s/w/ir/kitchen-checkout/depot_tools/autoninja: line 30: /b/s/w/ir/kitchen-checkout/depot_tools/python-bin/python3: No such file or directory

Original change's description:
> Make autoninja.py work again w/ Python3 and MSYS/MinGW bash.
>
> We switched autoninja.py to python3 in https://crrev.com/c/2752772
> but that assumes `python3` is in $PATH (which is likely true on
> Mac and Linux but less likely to be true on Windows, especially
> in MSYS/MinGW/git bash shells.
>
> It's safer to use the `python3` bundled into depot_tools in
> `$depot_tools/python-bin` and more hermetic to boot.
>
> Bug: 1187609
> Change-Id: I65efd1a2b87135ac4e25ba377309c3374cfda085
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2756889
> Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
> Commit-Queue: Dirk Pranke <dpranke@google.com>

Bug: 1187609
Change-Id: I07b04d615624d3dc6bc071920ec97ed39583b64c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2758609
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
4 years ago
Dirk Pranke 9e2dfdcc82 Make autoninja.py work again w/ Python3 and MSYS/MinGW bash.
We switched autoninja.py to python3 in https://crrev.com/c/2752772
but that assumes `python3` is in $PATH (which is likely true on
Mac and Linux but less likely to be true on Windows, especially
in MSYS/MinGW/git bash shells.

It's safer to use the `python3` bundled into depot_tools in
`$depot_tools/python-bin` and more hermetic to boot.

Bug: 1187609
Change-Id: I65efd1a2b87135ac4e25ba377309c3374cfda085
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2756889
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
4 years ago
Takuto Ikuta bd1729d959 Revert "autoninja: roll back to python from python3"
This reverts commit 3253a1deca.

Reason for revert:
Blocker is fixed in https://crbug.com/1168365#c8

Original change's description:
> autoninja: roll back to python from python3
>
> python3 is currently not recognized on git bash.
> https://crrev.com/c/2629087/15#message-b5093e69201df42adb7ac643e4f97f9f366a299d
>
> This is partial revert of
> https://crrev.com/c/2629087
> https://crrev.com/c/2631396
>
> Bug: b/177465438
> Change-Id: I1b2698f5fc27144035598249c43800d25801a0f7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2638834
> Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
> Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
> Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
> Auto-Submit: Takuto Ikuta <tikuta@chromium.org>

Bug: b/177465438, 1168365
Change-Id: I368e28aeec9c585a96c8b44f030609eac58698f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2752772
Reviewed-by: Dirk Pranke <dpranke@google.com>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
4 years ago
Bruce Dawson e952faee4c Reland "Check whether goma is running when it is enabled"
This reverts commit 428143ee24.

Reason for revert: Fixing the issues revealed by the original change by
avoiding python3 and by checking for the existence of gomacc[.exe]
before running it.

This also relands 2241db8a1f - "Avoid
capture_output to support Python 3.6", to simplify relanding and any
possible reverts.

Original change's description:
> Revert "Check whether goma is running when it is enabled"
>
> This reverts commit b7ddc5a009.
>
> Reason for revert:
> This broke the builder where depot_tools is not in PATH.
> https://logs.chromium.org/logs/infra-internal/buildbucket/cr-buildbucket.appspot.com/8858077852309878080/+/u/build/stdout
>
> Original change's description:
> > Check whether goma is running when it is enabled
> >
> > One of the mistakes one can make when running ninja is having goma
> > enabled (use_goma=true in args.gn) but not having goma running. This can
> > lead to ~1,000 failed compile steps, which is messy.
> >
> > This change teaches autoninja.py to check whether goma is running. If
> > not then it tells autoninja to just print a warning message. The
> > check costs roughly 30 ms which seems reasonable.
> >
> > In fact, because this change also switches away from vpython (necessary
> > to use python3 to use subprocess.run) it actually runs about 600 ms
> > _faster_ than before this change.
> >
> > If build acceleration is requested through use_rbe then no checking for
> > whether the service is running is done. That could be added in the
> > future.
> >
> > autoninja.py could auto-start goma but that is error prone and has
> > limited additional value.
> >
> > This was tested on Linux, OSX, and Windows.
> >
> > Bug: 868590, b/174673874
> > Change-Id: Ie773e574878471e5136b9b82d52f86af3d848318
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2627014
> > Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
> > Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
>
> TBR=yyanagisawa@google.com,dpranke@google.com,brucedawson@chromium.org,sanfin@chromium.org,infra-scoped@luci-project-accounts.iam.gserviceaccount.com
>
> Change-Id: I57a6c73ea853259f3d1ec7ad0ce51e495acc96db
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 868590
> Bug: b/174673874
> Bug: 1167064
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2632018
> Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
> Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@google.com>

TBR=yyanagisawa@google.com,dpranke@google.com,brucedawson@chromium.org,sanfin@chromium.org,infra-scoped@luci-project-accounts.iam.gserviceaccount.com

# Not skipping CQ checks because this is a reland.

Bug: 868590
Bug: b/174673874
Bug: 1167064
Change-Id: I8aa6830259bc18f8e7926cd0bf5c62e671c74a2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2634201
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
4 years ago
Takuto Ikuta 3253a1deca autoninja: roll back to python from python3
python3 is currently not recognized on git bash.
https://crrev.com/c/2629087/15#message-b5093e69201df42adb7ac643e4f97f9f366a299d

This is partial revert of
https://crrev.com/c/2629087
https://crrev.com/c/2631396

Bug: b/177465438
Change-Id: I1b2698f5fc27144035598249c43800d25801a0f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2638834
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
4 years ago
Takuto Ikuta 84e43fa2c4 ninjalog uploader: migrate to python3
This removes dependency to httplib2 by using urllib.
https://docs.python.org/3/library/http.client.html#httpresponse-objects

Use six for both py2/py3 unittest.

Bug: b/177465438
Change-Id: I48383559842615f97abea45b55ca0acf4d7c8bd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2629087
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
4 years ago
Takuto Ikuta 13466d016b autoninja: use pure python3 to get build id and for post_build_ninja_summary.py
This is for comments in
https://crrev.com/c/2629087/11/autoninja
and
https://crrev.com/c/2629087/11/autoninja.bat

Change-Id: I2edafaee7916b7c826af7a7f8f0150a541c8d098
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2631396
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
4 years ago
Yoshisato Yanagisawa 428143ee24 Revert "Check whether goma is running when it is enabled"
This reverts commit b7ddc5a009.

Reason for revert:
This broke the builder where depot_tools is not in PATH.
https://logs.chromium.org/logs/infra-internal/buildbucket/cr-buildbucket.appspot.com/8858077852309878080/+/u/build/stdout

Original change's description:
> Check whether goma is running when it is enabled
>
> One of the mistakes one can make when running ninja is having goma
> enabled (use_goma=true in args.gn) but not having goma running. This can
> lead to ~1,000 failed compile steps, which is messy.
>
> This change teaches autoninja.py to check whether goma is running. If
> not then it tells autoninja to just print a warning message. The
> check costs roughly 30 ms which seems reasonable.
>
> In fact, because this change also switches away from vpython (necessary
> to use python3 to use subprocess.run) it actually runs about 600 ms
> _faster_ than before this change.
>
> If build acceleration is requested through use_rbe then no checking for
> whether the service is running is done. That could be added in the
> future.
>
> autoninja.py could auto-start goma but that is error prone and has
> limited additional value.
>
> This was tested on Linux, OSX, and Windows.
>
> Bug: 868590, b/174673874
> Change-Id: Ie773e574878471e5136b9b82d52f86af3d848318
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2627014
> Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
> Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>

TBR=yyanagisawa@google.com,dpranke@google.com,brucedawson@chromium.org,sanfin@chromium.org,infra-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I57a6c73ea853259f3d1ec7ad0ce51e495acc96db
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 868590
Bug: b/174673874
Bug: 1167064
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2632018
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@google.com>
4 years ago
Bruce Dawson b7ddc5a009 Check whether goma is running when it is enabled
One of the mistakes one can make when running ninja is having goma
enabled (use_goma=true in args.gn) but not having goma running. This can
lead to ~1,000 failed compile steps, which is messy.

This change teaches autoninja.py to check whether goma is running. If
not then it tells autoninja to just print a warning message. The
check costs roughly 30 ms which seems reasonable.

In fact, because this change also switches away from vpython (necessary
to use python3 to use subprocess.run) it actually runs about 600 ms
_faster_ than before this change.

If build acceleration is requested through use_rbe then no checking for
whether the service is running is done. That could be added in the
future.

autoninja.py could auto-start goma but that is error prone and has
limited additional value.

This was tested on Linux, OSX, and Windows.

Bug: 868590, b/174673874
Change-Id: Ie773e574878471e5136b9b82d52f86af3d848318
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2627014
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
4 years ago
Takuto Ikuta c603339365 autoninja: use pure python for ninjalog_uploader_wrapper.py
I'll update to python3 separately.

Bug: b/177465438
Change-Id: Id204789f2d0854a796e5408597700d90dc8cd191
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2626863
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@google.com>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
4 years ago
Peter Kasting 1248b8ef4a Fix a python invocation that wasn't replaced with vpython.
This fixes autoninja on my Windows machine at home.

Bug: none
Change-Id: I3c245715c409bb2b30fcc3733bb097fc2a88f464
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2021755
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
5 years ago
Edward Lemur 59a3b2fd5d Run autoninja scripts using vpython.
Bug: 1002153
Change-Id: I769a5370d726f4ce478035f59bfd1df50fef452e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1992315
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Marc-Antoine Ruel 8e57b4bc55 python3 improvements
Ran:
  vi $(git grep --name-only iteritems | grep -v third_party)
  vi $(git grep --name-only itervalues | grep -v third_party)
  vi $(git grep --name-only 'print ' | grep -v third_party)

and edited the files quickly with adhoc macros. Then ran in recipes/:
  ./recipes.py test train

There was only a small subset of files that had been updated to use
six.iteritems() and six.itervalues(). Since the dataset size that is
being used in gclient is small (pretty much always below 200 items),
it's better to just switch to .items() right away and take the temporary
performance hit, so that we don't need to come back to rewrite the code.

Recipe-Nontrivial-Roll: build
Bug: 984182
Change-Id: I5faf11486b66b0d73c9098ab0f2ce1b15a45c53e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1854900
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Marc-Antoine Ruel <maruel@chromium.org>
5 years ago
Gabriel Charette 125f7cc4d5 [depot_tools] Cap num_cores to RAM/2GB under local jumbo builds
Also make autoninja.py a vpython script to use reliable version of
psutil.

Note: this change also makes autoninja always make a decision about
-j; there's no longer a default where it lets ninja pick. The code is
simpler this way and I think it's better because it lets developers
always see which -j is in effect when using autoninja (and that's its
exact purpose, if you wanted default you shouldn't have used autoninja).

R=dpranke@chromium.org

Bug: 976265
Change-Id: Ic9d12469729e4bf58da1ec1bd70437329519fc46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1663904
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
6 years ago
Takuto Ikuta 2ee83757a1 [autoninja] use custom status in non-windows too
This is non-windows version of
840a6d66ec

Change-Id: Iaddd3a153011f9c15cf065e7ef96e320d1737ab0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1632034
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
6 years ago
Andrew Grieve 94bcf1e49b autoninja: Don't echo command-line unless NINJA_SUMMARIZE_BUILD=1
I want to use autoninja from //build/android/generate_gradle.py, but I
invoke it with a *long* list of targets that I do not want echo'ed

Bug: 803493
Change-Id: I98ad85b64ec7ce60b7e3df9827fb613cd57638e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1596535
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
6 years ago
Takuto Ikuta 687c59d3a4 [autoninja] upload ninjalog even in failed build
I noticed current autoninja does not upload build log in failed build.

Change-Id: Ie58646b483e130769ad22113953c0b95b3145548
Reviewed-on: https://chromium-review.googlesource.com/c/1441892
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
6 years ago
Takuto Ikuta 8794a84552 [ninjalog] re-enable log upload
I got launch approval. http://shortn/_dyJK6ME7C0

Detailed document of this log upload is in
https://chromium.googlesource.com/chromium/tools/depot_tools/+/HEAD/ninjalog.README.md

Bug: 900161
Change-Id: Iad2f954040d40caa5b7cc1f1eb39c1088f7f316e
Reviewed-on: https://chromium-review.googlesource.com/c/1401919
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Shinya Kawanaka <shinyak@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
6 years ago
Takuto Ikuta f94f910e9a [ninjalog] disable log upload
TBR=dpranke@chromium.org
Bug: 900161
Change-Id: I5e481f04f281fddb08724fd27630a3fb926c5d1b
Reviewed-on: https://chromium-review.googlesource.com/c/1365196
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
6 years ago
Takuto Ikuta 9af233a508 introduce ninjalog_uploader to autoninja
This CL introduces ninjalog_uploader to autoninja for posix environment.
This is to collect build statistics from googler to find user side build performance bottleneck.

ninjalog_uploader_wrapper is used to notify user and manage small config of upload script.

Bug: 900161
Change-Id: I48ac8cd1d52f64e8fdafaec43636d2d79ef9040d
Reviewed-on: https://chromium-review.googlesource.com/c/1345255
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Shinya Kawanaka <shinyak@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
6 years ago
Yoshisato Yanagisawa 91de11099d autoninja: fix shellcheck warnings
Change-Id: Ic7ca117435de34400fdd117741d0b321339f8cfd
Reviewed-on: https://chromium-review.googlesource.com/c/1325250
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
6 years ago
Yoshisato Yanagisawa 43a35d299b autoninja: quote the arguments when needed.
On Windows, without quote, whole return value would be treated as
a command, and the execution would fail.
On Linux and Mac, without quote, if depot_tools is settled under
directories with ' ', command execution would fail because paths are
separated in a wrong way.

To make such a return value work on Linux and Mac, the shell script
started to use eval.

Bug: 902930
Change-Id: I9bb74585294af565988c0b844b6b113a5c685530
Reviewed-on: https://chromium-review.googlesource.com/c/1325249
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
6 years ago
Yoshisato Yanagisawa 08faab99d4 Set unique build ID.
For ease of distinguishing a series of build from others in Goma,
let me make autoninja set unique build ID.
The ID can be usable for statistics purpose to see how much time is
usually spent for each build.

Since the unique ID is not specific to Goma, i.e. anybody invoked by
ninja can use it to distinguish builds, I chose AUTONINJA_BUILD_ID.
Since we do not need to distinguish each node, I chose uuid4.

Bug: b/77176746
Change-Id: I0b6a67811b420c51d1fd3fd113bf7f039a41e2ab
Reviewed-on: https://chromium-review.googlesource.com/c/1275685
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Fumitoshi Ukai <ukai@chromium.org>
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
6 years ago
Bruce Dawson 46541b4996 Fix autoninja && chrome on failed builds
A handy usage pattern for autoninja.bat that I was not aware of is to go

    autoninja -C out\Default chrome && chrome

This will build chrome and then run it, but only run it if the build
succeeds. The addition of post_build_ninja_summary.py broke this by
losing the error code. This change fixes it by using black magic to
set an error code in the failure case.

Bug: chromium:787983
Change-Id: Ib87fd1799816e19d56de76e08e0f9688be903d80
Reviewed-on: https://chromium-review.googlesource.com/916705
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
7 years ago
Bruce Dawson e186e50d0b Update post_build_ninja_summary.py for Linux
post_build_ninja_summary.py gives a summary of a ninja build. It can be
run standalone or it can be run automatically by autoninja. This CL
updates the Python script and the autoninja bash script to make this
work on Linux. This includes removing a zero-value assert, and ensuring
that .so files get categorized as such.

Change-Id: I2d59ab129f5ce70117beeb119719f8432bfbab7c
Reviewed-on: https://chromium-review.googlesource.com/915053
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
7 years ago
Bruce Dawson ebebd952d7 autoninja - ninja wrapper to make goma easier
Using goma requires the developer to remember which build directories
use goma and which don't so that they can pass an appropriate -j number.
Getting this wrong makes builds slower, either by under utilizing
resources or by causing a self-inflicted DOS attack. Usage:

    autoninja -C out/debug

autoninja looks at the settings for the specified build directory and
then selects either -j num_cores*20 or no -j flag based on the
use_goma setting.

You can set the NINJA_CORE_MULTIPLIER variable to change from the
default 20* multiplier. You can also use NINJA_CORE_ADDITION if you
want non-goma builds to specify -j with an offset to the number of
cores, such as this Linux command:

    NINJA_CORE_ADDITION=-2 autoninja -C out/release base

This will tell autoninja to pass -j to ninja with num_cores-2 as the
parameter.

On Windows you can have a ninja.bat file (ahead of ninja on the path)
such that autoninja will automatically be used. It should contain this:
    @call autoninja.bat %*

Change-Id: I4003e3fc323d1cbab612999c945b5a8dc5bc6655
Reviewed-on: https://chromium-review.googlesource.com/517662
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Fumitoshi Ukai <ukai@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
8 years ago