Commit graph

37964 commits

Author SHA1 Message Date
Paul Duffin
869de147ab Propagate permitted packages to sdk snapshot
Previously, permitted_packages were not copied to the sdk snapshot.
This change corrects that.

Bug: 193763688
Test: m nothing
      - Added unit tests, which all failed and then fixed the tests.
Change-Id: I4560987f746f78c0ae706058195b6db4bea438aa
2021-07-15 14:15:58 +01:00
Ulyana Trafimovich
bd14f9a952 Merge "Drop "prebuilt_" prefix when adding libraries to class loader context." 2021-07-15 10:15:44 +00:00
Ulyana Trafimovich
7beb099546 Merge "Drop strings.HasPrefix when guarding strings.TrimPrefix." 2021-07-15 10:15:26 +00:00
Paul Duffin
4e444dab84 Merge "Support generating sdk snapshots that can be selected by Soong config vars" 2021-07-15 07:59:06 +00:00
Ulya Trafimovich
69c1aa94ac Drop "prebuilt_" prefix when adding libraries to class loader context.
This is needed when some source libraries get replaced with prebuilt
variants: CLC should contain one entry for a library (the prebuilt one
or the source one, whichever of them is preferred). Because the prebuilt
module name starts with "prebuilt_" prefix, previously Soong considered
such libraries as two different ones libraries and added both to CLC.

Bug: 193425964

Test: mark "prebuilt_android.net.ipsec.ike" as preferred and `m nothing`
      (before this CL it would fail the build, now it builds fine).

Test: $ lunch aosp_cf_x86_64_phone-userdebug && m && launch_cvd
      $ adb wait-for-device && \
        adb root && \
        adb logcat | \
        grep -E 'ClassLoaderContext [a-z ]+ mismatch' -C 1
      # empty output, no errors
Change-Id: Icc42533d9915060d7fffda12aa93b9d18dc4f83d
2021-07-15 08:30:27 +01:00
Ulya Trafimovich
497a09310b Drop strings.HasPrefix when guarding strings.TrimPrefix.
There is no need to check as `TrimPrefix` does nothing if the prefix
doesn't match (see https://pkg.go.dev/strings#TrimPrefix).

Bug: 193425964
Test: m nothing
Change-Id: Ieb82e72a471800e29eb6bb54308041a9ab4173e5
2021-07-15 08:30:27 +01:00
Treehugger Robot
75d719fdd7 Merge "dexpreopt.config should be created even though unbundled image is built" 2021-07-15 03:41:30 +00:00
Jeongik Cha
4b073cd083 dexpreopt.config should be created even though unbundled image is built
Bug: 188179858
Test: compare dexpreopt_config.zip files from
 1. TARGET_BUILD_UNBUNDLED_IMAGE=true m dexpreopt_config_zip
 2. m dexpreopt_config_zip
(note that m clean should run between steps)

Change-Id: I36a6e8b10b9922cc5522accaf90af1aa05049a86
2021-07-15 09:57:49 +09:00
Paul Duffin
fb9a7f99be Support generating sdk snapshots that can be selected by Soong config vars
Allows the builder of an sdk snapshot to specify a Soong config
variable that can be used to control whether the snapshot's prebuilts
are used or not.

Bug: 193523070
Test: m nothing
Change-Id: Ib09500ba61befc1202dff61dc06847c730ba9253
2021-07-14 23:19:53 +01:00
Paul Duffin
e88944c51e Merge "Choose prebuilt or source via an Soong config variable" 2021-07-14 20:23:34 +00:00
Paul Duffin
0c52c7ba63 Choose prebuilt or source via an Soong config variable
A simple way to provide fine grained control over the use of a prebuilt
or source module via a Soong config variable.

Bug: 193523070
Test: m nothing
Change-Id: I47ae8ac04fa29156d2e87efd9e60ab995f50ea6d
2021-07-14 20:23:06 +00:00
Treehugger Robot
e04058f291 Merge "Add ClassLoaderContextMap.Dump()" 2021-07-14 12:57:56 +00:00
Treehugger Robot
257608f993 Merge "SdkLibraryImport's DexJarInstallPath uses installPath from source module" 2021-07-14 00:47:40 +00:00
Treehugger Robot
5445c84f4d Merge "Export paths for the snapshot modules" 2021-07-14 00:08:12 +00:00
Christopher Parsons
ace3b7f0a2 Merge "Seperate asflags and cflags" 2021-07-13 21:03:27 +00:00
Chris Parsons
69fa9f9e5e Seperate asflags and cflags
This fixes a bug which was a misunderstanding of soong properties:
Soong's cflags pertain only to C and C++ language, whereas bazel's copts
pertain to all three languages. This change ensures that asflags are
added as specifically asflags, and the 'copts' for the static library
macro pertains only to C and C++ languages.

This requires a somewhat hacky workaround for asflags, however: Since
assembly sources also need includepath-related flags, this duplicates
these flags between copts and asflags. To reduce verbosity of
bp2build-generated targets, this also ensures that asflags are omitted
in cases where there are no assembly sources.

Test: Mixed build droid CI
Change-Id: Ic0babed1f90d6dc82e5788638681ce5b995043f8
2021-07-13 14:06:14 -04:00
Yuntao Xu
49e4187e43 Merge "convert flag options and values in the same line" 2021-07-13 17:11:00 +00:00
Paul Duffin
b1b4d856e1 Add ClassLoaderContextMap.Dump()
Test: n/a
Change-Id: I1e1ad0093301a463d8d03b07cf58710b65e3dc6d
2021-07-13 17:03:50 +01:00
Jeongik Cha
d5fe8782e0 SdkLibraryImport's DexJarInstallPath uses installPath from source module
Even though actual installed module path is the same as source module,
it uses impl's one.

Bug: 188179858
Bug: 193082464
Test: compare dexpreopt_config.zip files from
  1. TARGET_BUILD_UNBUNDLED_IMAGE=true m dexpreopt_config_zip
  2. m dexpreopt_config_zip
  (note that m clean should run between steps)
Test: build aosp_cf_x86_64_phone,  launch_cvd, and then
  adb wait-for-device \
      && adb root \
      && adb logcat \
      | grep -E 'ClassLoaderContext [a-z ]+ mismatch' -C 1
      and then check if there is no message.

Change-Id: I34ffd9a2d214a6614c2befc35b2beec003cfcd25
2021-07-13 13:54:03 +00:00
Paul Duffin
73c7755ac9 Merge "Use bazel syntax for fully qualified name in path property" 2021-07-13 13:31:04 +00:00
Paul Duffin
ccabbfd941 Merge "Stop PathForModuleSrc from validating the paths unnecessarily" 2021-07-13 13:30:55 +00:00
Paul Duffin
fc78e2aad9 Merge "Add test to show broken behavior of fully qualified name in path property" 2021-07-13 13:30:44 +00:00
Pedro Loureiro
49e0e81155 Merge "make system server modules use filtered lint database" 2021-07-13 08:55:13 +00:00
Treehugger Robot
da70df7277 Merge changes from topic "vendor_snapshot-192647618"
* changes:
  cc/cc.go: Harden GetSnapshot() against nil pointer panic
  cc/cc.go: Add Device() method to LinkableInterface
2021-07-13 08:54:11 +00:00
Treehugger Robot
1c19b81e3d Merge changes Ibb6c4aed,I54af1654
* changes:
  AndroidProducts.mk file reader
  Soong variables reader
2021-07-13 02:44:58 +00:00
Justin Yun
d9e05750ba Export paths for the snapshot modules
Some makefiles require the paths to the snapshot to use the snapshot
resources. Export SOONG_{IMAGE}_{VERSION}_SNAPSHOT_DIR to make.

Bug: 187222756
Test: check ninja depedency with and without snasphots.
Change-Id: Ie817285d43db094335e4c81ebb6eca7007c5f37d
2021-07-13 11:36:24 +09:00
Alexander Smundak
ef13011dc2 Merge "Config variables reader" 2021-07-13 01:31:31 +00:00
Yuntao Xu
cc8287c494 convert flag options and values in the same line
1. Added the logic in the `androidmk` tool, to convert the flag options and their
corresponding values in the same line;
2. The flags for cc-type modules include asflags, cflags, clang_asflags, clang_cflags,
conlyflags, cppflags, ldflags, and tidy_flags;
3. The flags for java-type modules include apptflags, dxflags,
javacflags, and kotlincflags;
4. Two unit tests were added.

Bug: 192401704
Test: m androidmk
Test: TreeHugger
Change-Id: I2973ad49812e891079cd488e993f2d12c4da3797
2021-07-12 16:10:44 -07:00
Treehugger Robot
b9386b703e Merge "Share EffectiveLicenseFiles for snapshot modules" 2021-07-12 22:06:59 +00:00
Liz Kammer
e9204db2f3 Merge "Add bpfix to remove sanitize.scudo" 2021-07-12 20:49:02 +00:00
Liz Kammer
fbf51b67c9 Add bpfix to remove sanitize.scudo
scudo is not supported for Android 11+, sanitize.scudo is deprecated,
when running bpfix, remove it.

Test: go test bpfix tests
Change-Id: Ibb58bb302df3bad24cfce3ae98c65015c090853c
2021-07-12 15:28:21 -04:00
Paul Duffin
e6ba0723b1 Use bazel syntax for fully qualified name in path property
A module reference to a fully qualified module in a path property looks
like:
  //path:module
And with a tag:
  //path:module{tag}

At the moment the checking is quite lax but some follow up changes will
make it much stricter.

Bug: 193228441
Test: m nothing
Change-Id: Ie42edcfa33ec66fda5d75b3df1da73f56f147afd
2021-07-12 20:15:06 +01:00
Paul Duffin
407501b82c Stop PathForModuleSrc from validating the paths unnecessarily
PathForModuleSrc calls validatePath in order to convert the supplied
path components into a single path. Unfortunately, that corrupts a
fully qualified module name. So, when given "//namespace:module" it
treats it as a path and replaces "//" with "/". That replacement is
done by a call to filepath.Join().

This change simply concatenates the path components together textually,
using the path separator, to avoid the corruption. That ensures that
a fully qualified module name is preserved and processed properly. If
the path components do not contain a module name then expandOneSrcPath
will call pathForModuleSrc which validates the path so it does not open
up a way to create an invalid path as the validation was unnecessary
anyway.

Bug: 193228441
Test: m nothing
Change-Id: I0bb66feac182b77ce96c8d5d5f17e28ea28d75ba
2021-07-12 20:15:06 +01:00
Paul Duffin
ec0bd8cd9f Add test to show broken behavior of fully qualified name in path property
It reveals a number of issues:
* PathForModuleSrc corrupts the name during validation of path
  components.
* SrcIsModule and SrcIsModuleWithTag do not handle fully qualified names
  properly or detect invalid unqualified names.
* getPathsFromModuleDep does not handle fully qualified names.

Bug: 193228441
Test: m nothing
Change-Id: I583bc5e7f7df8a1b9cc32acefac3dbe43f49a27a
2021-07-12 19:05:39 +01:00
Paul Duffin
e1ef4763b4 Merge "Support customizing behavior around sourceOrOutputDependencyTag" 2021-07-12 17:45:01 +00:00
Paul Duffin
bea17eff14 Merge "Extract preparer for namespace" 2021-07-12 17:44:48 +00:00
Sasha Smundak
985d56c2ba AndroidProducts.mk file reader
Fixes: 182418325
Test: go test android_products_test.go
Change-Id: Ibb6c4aedacb891d5d7e74ce351b2e19c888adc5d
2021-07-12 09:40:18 -07:00
Sasha Smundak
472afabf95 Config variables reader
Fixes: 182330871
Test: go test config_variables_test.go
Change-Id: I89240fb0f1900172cb4d62057c86907bb9a1f58f
2021-07-12 09:40:18 -07:00
Sasha Smundak
1471eb2a8f Soong variables reader
Test: go test soong_variables_test.go
Bug: 182395579
Change-Id: I54af165455a7c3de826bf34db6ab88a05e15ca21
2021-07-12 09:40:18 -07:00
Paul Duffin
bb360c32b6 Move modules containing ART, conscrypt and i18n from libcore
This change moves the definitions of the following libraries which
directly include ART, conscrypt and i18n stubs, and their associated
java_system_modules from libcore to build/soong/java/core-libraries.
* core.current.stubs
* core-current-stubs-system-modules
* core.module_lib.stubs
* core-module-lib-stubs-system-modules
* legacy.core.platform.api.stubs
* legacy-core-platform-api-stubs-system-modules
* stable.core.platform.api.stubs
* stable-core-platform-api-stubs-system-modules

Bug: 193311122
Test: m droid
Change-Id: I42c4a0b5322897d40ecf41de088152dbdc526c96
2021-07-12 10:10:42 +01:00
Paul Duffin
d5cf92e298 Support customizing behavior around sourceOrOutputDependencyTag
Previously, modules customized behavior around the handling of
sourceOrOutputDependencyTag by comparing them to android.SourceDepTag
and retrieving the module using something like this:
    ctx.GetDirectDepWithTag(m, android.SourceDepTag)

The problem with that is it does not allow an output tag to be
specified and does not handle fully qualified names properly.

This adds the following:
* IsSourceDepTag and IsSourceDepTagWithOutputTag to check whether a
  blueprint.DependencyTag is a sourceOrOutputDependencyTag. The latter
  also checks that it has the correct output tag.
* GetModuleFromPathDep(ctx, moduleName, outputTag) as a replacement for
  ctx.GetDirectDepWithTag(m, android.SourceDepTag).

Replaces usages of:
* t == SourceDepTag with IsSourceDepTagWithOutputTag(t, "")
* ctx.GetDirectDepWithTag(m, android.SourceDepTag) with
  GetModuleFromPathDep(ctx, m, "")

It also deprecates the following:
* android.SourcDepTag - as a follow up change needs to modify the
  sourceOrOutputDependencyTag will make this useless.
* ExpandSources, ExpandsSources - copies existing deprecated messages
  from the implementation to the interface so that they can be seen
  by users of that interface.

Bug: 193228441
Test: m nothing
Change-Id: I8c397232b8d7dc1f9702c04ad45ea7819d4631ae
2021-07-09 23:54:01 +01:00
Paul Duffin
4fbfb59d3e Extract preparer for namespace
Bug: 193228441
Test: m nothing
Change-Id: If00b0595edd48be8c8d3308b87fb920dfb0340ee
2021-07-09 23:54:01 +01:00
Liz Kammer
1a0e2d20b3 Merge changes If89b7d0b,I630c06f0,Id861a62b,If71bb468
* changes:
  Iterate over sanitizers
  Update memtag code behavior to match comment.
  Reorganize memtag tests for clarity.
  Add comments to sanitizer properties.
2021-07-09 20:43:21 +00:00
Yuntao Xu
ec04417506 Merge "modify cc_binary type to cc_test for test modules" 2021-07-09 16:38:11 +00:00
Yuntao Xu
8f884a0a69 modify cc_binary type to cc_test for test modules
1. When a cc_binary type module has the non-empty test_suites field,
modify the type to cc_test;
2. Unit tests were also added.

Bug: 193071602
Test: m androidmk
Test: TreeHugger
Change-Id: Icfaa79998616c02bb086f81d194163feafb4c116
2021-07-08 15:13:25 -07:00
Liz Kammer
75db931843 Iterate over sanitizers
Test: go test soong tests
Change-Id: If89b7d0b04cad79b42a08504d4fcff36e914b7a4
2021-07-08 11:19:15 -04:00
Liz Kammer
7b920b4057 Update memtag code behavior to match comment.
Test: go test soong tests
Change-Id: I630c06f01c90256b1990c37b9236e8967a5fa316
2021-07-08 11:19:15 -04:00
Liz Kammer
d56ddb5482 Reorganize memtag tests for clarity.
Test: go test soong tests
Change-Id: Id861a62bd0ff2b6a5a4354fbda939e9ebb13a2a5
2021-07-08 11:19:15 -04:00
Liz Kammer
75b9b40a56 Add comments to sanitizer properties.
Test: n/a
Change-Id: If71bb4683a4ae969670235c51b3f1b3af2073f91
2021-07-08 11:19:12 -04:00
Liz Kammer
4aa48b03ea Merge changes I770f5ce7,I32d4417d
* changes:
  Remove IsDependencyRoot from interface
  Delete local boolPtr function
2021-07-08 13:11:17 +00:00