Commit graph

32633 commits

Author SHA1 Message Date
Colin Cross
d97cf63cdf Turn missing jarjar output files into errors
Jarjar doesn't exit with a nonzero return code when there is a syntax
error in a rules file and doesn't write the output file.  Without a
nonzero return code ninja prints a warning but continues, which leads
to stale results on incremental builds where the output file already
exists, or delayed errors on clean builds whre the output file didn't
exist.

Delete the output file before running jarjar, and then check if it
exists after running jarjar.

Fixes: 119516143
Test: m out/target/common/obj/APPS/TeleService_intermediates/classes.jar
Change-Id: I7e9f7ff34de565a986ab0dc6e375f606c91c3846
2021-02-08 10:14:04 -08:00
Jingwen Chen
033bfa6e29 Merge "queryview: blocklist package module type." 2021-02-08 15:18:19 +00:00
Jingwen Chen
1a0485b34e Merge "bp2build: Refactor CreateBazelTargetModule API." 2021-02-08 14:08:05 +00:00
Jingwen Chen
96af35bec6 queryview: blocklist package module type.
The package module type was recently introduced, and its module name is
the full package path. queryview uses the module name as the eventual
target name in the generated BUILD files, so this causes a crash as seen
in b/179605762.

Workaround this by not generating package modules in the queryview
directory.

Test: m queryview && bazel query --config=queryview //...
Fixes: 179605762
Change-Id: Iac2bd79d02bec47d6271583d106c184fb2f16e68
2021-02-08 00:49:32 -05:00
Paul Duffin
01289a2407 Add test for hiddenAPI index file generation
The index file and the metadata file both currently include duplicate
entries due to them including both the <x> and <x>.impl libraries
created by java_sdk_library in their inputs, plus including both source
and prebuilt versions of the same named module. This change adds a test
to illustrate that behavior. A follow up change will correct the problem
and update the test accordingly.

This change only adds a test for the index file because the metadata
file depends on files from frameworks/base which makes it difficult to
test. Bug 177317659 will fix that and allow the metadata file
generation to be tested too.

Bug: 178361284
Test: m nothing
Change-Id: I33921d7267c9f4bb42726343d73f8a396d536aaa
2021-02-07 10:58:24 +00:00
Paul Duffin
89886cbdb0 Ensure subtest failures are reported on subtest
A subtest (code inside the func passed to t.Run(...)) are passed their
own t *Testing pointer to use to report errors in order to ensure that
they are treated as errors of the subtest and not the containing test.

This change ensures that the subtests in the following tests use the
correct t *Testing.
* TestPrebuiltExportDexImplementationJars
* TestBootDexJarsFromSourcesAndPrebuilts

Bug: 178361284
Test: m nothing
Change-Id: I4e8b166051cb6098c89d8e68a450c81a714f7677
2021-02-07 10:58:24 +00:00
Paul Duffin
254aee4843 Merge changes I9e94662d,I4b4e0dc8
* changes:
  Export implementation class jars for java_boot_libs
  Improve module filtering in hiddenapi stubFlagsRule()
2021-02-07 10:52:01 +00:00
Ivan Lozano
a707092636 Merge "rust: Only pass "-lstatic" for rlibs." 2021-02-06 04:47:03 +00:00
Treehugger Robot
b02128ad0b Merge "Remove libbinder_headers from apex_available allowlist" 2021-02-06 03:20:47 +00:00
Jooyung Han
7701309889 Merge "cc: fix version macro for stubs" 2021-02-06 01:41:31 +00:00
Colin Cross
d685adb245 Merge "soong_zip: don't glob RSP file entries" 2021-02-05 21:33:37 +00:00
Jose "Pepe" Galmes
c64b961708 Merge "Generate fake versions of modules excluded in directed vendor snapshot." 2021-02-05 17:54:48 +00:00
Jose Galmes
0a942a0368 Generate fake versions of modules excluded in directed vendor snapshot.
When using the directed vendor snapshot, the build fails because soong
fails to find some variants of the modules that have been excluded
from VENDOR_SNAPSHOT_MODULES, even though those modules are not going
to be used by the build.

The solution implemented here is to generate fake versions of those
modules (empty files) and include them in the generated Android.bp,
so that soong finds the modules, even though trying to use them would
fail.

Bug: 171821997
Bug: 179275601

Test: source build/envsetup.sh
Test: m -j nothing

Change-Id: Ibd3e963ab3e5504c0ac817f7cabbd241bf47a5cb
2021-02-05 17:53:53 +00:00
Ivan Lozano
fb6f36f3e4 rust: Only pass "-lstatic" for rlibs.
Passing '-lstatic' for dylib static dependencies results in some
unexpected bloat as the static libraries are included as
whole-archives.

For now, limit this to rlibs while we investigate.

Bug: 175886967
Bug: 179122837
Test: cd system/bt/; mma
Test: Checked size of dylibs.
Change-Id: Id8328e95771e2ca8503bc8df35248b1c39cabc8e
2021-02-05 12:32:47 -05:00
Treehugger Robot
b3f9025b6e Merge "Support uncompressed cpio" 2021-02-05 15:57:22 +00:00
Ivan Lozano
729d5cf097 Merge "rust: Pass cc static libs to rustc." 2021-02-05 15:53:33 +00:00
Jingwen Chen
1fd14691dd bp2build: Refactor CreateBazelTargetModule API.
This CL refactors the CreateBazelTargetModule API to minimize boilerplate, and to establish a well defined function signature for the expected metadata about a BazelTargetModule.

Test: soong tests

Test: TH
Change-Id: I474ff5a2b0db8deeed49ba4ca73b416ccb494fdd
2021-02-05 09:24:55 -05:00
Liz Kammer
b7eab01167 Merge "bp2build: convert paths/module refs to Bazel label" 2021-02-05 13:39:08 +00:00
Paul Duffin
22ff0aaf51 Export implementation class jars for java_boot_libs
Hiddenapi processing currently requires access to the class
implementation jars for libraries on the bootclasspath which means that
they need to be provided as part of the prebuilts. This change modifies
the java_boot_libs property on the sdk to make those files available.

Modularization of the hiddenapi processing will hopefully remove the
need for these to be exported so this should be temporary.

Bug: 178361284
Test: m art-module-sdk
      check generated snapshot zip contains implementation jars
Change-Id: I9e94662dddb0ddb85a477ae6d27e533085147e88
2021-02-05 13:35:25 +00:00
Paul Duffin
dd63d6d7bd Improve module filtering in hiddenapi stubFlagsRule()
Previously, it ignored any module that was not a platform apex variant
however that required every module that was referenced from the boot
jars to have a platform variant which is not the case when building
from prebuilts.

This change switches it to explicitly check that the variant is for
either the appropriate apex or the platform depending on what is
configured in the BootJars or UpdatableBootJars.

It partially duplicates some logic from the getBootImageJar() function.
It intentionally does not refactor the getBootImageJar() to allow for
reuse because coupling the hiddenapi and dexpreopt logic would make
refactoring either of them more difficult. Any duplicated code will be
deduped once they have both been refactored.

Bug: 178361284
Test: m droid
Change-Id: I4b4e0dc8ee40c1ba1713d7ef72df13d175e84af6
2021-02-05 13:33:25 +00:00
Treehugger Robot
b89336487e Merge "bp2build: fix BUILD file generation incrementality bug." 2021-02-05 12:05:57 +00:00
Ulyana Trafimovich
9b91082452 Merge "Don't write nonexistent DEX file paths to dexpreopt.config files." 2021-02-05 11:10:03 +00:00
Paul Duffin
b8887127ba Merge "Detect empty apex in ConfiguredJarList" 2021-02-05 09:30:15 +00:00
Yan Yan
3a5c0af0fb Merge "Change IKE min_sdk to 30" 2021-02-05 07:33:56 +00:00
Jingwen Chen
7dcc4fcc68 bp2build: fix BUILD file generation incrementality bug.
Before this change, changes to any Android.bp file would not trigger a re-run of bp2build/Soong, since the depfile for Soong's main output, the build.ninja file, didn't contain the list of Android.bp files. bp2build only reran when Soong itself changed, which happens regularly while developing bp2build, but not at all while modifying Android.bp files.

This change correctly dumps the list of all Android.bp files in the tree to the depfile for out/soong/build.ninja, therefore correctly triggering a re-run of bp2build when any Android.bp file changes.

Test: GENERATE_BAZEL_FILES=true m nothing; edit an Android.bp file; GENERATE_BAZEL_FILES=true m nothing -> successfully re-runs and regenerates out/soong/bp2build.

Test: inspect out/soong/build.ninja.d manually
Fixes: 179452534

Change-Id: Iad80c381b3afa38a4d4fafca035e46aa2a1f206a
2021-02-05 01:33:47 -05:00
Jooyung Han
59d0931de7 Remove libbinder_headers from apex_available allowlist
libbinder_headers now sets apex_available property.

Bug: 150999716
Test: m
Change-Id: If58cfeafcc13fc36be8e44a66f2f472460fd4c8d
2021-02-05 15:32:40 +09:00
Treehugger Robot
f860a2ab66 Merge "data dependency of java_test_host can be arch-specific" 2021-02-05 04:15:42 +00:00
Treehugger Robot
364da36115 Merge changes I6a5357e9,I199f070e
* changes:
  Install ko to /lib/modules
  android_filesystem is OutputFileProducer
2021-02-05 03:39:51 +00:00
Treehugger Robot
87bd0f3c22 Merge "New header lib added to apex/allowed_deps.txt" 2021-02-05 03:34:48 +00:00
Treehugger Robot
d0347e4d32 Merge "clean up some hard-coded min_sdk_version" 2021-02-05 02:54:43 +00:00
Jooyung Han
11b0fbdbf6 cc: fix version macro for stubs
When a cc module is built against a stub, compiler passes version macro
of the stub lib. Version macro should be numeric, so codenames or
"current" should be mapped to numbers just like how ndkstubgen maps to.

* "current" -> future (10000)
* codenames -> look up api_level.json
* otherwise -> cast to int

Bug: 179329813
Test: m / soong test / manually check the output build.ninja
Change-Id: Ic0e1dd904984e161694a0b77fad5559c06a4462f
2021-02-05 11:27:57 +09:00
Treehugger Robot
2ad91929d2 Merge "Add file_contexts property to filesystem" 2021-02-05 02:03:52 +00:00
Treehugger Robot
4f67b03e8b Merge changes I904b4374,I6b4ea062
* changes:
  Do not add '.product' suffix for product_specific module
  Use target dependent module to update the name suffix
2021-02-05 01:52:04 +00:00
Chih-hung Hsieh
adeb44b112 Merge "Disable gnu-folding-constant warning." 2021-02-04 23:59:27 +00:00
Ivan Lozano
3dfa12db6c rust: Pass cc static libs to rustc.
Pass static libraries to rustc via the "-lstatic" flag so that rustc can
reason how to handle these libraries. This means that these static
libraries get bundled into rlibs, reducing the need to redeclare these
dependencies in dependent modules.

Additionally, exported depFlags were never used anywhere, so remove this
from flagExporter.

Bug: 175886967
Bug: 179122837
Test: m
Test: Checked that static symbols aren't duplicated in a resulting
      binary when it appears in a dependency graph more than once.
Change-Id: Ifeb3c384e4fad8704206997242a0156ddcb87d2c
2021-02-04 16:29:02 -05:00
Chih-Hung Hsieh
72e88767dc Disable gnu-folding-constant warning.
New clang compiler issue too many such warnings.

Bug: 179065588
Bug: 179309338
Bug: 179278370
Test: make, presubmit
Change-Id: I9948a4b34ec75a01aa24c2fd753722b072ae5202
2021-02-04 11:46:40 -08:00
Liz Kammer
356f7d45c1 bp2build: convert paths/module refs to Bazel label
This currently expands all globs, still need to support converting glob
syntax.

Test: go build_conversion_test
Test: GENERATE_BAZEL_FILES=true m nothing
Test: m nothing
Bug: 165114590
Change-Id: If7b26e8e663d17566fad9614ca87a8da1f095284
2021-02-04 13:45:56 -05:00
Jiyong Park
837cdb2212 Support uncompressed cpio
Bug: 178978059
Test: atest VirtualizationHostTestCases
Change-Id: I1f69af40f10d14ec2f3de6111d12b3a9c5d6c75c
2021-02-05 00:29:47 +09:00
Jiyong Park
cdd9b8392d data dependency of java_test_host can be arch-specific
This allows java_test_host to have arch-specific data files. Currently,
VirtualizationHostTestCases needs this to have arch-specific kernels as
its data.

Bug: N/A
Test: m VirtualizationHostTestCases
Change-Id: Ib5680ef48b613955ad92c9bc212184ac75900d3e
2021-02-05 00:29:47 +09:00
Jiyong Park
599992bc3e Install ko to /lib/modules
... not to /lib/module

Bug: 178980227
Test: m
Change-Id: I6a5357e9e83e736181b885b64c76e0b7e5ffadf2
2021-02-05 00:29:47 +09:00
Jiyong Park
940dfd4db2 android_filesystem is OutputFileProducer
... to be able to reference the module in data property of test modules.

Bug: N/A
Test: m VirtualizationHostTestCases
Change-Id: I199f070e811011cea6189ef24c0b2d8a683f79d0
2021-02-05 00:29:47 +09:00
Ulya Trafimovich
c0f64799da Don't write nonexistent DEX file paths to dexpreopt.config files.
A path to an nonexistent file caused dex2oat to write an empty path in
the class loader context stored inside of the OAT/ODEX file, which
resulted in class loader context mistmatch and a failure to load
dexpreopt code on device.

An example of a faulty class loader context for GoogleDialer, can be
seen either with oatdump or by grepping logcat for class loader context
mimatch messages (the first empty PCL[] is expected, note the second
empty PCL[] in the subcontext for shared libraries):

  PCL[]{PCL[]#PCL[/system/framework/org.apache.http.legacy.jar*22205474]

This CL removes the nonexistent path from the generated dexpreopt.config
file, which works in conjunction with a change in makefiles that stops
using the removed config field. This is possible because makefiles can
access DEX files using a module name and "intermediates-dir-for" macro.

Bug: 132357300
Test: lunch cf_x86_64_phone-userdebug && m && launch_cvd \
      adb wait-for-device && adb root && adb logcat \
      | grep -E 'ClassLoaderContext [a-z ]+ mismatch'
      # empty grep output, no errors
Change-Id: I8d16f77c6f76ad6234cc4114ad3545cbe572ef13
2021-02-04 12:14:51 +00:00
Paul Duffin
9c3ac96f1f Detect empty apex in ConfiguredJarList
Previously, ConfiguredJarList would accept an empty apex name,
e.g. ":jar" which makes no sense as every apex has to have a non-empty
name. This change makes an empty apex invalid.

In order to improve the test coverage of the TestConfiguredJarList test
this change also changes the implementation of
CreateTestConfiguredJarList([]string) to marshal the supplied strings
into a json list and then unmarshal into a ConfiguredJarList which more
closely matches how it is used at runtime.

Bug: 178361284
Test: m nothing
Change-Id: I7dfec6b4cc1923aa99746e976da0393922ef0791
2021-02-04 10:07:41 +00:00
Jooyung Han
67363e6be7 clean up some hard-coded min_sdk_version
androidx libs don't need hard-coded min_sdk_version any longer.

Bug: 158059172
Test: m
Change-Id: I1ba48b030604562dd74574ae163cb2ec01a47c4a
2021-02-04 15:34:55 +09:00
Inseob Kim
53b2427fc9 Merge "Allow common arch for recovery" 2021-02-04 06:19:28 +00:00
Inseob Kim
cc8e536a15 Add file_contexts property to filesystem
Filesystems like ext4 can store file contexts itself. This supports
passing file_contexts file to build_image.

Bug: 178993690
Test: boot and see selinux denials are gone
Change-Id: I97d4a981e4b9c89434ea2f1303173ae91cce94e3
2021-02-04 13:28:20 +09:00
Jooyung Han
575b608683 New header lib added to apex/allowed_deps.txt
libbinder_headers_platform_shared is a new header lib shared between
libbinder/libbinder_ndk. Since it is re-exported via libbinder_headers,
it should be added to allowed_deps.txt as well.

Bug: 179020493
Test: m
Test: aidl_integration_test
Change-Id: I7fe89766c8e7924edf2a3ddd69c2876611d0dd0a
2021-02-04 11:30:49 +09:00
Julien Desprez
23c38fa9a7 Merge "Test changing default of cc_test_host" 2021-02-04 00:47:24 +00:00
Colin Cross
caf4d4c270 soong_zip: don't glob RSP file entries
File arguments are considered globs, but RSP file entries should be
considered filenames without globbing.  Escape RSP file entries so
they don't get treated as globs later.

Bug: 179297188
Test: zip_test.go
Change-Id: I1de7829c668538204fc4a2ac793a4f88dbc886c9
2021-02-03 16:06:20 -08:00
Yan Yan
4e9eef5702 Change IKE min_sdk to 30
This is generated by build/soong/scripts/update-apex-allowed-deps.sh

Bug: 177266501
Test: builds
Change-Id: Ie7d43501def9a72d019c886df1f379410ffb1527
2021-02-03 15:51:27 -08:00