Commit graph

340 commits

Author SHA1 Message Date
Dan Willemsen
ce41e943be Remove support for ONE_SHOT_MAKEFILE
Test: treehugger
Change-Id: Icdbe62bcb7bc4717228c5d974962b939d8eafee6
2019-07-31 18:11:27 -07:00
Elliott Hughes
521602194b Merge "Switch to toybox egrep(1) and grep(1)." 2019-07-31 16:55:43 +00:00
Dan Willemsen
1eee154c3b Default to the status table output
For smart terminals, default to using the status table, using 1/4 of the
terminal height (with a min of 1 and a max of 10).

This behavior can still be overriden to a specific height with
SOONG_UI_TABLE_HEIGHT, and turned off by setting SOONG_UI_TABLE_HEIGHT
to 0.

Test: m   <adjust terminal height, see it shrink when it gets too short>
Test: SOONG_UI_TABLE_HEIGHT=20 m
Test: SOONG_UI_TABLE_HEIGHT=0 m
Change-Id: I224348a29a6e07f168c92cf5514a94bd27e32618
2019-07-30 13:44:03 -07:00
Dan Willemsen
a2a8ecb330 Remove reference to PRODUCT-*
The code still needs to exist, but for buildspec.mk files, not the
PRODUCT-* arguments.

Test: none
Change-Id: I60c6044ab2d1627af7e6e2e8831b77d9db12aa55
2019-07-29 15:14:11 -07:00
Kousik Kumar
61afb56e84 Add dist_dir to goma trigger
This is done so that prototype tooling can write logs inside the DIST_DIR.

Test: I wrote out all the environment variables being passed to
goma_ctl.py and the output is https://paste.googleplex.com/6663469954760704. It contains both DIST_DIR and other variables.

Change-Id: Ia5c70e58aa1b87db9777c59cf3e5df1c9e20f08c
2019-07-23 16:16:15 -04:00
Elliott Hughes
7ceddbae8e Merge "Switch to prebuilt bzip2." 2019-07-23 19:28:02 +00:00
Elliott Hughes
2ee8b33edc Switch to prebuilt bzip2.
Test: treehugger
Change-Id: I4953ff6f9ead5ad79519ac7fa71b557807f25851
2019-07-23 15:08:58 +00:00
Ramy Medhat
2b78fda705 Merge "Add USE_RBE support to soong." 2019-07-23 11:49:10 +00:00
Treehugger Robot
1ecfa940d1 Merge "Reland "Switch to toybox tar."" 2019-07-23 02:08:40 +00:00
Ramy Medhat
bbf2567cc1 Add USE_RBE support to soong.
Test: Built aosp_arm-user with and without USE_RBE. USE_RBE uses
a proxy script in place of rewrapper.

Change-Id: I5bf008a940513872d70b5b215bd6209f759826ae
2019-07-17 18:46:47 +00:00
Patrice Arruda
19bd53e39c soong_ui: Do not clean the OutDir path multiple times.
If OUT_DIR has been specified through the command line arguments,
it is sanitized first and NewConfig sets the OUT_DIR in the build
environment. When calling OutDir from Config instance, the out
was being sanitized again which is unnecessary.

Bug: b/118730755
Test: Ran unit test cases, "lunch" followed by "m" command.
Change-Id: Ieb4ffa1026c802c76c7369e8cdb3923a4c70f4b3
2019-07-16 11:22:22 -07:00
Patrice Arruda
0dcf27f639 soong_ui: Construct the proper MODULES-IN-<dir name> for m* build commands.
Previously, any of the build commands (mma, mmma, etc...) would traverse
up the directory path until an Android build file has been found. That
directory path would eventually become the MODULES-IN-<dir name> build
target. The directory where the m* command was executed may contain a
build file in a sub directory. For that case, the build target is the
MODULES-IN-<dir name> where dir is the directory of the executed m*
command since the target has been constructed by the core makefile.

Bug: b/118730755
Test: Wrote and ran unit test cases. Ran "lunch", "m". Went to a
      directory in AOSP that had build files in sub directories and
      executed mma. Went to a directory that had only build files in
      parent directories and executed mma.

Change-Id: I9458cbc4bf0fc25bfb0848e96e92d261442d5cb0
2019-07-16 11:19:05 -07:00
Elliott Hughes
a6d1d373ae Reland "Switch to toybox tar."
This reverts commit afeb6cb817.

Change-Id: I67733254fd7edad51ac3fbb18c929b109e86d32e
2019-07-12 15:57:33 +00:00
Patrice Arruda
9450d0b226 soong_ui: Do not find a build file if targets are specified.
For mmma and mmm, the findBuildFile function in config.go is invoked every time
for specified directories and directories with targets. For directories with
targets, an Android build file must exist in the directory where mmma and mmm
was invoked. There is no need to invoke findBuildFile function as a
simple check of the build file exists in the specified directory.

This is also refactoring the code for b/118730755

Bug: b/118730755
Test: Executed unit test cases through Intellij and executed mmma
command: "mmma external/protobuf:aprotoc external/bzip2".

Change-Id: I5428e3a3c36f77ff740617564b7853705521f29f
2019-07-11 14:38:19 -07:00
Elliott Hughes
c5a34551e1 Switch to toybox egrep(1) and grep(1).
Test: treehugger
Change-Id: I9053f45d591a8cb53eb36e258ecb97b591d806a1
2019-07-09 08:51:30 -07:00
Justin Yun
d5f6c8261a Rename product_services to system_ext
Bug: 134359158
Test: build and check if system_ext.img is created
Change-Id: Ice3229baf97a94c24a6eea22e7d4571941d7f843
2019-07-09 08:57:05 +00:00
Treehugger Robot
f67e1bee4a Merge changes Icfc893c8,I40f03fc0
* changes:
  Allow debugging with SOONG_DELVE=<listen addr>
  Print ninja stdout live during the build
2019-07-04 03:34:22 +00:00
Colin Cross
aa812d122c Allow debugging with SOONG_DELVE=<listen addr>
Allow running Soong in a headless delve debugger by passing
SOONG_DELVE=<listen addr> in the environment.

Bug: 80165685
Test: SOONG_DELVE=:1234 m nothing
Change-Id: Icfc893c8a8354a9bbc99112d9c83259cb41906d1
2019-07-03 16:33:31 -07:00
Colin Cross
7b97ecd1f5 Print ninja stdout live during the build
When running ninja stream stdout to the status writer.  This improves
the ninja -d explain behavior, and will also allow Soong to be put
into the ninja console pool letting it print timely output to the
console.

Bug:  80165685
Test: NINJA_ARGS="-d explain" m
Change-Id: I40f03fc01d837ad91d400eae378007a7ce807705
2019-07-03 16:33:10 -07:00
Patrice Arruda
baba9a9be6 soong_ui: Build under a path that contains a symbolic link.
The build directory passed in to soong_ui can contain a
symbolic link. soong_ui was not evaluating the build
directory to retrieve the true path, hence failing to
execute the internal soong.

Fixes: b/135995632
Test: Unit test case and executed the scenario in the bug
      description.

Change-Id: I5779c6aa3f3183810437dbe2b2d4e40acbafb205
2019-07-03 13:03:23 -07:00
Mikhail Naganov
9d42425f25 Perform TERM check for file writers only
Tests use fakeSmartTerminal, this case must not be affected
by the TERM setting.

Test: TERM=dumb make
Change-Id: Ib926a1c6ba2d8c4117d412fe351d872ccfc1c799
2019-07-02 09:51:42 -07:00
Mikhail Naganov
b073581441 Improve dumb terminal detection
When figuring out terminal type, check whether TERM=dumb is set.

Test: m nothing
Test: TERM=dumb m nothing
Test: m nothing | tee log
Change-Id: Ie13ca99eb84b798644d618ad1c8c1fb8ec8bb049
2019-06-27 10:54:53 -07:00
Colin Cross
7b6245388c Compute critical path when ninja finishes
Keep a running map of the critical path to each edge as it
finishes.  At the end of the build, find the edge with the
longest critical path and print the path to out/soong.log.

Test: critical_path_test.go
Change-Id: Ie01d26b068b768156b166bff00cdc3273e8124ca
2019-06-26 11:31:17 -07:00
Treehugger Robot
ba9a51979d Merge "Revert "Switch to toybox tar."" 2019-06-25 05:24:44 +00:00
Elliott Hughes
afeb6cb817 Revert "Switch to toybox tar."
This reverts commit 3b584b7861.

Reason for revert: missing --mode.

Change-Id: I0cde94c38905e26c79c31a03fd0177d7d57daa32
2019-06-25 01:40:42 +00:00
Treehugger Robot
7d7cae85ab Merge "Soong: Add build_error proto raw file to $(OUT_DIR)." 2019-06-24 22:59:33 +00:00
Colin Cross
bbeb2c1a50 Merge "Color long running durations when using action table output" 2019-06-24 21:38:51 +00:00
Elliott Hughes
9b74dfe96c Merge "Switch to toybox tar." 2019-06-24 21:24:53 +00:00
Patrice Arruda
297cebad26 Soong: Add build_error proto raw file to $(OUT_DIR).
Soong_ui produces a build_error raw file to $(OUT_DIR) where
the file contains a list of build action errors. Each build action
error represents an error raised by a command. The build_error file
is populated if there was a build error.

Bug: b/132969697
Test: Ran m for successful build. Introduced a broken build change,
      ran m and verified using printproto that build_error was
      generated successfully.

Change-Id: I690ca1778b4e56f144a3173ba1d16d8494c32c15
2019-06-24 13:02:35 -07:00
Colin Cross
5137de0bdd Color long running durations when using action table output
When printing the action table, color the duration of commands that
have been running for 30 seconds yellow, and commands that have been
running for 60 seconds red.

Test: manual
Change-Id: I61cb21b0dae10811d345cb9f62cd07915cfc69ee
2019-06-24 10:49:11 -07:00
Treehugger Robot
45cdb71290 Merge "Soong: Add BUILD_MODULES build action in soong_ui." 2019-06-21 03:11:34 +00:00
Patrice Arruda
3928206ecc Soong: Add BUILD_MODULES build action in soong_ui.
There was one case that did not work:
  1) Create dir in root source tree
  2) Run "m libc"

The build would fail as it was using the mma logic. A separate
one named BUILD_MODULES was added to allow building specific
modules in any directories using the "m" command.

Bug: b/130049705
Test: unit test cases, ran "m libc" in a tmp directory inside
      of the source tree.

Change-Id: I8d23e685a673a311001ee8edd89bd73b662392dd
2019-06-20 16:35:12 -07:00
Elliott Hughes
63e70530d3 Merge "Allow gzcat as an alias for gzip's -dc mode." 2019-06-20 21:03:11 +00:00
Elliott Hughes
e671f5a397 Allow gzcat as an alias for gzip's -dc mode.
This gets us closer to toybox tar (and toybox gzip/gzcat).

Test: treehugger
Change-Id: If934270439b258eae55cdd3e97ac0e83b1c79c70
2019-06-19 14:02:02 -07:00
Dan Willemsen
c69d715d72 Use prebuilt m4 instead of system m4
Bug: 117561006
Test: treehugger
Change-Id: I588d867d95cc52963ce764018a9c09b26973c8c3
2019-06-19 12:50:32 -07:00
Treehugger Robot
fedc47141e Merge "Support an action table that shows longest running actions" 2019-06-19 06:41:28 +00:00
Treehugger Robot
4b1f4fe138 Merge "Use SIGWINCH to update terminal size" 2019-06-18 21:23:43 +00:00
Treehugger Robot
eec8d3aee3 Merge "Soong: Fix the package name in metrics.proto file" 2019-06-17 23:42:33 +00:00
Elliott Hughes
3b584b7861 Switch to toybox tar.
Test: treehugger
Change-Id: I4c561186c14cc44782a9e5c83d4d9c002addb3f6
2019-06-17 16:39:35 -07:00
Elliott Hughes
2d10e3f54e Merge "Revert "Revert "Switch to toybox timeout.""" 2019-06-17 23:35:16 +00:00
Elliott Hughes
0e868d0391 Revert "Revert "Switch to toybox timeout.""
This reverts commit 50e91c1a7a.

Reason for revert: SIGRTMIN+2 support added.

Change-Id: I3cb251a102e427335315c4931e23a69b95253ee7
2019-06-17 16:45:15 +00:00
Patrice Arruda
0cc5b21516 Soong: Fix the package name in metrics.proto file
The metrics.proto needs to be imported to Google3 in order to unmarshal
the build metrics data from bigstore. Cleaned up the enum names to use
the Camel naming convention and renamed the build_metrics to
soong_metrics to be more specific to soong and to allow quering
soong_metrics files from bigstore.

Bug: b/135280521
Test: lunch andf m -j. Checked if soong_metrics was generated correctly
      by using printproto command.

Change-Id: I998c8d05db592e94a653d6ca32250b80df3c9b21
2019-06-14 15:27:46 -07:00
Treehugger Robot
49cd4954a0 Merge "soong_ui: Add build actions commands in soong_ui." 2019-06-13 23:14:56 +00:00
Patrice Arruda
1384822a63 soong_ui: Add build actions commands in soong_ui.
Add the following build actions {BUILD_MODULES_IN_A_DIRECTORY,
BUILD_MODULES_IN_DIRECTORIES} in soong_ui config so the bash code version of
build commands (m, mm, mma, mmm, mmma) in build/make/envsetup.sh can be deprecated.
This is to allow up to date bug fixes on the build commands.

Bug: b/130049705
Test: Unit test cases
Change-Id: I772db1d4e9c1da5273374d1994eb5e8f17cd52f2
2019-06-13 13:15:12 -07:00
Colin Cross
3dac80e519 Support an action table that shows longest running actions
If SOONG_UI_TABLE_HEIGHT is set, enable a new smart terminal display
that prints the normal scrolling build history in the top region of
the screen and an action table of the longest currently running
actions in the bottom region of the screen.  This provides better
visibility into which are the longest running actions and when the
build parallelism is very low.

Test: manual
Change-Id: I677d7b6b008699febd259110d7f9e0f98d80c535
2019-06-13 11:26:06 -07:00
Colin Cross
4355ee64a9 Use SIGWINCH to update terminal size
Instead of reading the terminal size on every status update, register
for SIGWINCH to read and store the size when it changes.

This reapplies I555ad21a31a2c924ab0ca681e0c8f00df42a370a with a fix
for a race condition in TestSmartStatusOutputWidthChange.

Test: status_test.go
Change-Id: If342cb4cc8e4ed57af9e3bb417758348c9c41247
2019-06-13 11:26:06 -07:00
Colin Cross
4bc5e802db Revert "Use SIGWINCH to update terminal size"
This reverts commit 49036be407.

Reason for revert: TestSmartStatusOutputWidthChange is flaky

Change-Id: Ie5231dbbab2887ce4c4697f3fe6e52cfd6f4dd17
2019-06-13 18:10:45 +00:00
Colin Cross
49036be407 Use SIGWINCH to update terminal size
Instead of reading the terminal size on every status update, register
for SIGWINCH to read and store the size when it changes.

Test: status_test.go
Change-Id: I555ad21a31a2c924ab0ca681e0c8f00df42a370a
2019-06-12 21:30:56 -07:00
Colin Cross
00bdfd8476 Make status line bold
Bolding the status line provides differentiation between output
of each command.

Test: status_test.go
Change-Id: I9d46761e69c5af0a0aa86c7921e121cfd2a3fc82
2019-06-12 21:30:56 -07:00
Colin Cross
e0df1a36b2 Move all output through StatusOutput
Write log output through StatusOutput so that the status implementation
can synchronize it with its own output.

Test: status_test.go
Change-Id: I917bdeeea4759a12b6b4aa6d6d86ee18a2771723
2019-06-12 21:30:56 -07:00