Commit graph

27948 commits

Author SHA1 Message Date
Dan Shi
d79572f73e Add unit_test test option in test configs
This change allows a test (native, java, rust or python) to be included
in host-unit-tests suite when test option `unit_test` is set to true.

Bug: 172006742
Test: m host-unit-tests
Change-Id: I69d3eb5b51198c549e2e6914ceac3a4fc33c3cf2
2020-11-16 11:05:00 -08:00
Paul Duffin
cd4f673ceb Switch boot jars package check to use dexdump xml output
The xml output from dexdump is more stable than the text output so this
change switches to use that.

Bug: 171479578
Test: m check-boot-jars - for failing and passing cases
Change-Id: Ie347b1b685951524d5ae09db280248c61b4228ee
2020-11-16 17:46:16 +00:00
Ulyana Trafimovich
c5bb9fe652 Merge "Add nested class loader subcontext at the proper hierarchy level." am: 0066864a02
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1486218

Change-Id: I505c2312faafa828c46ec6564decf1cd71530cba
2020-11-16 17:35:39 +00:00
Ulyana Trafimovich
946355e8c9 Merge "Disallow adding nested conditional class loader context." am: adff039572
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1486217

Change-Id: Idd1a48528d5e60aafb50f75cacfa7247f10efb65
2020-11-16 17:35:07 +00:00
Ulyana Trafimovich
0066864a02 Merge "Add nested class loader subcontext at the proper hierarchy level." 2020-11-16 17:17:29 +00:00
Ulyana Trafimovich
adff039572 Merge "Disallow adding nested conditional class loader context." 2020-11-16 17:17:05 +00:00
Ulyana Trafimovich
2084c86c1f Merge "Rework class loader context implementation." am: af335a4694
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1450818

Change-Id: I1a3b0e0a3dc1df4fa8104c810cc63b686ac8e073
2020-11-16 15:08:43 +00:00
Ulya Trafimovich
b23d28c6e2 Rename fields and methods to reflect class loader context changes.
Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: Iebfbf2ffdac5ee48476d2aac312b3b8f4471fc85
2020-11-16 14:59:07 +00:00
Ulya Trafimovich
a8c28e27bc Do not add dependencies of shared SDK libraries to manifest_fixer.
Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Bug: 168686456
Change-Id: Ibd9742684fa6a8f1353ca0e513f7fa814a6ec9fc
2020-11-16 14:58:11 +00:00
Ulya Trafimovich
18554243de Add nested class loader subcontext at the proper hierarchy level.
When adding a subcontext in a class loader context tree, there are two
possible cases: 1) the root of the subcontext is itself a <uses-library>
and should be present as a node in the tree, or 2) the root is not a
<uses-library>, but some of its dependencies are -- in that case they
should be disconnected from the root, and the resulting forrest should
be added at the top-level.

Example:

  1) C is a <uses-library>:

     A
     ├── B
     └── C
         ├── D
         └── E
             └── F

  2) C is not a <uses-library>:

     A
     ├── B
     ├── D
     └── E
         └── F

Before the patch subcontexts for transitive dependencies were added
before the subcontext for the direct dependency (even if it was a
<uses-library>, resulting in case-2 hierarchy when case-1 should have
been used. Previosuly this didn't matter because class loader context
was a flat set of libraries, but now it matters because class loader
context is a tree.

This patch changes the order in which libraries are added, so that
direct dependencies are added before transitive ones. The context adding
method now accepts an "implicit root" parameter, so that when adding
transitive dependencies it can check if the corresponding direct
dependency is a <uses-library> and already present in the context.

Partially constructed class loader context is now propagated top-down
into aapt.buildActions, so that the method can use existing part of the
context to decide where the missing part should be connected.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I649aff9e27494306885a4f4fc90226c399636b57
2020-11-16 14:57:05 +00:00
Ulyana Trafimovich
af335a4694 Merge "Rework class loader context implementation." 2020-11-16 14:50:11 +00:00
Jooyung Han
1ff456f5de Remove "apex_uses" mutator am: 74f576de58
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1498491

Change-Id: I1406da3d598abff84c677aae00d2620eed315d5c
2020-11-16 12:48:41 +00:00
Ulya Trafimovich
5e13a7307e Disallow adding nested conditional class loader context.
Nested conditional context doesn't make sense because conditional
context is only needed for compatibility libraries, and those are only
used by apps, and apps are always at the root of class loader context
tree. Therefore, trying to add conditional nested context can only mean
an error somewhere on the way.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: Iadeaaf89fdb11cb23b107c6fb074b1bc765256be
2020-11-16 12:17:30 +00:00
Jingwen Chen
3a4b58dc5d Set PATH and --action_env=PATH for the Bazel build in soong_ui.
Ensures that Bazel and Ninja are using the same binaries from PATH, such
as `sort` from the linked bug.

Test: USE_BAZEL=1 m
Test: rm out/soong/apex/depsinfo/new-allowed-deps.txt && USE_BAZEL=1 m
Bug: 161074854
Fixes: 161074854
Change-Id: Icc3e717e6d3cfcecfe90f0fb3a94a86485a11918
2020-11-16 04:47:14 -05:00
Jooyung Han
74f576de58 Remove "apex_uses" mutator
which was added to support built-time common apex. But the common apex
was abandoned and it is used nowhere.

This is a manual revert of 5c998b9ff8.

Bug: 173329465
Test: m
Change-Id: I684e6b8bfe2ef5b53943329f4aaa5a5ccba27738
2020-11-16 09:08:30 +00:00
Colin Cross
cf371cc1f7 Replace android.WriteFile rule with android.WriteFileRule
The android.WriteFile rule takes careful escaping to produce the
right contents.  Wrap it in an android.WriteFileRule that handles
the escaping.

Test: compare all android.WriteFile outputs
Change-Id: If71a5843af47a37ca61714e1a1ebb32d08536c31
2020-11-14 16:26:00 -08:00
Colin Cross
62a0cfd054 Annotate dependency tags for dependencies of installed files
Soong currently assumes that installed files should depend on
installed files of all transitive dependencies, which results
in extra installed file dependencies through genrules, static
libs, etc.

Annotate dependency tags for dependencies for which the
installed files are necessary such as shared libraries
and JNI libraries.

This avoids extra installed files, and is also a first step
towards genrules using their own copy of tools instead of
the installed copy.

Bug: 124313442
Test: m checkbuild
Test: java.TestBinary
Test: cc.TestInstallSharedLibs
Test: deptag_test.go
Change-Id: Ic22603a5c0718b5a21686672a7471f952b4d1017
2020-11-14 16:24:10 -08:00
Colin Cross
a615901b53 Use the the preferred architecture symlink as the tool path if it exists
When a genrule uses a binary with symlink_preferred_arch set as a tool,
use the symlink instead of the binary as the tool, as the symlink is
the more canonical name for the binary.

Test: m checkbuild
Change-Id: I5330b57139f03ca07bf70547261f191ed84ec9b8
2020-11-14 14:38:34 -08:00
Jingwen Chen
fd08e45584 Merge "Add 'pre-production' description to queryview action." am: 1d26d3033a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1497906

Change-Id: I89f2cd746c9d96455f20c4d84de6731f2fc7471c
2020-11-14 08:33:42 +00:00
Jingwen Chen
1d26d3033a Merge "Add 'pre-production' description to queryview action." 2020-11-14 08:05:35 +00:00
Treehugger Robot
748ecd135f Merge "Pass Config to NewTestContext instead of ctx.Register" am: ceed6be00d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1480601

Change-Id: Idc791387f2ced40abe768395717fee33e3650e4f
2020-11-14 06:12:21 +00:00
Treehugger Robot
ceed6be00d Merge "Pass Config to NewTestContext instead of ctx.Register" 2020-11-14 05:58:58 +00:00
Patrice Arruda
62c4767433 Remove unnecessary break and default statements in metrics.go file. am: 33e7f6a0ca
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1498207

Change-Id: Ia0b372fc8173b137061773e12e85b121d0187344
2020-11-14 01:43:39 +00:00
Patrice Arruda
047210ca6c Add tracer to runBazel function. am: b7cf9ba175
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1498206

Change-Id: Ib944e3e27b24e759286a145f6dbf52b0e14783af
2020-11-14 01:43:37 +00:00
Patrice Arruda
9bfa4625c2 Enable bazel metrics from ninja build. am: 18cb70d645
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1498204

Change-Id: Ied5eff56e861052efcabef1732affec0a69968c7
2020-11-14 01:43:34 +00:00
Patrice Arruda
713775b1c0 Define the bazel_metrics directory in $OUT. am: af880da0c4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1498164

Change-Id: Iad8a5a3ab9e16e5f97dc01e2ee34422ed892bbf4
2020-11-14 01:43:31 +00:00
Patrice Arruda
a5e6074855 Add bazel profile related functions in paths.go am: 24a086b3dc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1498163

Change-Id: I568e1fe40c12a5f63ccb3fcb793f3b10d7bdfde1
2020-11-14 01:43:28 +00:00
Patrice Arruda
5439d1cf68 Define UseBazel in Config am: 0c1c456643
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1496658

Change-Id: I713abab31350b3f81a5787bc875fd7943f8e1510
2020-11-14 01:42:54 +00:00
Patrice Arruda
33e7f6a0ca Remove unnecessary break and default statements in metrics.go file.
break and default statements are not needed inside of a switch
statement.

Bug: b/173028918
Test: USE_BAZEL m nothing
Change-Id: I14aa8cbae3a9b3c859f147c5134600f1e75c6a89
2020-11-13 13:15:09 -08:00
Patrice Arruda
b7cf9ba175 Add tracer to runBazel function.
Added a tracer named "bazel" in runBazel function to capture topline
metrics when running bazel.

Bug: b/173028918
Test: * USE_BAZEL=1 m nothing and checked soong_metrics file using
        printproto command to verify that bazel topline metrics
	were captured.
Change-Id: I5cb0728a4da48545dc701cc79627c318d5d9a29d
2020-11-13 13:14:51 -08:00
Patrice Arruda
18cb70d645 Enable bazel metrics from ninja build.
Generate the bazel profile file that contains the metrics of
executing the ninja build phase of Soong.

Bug: b/173028918
Test: * m nothing and check out dir that there is no bazel_metrics dir.
      * USE_BAZEL=1 m nothing and checked
        out/bazel_metrics/build_bazel_profile.gz existed.
      * m nothing and checked out/bazel_metrics does not exist.
Change-Id: I797d1eecf5c2c260ade8b55dc69c237bfd0fcbd4
2020-11-13 11:37:06 -08:00
Patrice Arruda
af880da0c4 Define the bazel_metrics directory in $OUT.
$OUT/bazel_metrics directory is created in order to dump the
set of bazel profile files being created from a single build
execution. The directory is created from soong_ui.

Bug: b/173028918
Test: * m nothing and check out dir that there is no bazel_metrics dir.
      * USE_BAZEL=1 and checked out/bazel_metrics was created.
      * Ran m nothing and verified that out/bazel_metrics directory is
        deleted to ensure no metrics is uploaded or collected from the
	pipeline.

Change-Id: I1d3c2471065fae6931f35cef7f0f35fd84f76bef
2020-11-13 11:16:21 -08:00
Patrice Arruda
24a086b3dc Add bazel profile related functions in paths.go
Bazel executions occurs in soong_ui and soong_cmd. To collection all
bazel metrics, several path functions are defined to return the path
to store a bazel profile gzipped file.

Bug: b/173028918
Test: m nothing
Change-Id: I78926c66f853233b3977aca22e8a3fcf28edda53
2020-11-13 11:16:21 -08:00
Patrice Arruda
0c1c456643 Define UseBazel in Config
The UseBazel() function will be used in several places to perform
different functionality such as setting up the metrics path.

Bug: b/173028918
Test: m nothing
Change-Id: Ie94073b8f0552ec7528e1cc2f3be74b693dc3135
2020-11-13 11:16:21 -08:00
Christopher Parsons
74de7a4d5b Merge "Stop first pass of mixed bazel builds before writing ninja" am: 9414a8be12
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1493282

Change-Id: Iea811eb57f9c751dd54ea3f48be6b05c322b5d42
2020-11-13 18:35:32 +00:00
Christopher Parsons
9414a8be12 Merge "Stop first pass of mixed bazel builds before writing ninja" 2020-11-13 18:18:07 +00:00
Martin Stjernholm
5c42f525c4 Set up BuildNumberFile in soong.variables. am: c488743e14
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1488760

Change-Id: Ia71620135db89f2014800dc5a2f542f8a5aef630
2020-11-13 16:01:54 +00:00
Martin Stjernholm
c488743e14 Set up BuildNumberFile in soong.variables.
Necessary for some build steps. aapt2 is one example, although it still
has problems because part of its build logic is in make.

This isn't strictly required for any supported build target at the
moment, but the error when it fails can be confusing so let's add it
anyway.

Test: build/soong/scripts/build-aml-prebuilts.sh art-module-sdk \
  art-module-test-exports conscrypt-module-sdk \
  conscrypt-module-test-exports conscrypt-module-host-exports \
  runtime-module-sdk runtime-module-host-exports \
  i18n-module-test-exports i18n-module-sdk platform-mainline-sdk \
  platform-mainline-test-exports
Bug: 172548608
Change-Id: I88526a85f288287c3a138f8cbb6fd04ad28c3795
2020-11-13 15:40:17 +00:00
Jingwen Chen
478d033499 Add 'pre-production' description to queryview action.
Based on feedback from leadership.

Test: N/A
Change-Id: I4c0debf53a018578a95f074270c330803ef9529b
2020-11-13 10:06:40 -05:00
Chris Parsons
3060ec7731 Stop first pass of mixed bazel builds before writing ninja
This shaves off ~20s, which is ~11%, of `m nothing` with mixed builds.

Test: Manual verification with mixed builds of aosp_flame.
Change-Id: Ief1bc56c92329e899c829fc1374eea9ee9b94fb7
2020-11-12 22:30:46 +00:00
Colin Cross
ae8600b507 Pass Config to NewTestContext instead of ctx.Register
Prepare for using Config when adding singletons by passing
Config to NewTestContext and NewContext instead of to ctx.Register.
This will enable a followup change to store SingletonMakeVarsProviders
registered on the Context in the Config, which is necessary to run
multiple tests in parallel without data races.

Test: all soong tests
Change-Id: Id229629a4e42ff4487d317241673837726c075fc
2020-11-12 10:07:49 -08:00
Ivan Lozano
b722c7eb8c Merge "rust: Fix absolute path OUT_DIR bug" am: 45e0c95f85
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1496656

Change-Id: Ib59430b33818e97b634026f0ec15cc96b61a3348
2020-11-12 16:16:15 +00:00
Ivan Lozano
45e0c95f85 Merge "rust: Fix absolute path OUT_DIR bug" 2020-11-12 15:23:39 +00:00
Jingwen Chen
f9599567db Merge "Export Ninja file paths to lunch repo rule from bazel.go" am: 44db598b3e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1493287

Change-Id: I136748a0e71939379f93c294bce7144adb4a7799
2020-11-12 09:05:13 +00:00
Anton Hansson
afe209bdad Merge "Make apex modules support tagged dists" am: fabdd28fdb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1496336

Change-Id: Icc629fc71d06bec56e7eb04e14aa369741239e2f
2020-11-12 09:01:20 +00:00
Jingwen Chen
44db598b3e Merge "Export Ninja file paths to lunch repo rule from bazel.go" 2020-11-12 08:32:50 +00:00
Anton Hansson
fabdd28fdb Merge "Make apex modules support tagged dists" 2020-11-12 08:30:55 +00:00
Jingwen Chen
a26ac3caee Export Ninja file paths to lunch repo rule from bazel.go
This ensures that the lunch repo rule always reads the right Ninja file.

Test: USE_BAZEL=1 m
Test: m

Change-Id: I7f670dd538f46c4dae5ea537b857ff04520b60e7
2020-11-12 08:01:33 +00:00
Zach Johnson
1ec2ec156f Merge "rust_grpcio well known types support, default deps" am: c0ea1701cb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1490423

Change-Id: I0a26238b9edea981c7076df2958ff20422d3d091
2020-11-12 00:04:55 +00:00
Zach Johnson
c0ea1701cb Merge "rust_grpcio well known types support, default deps" 2020-11-11 23:22:27 +00:00