Commit graph

37952 commits

Author SHA1 Message Date
Yi-Yo Chiang
ba9ea32f73 Update comment text of SrcIsModuleWithTag()
The actual behavior of the method is slightly different from its text
right now. Update the text to describe the actual behavior.

Bug: 193228441
Test: m nothing (change is noop)
Change-Id: I755829af6aa1b3f95ac71f33d75751b94e71b54b
2021-07-15 17:18:21 +08: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
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
Justin Yun
885a7dea68 Share EffectiveLicenseFiles for snapshot modules
License files must be captured with the snapshot modules. NoticeFiles
does not have the information provided by the `license` module.
Reading the `Effective_license_text`, snapshot includes the required
license files.

Bug: 190690041
Test: build
      check the NOTICE files built from snapshots
Change-Id: I96c4579b4bef484cbb39fc06c707742a02a2b90b
2021-07-08 00:02:48 +00:00
Treehugger Robot
af60f411f8 Merge "Revert "Flag to control if generated SDK prebuilts are preferred."" 2021-07-07 20:49:14 +00:00
Liz Kammer
187d5445e8 Remove IsDependencyRoot from interface
This is equivalent to Binary() -- reduce the interface and improve
clarity.

Test: go test soong tests
Change-Id: I770f5ce79fd4d888586d31ec5e67be88153626b6
2021-07-07 16:29:09 -04:00
Liz Kammer
b2fc4700de Delete local boolPtr function
This is defined in proptools, no need to duplicate.

Test: go test soong tests
Change-Id: I32d4417dc4ae73bff98f36360ed22aed572d8c18
2021-07-07 16:29:09 -04:00
Mathew Inwood
7e9ddbe8c8 Revert "Flag to control if generated SDK prebuilts are preferred."
This reverts commit d0b99cea0a.

Reason for revert: Not needed anymore. We will simple exclude the 
gernated Android.bp files from prebuilt drops instead, it keeps
things simpler.

Change-Id: I5b01b2e01197f9fceb4630c8ade95f0d1d0f33f4
2021-07-07 12:47:51 +00:00
Paul Duffin
a56be7d781 Generate boot images for host from prebuilts
Previously, when building from prebuilts boot no rules were created to
produce the boot image files for the host, i.e. the OS on which the
build was running. That caused problems with checkbuilds. No rules were
produced as there was no host variant of a prebuilt apex to provide
them.

This change restructures the code to allow the prebuilt bootclasspath
fragment to build the host variants of the files from the dex files
provided by the prebuilt APEX. The generated files will not be the same
as they would be if built from source as there is no boot image profile
to use but it should be sufficient to satisfy the checkbuild target and
allow for host side testing.

Bug: 192575099
Test: m SOONG_CONFIG_art_module_source_build=false droid dist checkbuild
Change-Id: I6af00f19bb71aa18dd462f5eac6aa38e3e721023
2021-07-06 13:45:46 +01:00
Paul Duffin
8fc51a8eb6 Switch boot image generation to use GetGlobalSoongConfig(ctx)
Previously, boot image generation used GetCachedGlobalSoongConfig(ctx)
in order to get access to the GlobalSoongConfig. That required that
some other part of the code had called GetGlobalSoongConfig(ctx) to
initialize the cached value. That was left over from when the boot
image generation was done in a singleton which could not call
GetGlobalSoongConfig(ctx) directly. That is no longer true.

This change switches the uses of GetCachedGlobalSoongConfig(ctx) to
GetGlobalSoongConfig(ctx) and removes the now unnecessary call to
GetGlobalSoongConfig(ctx) from outside the functions.

Bug: 192575099
Test: m nothing
Change-Id: I34b7b1526d072d8b09fda7caa96e381695888e16
2021-07-06 12:51:04 +01:00
Pedro Loureiro
ffb643fc18 make system server modules use filtered lint database
Bug: 188851704
Test: m
Change-Id: Ie8f63286aeeb4cdbec5b9320c2ba41c8e37c7345
Merged-In: Ie8f63286aeeb4cdbec5b9320c2ba41c8e37c7345
2021-07-05 16:57:34 +00:00
Paul Duffin
452decbd88 Merge "Generate boot zip file from prebuilt_bootclasspath_fragment" 2021-07-05 12:01:46 +00:00
Yi-Yo Chiang
ec14a4ded8 cc/cc.go: Harden GetSnapshot() against nil pointer panic
* Retrieve SnapshotInfo only if the calling module is device-variant.
* Test for nil-ness before calling ctx.OtherModuleProvider().

Bug: 192647618
Test: Presubmit
Change-Id: Ida8582f756e1b15f8c14c816ed6e736b47995877
2021-07-03 19:20:02 +08:00
Paul Duffin
276fd424ad Merge "Use both module name and stem name to filter updatable boot jars" 2021-07-02 20:41:07 +00:00
Yi-Yo Chiang
36d8e4e201 cc/cc.go: Add Device() method to LinkableInterface
The intention is to make the next change more cherry-pick-friendly.

Bug: 192647618
Test: Presubmit
Change-Id: Ic84d3991a855e09aa9f46e12b759ad8142701e1f
2021-07-02 21:24:58 +08:00