Commit graph

38563 commits

Author SHA1 Message Date
Treehugger Robot
3769a27c5e Merge "Add test to TestJavaStableSdkVersion for legacy core platform" 2021-09-20 14:04:35 +00:00
Martin Stjernholm
3536614edd Merge changes I464e6ebd,Iaf7655e4
* changes:
  Make it possible to pass an error message with an invalid optional path.
  Replace OptionalPath.valid flag by checking the path itself.
2021-09-20 13:03:20 +00:00
Martin Stjernholm
c32dd1c0ab Make it possible to pass an error message with an invalid optional path.
This is useful to delay errors until the paths need to be used.

Test: m nothing
Change-Id: I464e6ebd04b06c5e17617e8ee4e65a3320f1168f
2021-09-20 14:02:11 +01:00
Martin Stjernholm
2fee27f3c9 Replace OptionalPath.valid flag by checking the path itself.
Test: m nothing
Change-Id: Iaf7655e4676d2beeb7c7ac3bcba11a7dad4a01a3
2021-09-20 14:02:11 +01:00
Jingwen Chen
0c7ca97876 Merge "bp2build: add converted modules to codegen metrics, and remove the compat layer." 2021-09-20 08:27:34 +00:00
Martin Stjernholm
14cdd71152 Add a function to match modules through a variation map.
Can be a more convenient alternative than specifying the full subdir
concatenation of the variants. E.g. common arch and os variations don't
have to be hardcoded.

Test: `m nothing` with https://r.android.com/1801128
Change-Id: Ic2966e109d61dfee6a2b4fcbcbf8f73274babca9
2021-09-17 23:52:03 +01:00
Zach Johnson
5145e9d917 Add NFC to the Rust allowlist
rustfmt & preupload checks are being checked in shortly

Bug: 197333653
Test: compile
Change-Id: I91f14dc9a58d04fda6ae77de2ea5d85f481d0563
2021-09-17 12:08:44 -07:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
4aeaf37bb7 Merge changes from topic "mixed-build-cc-library-shared"
* changes:
  Expose TocFile via CcInfo
  Clean up StarlarkFunctionBody for getCcInfoType
  Incorporate cc_library_shared into mixed builds
2021-09-17 14:29:17 +00:00
Jingwen Chen
30204afc67 Merge "Remove __bp2build__ prefix trimming." 2021-09-17 13:01:17 +00:00
Jiakai Zhang
2c6ede11cc Merge changes I9c94a54a,Idc0c73a7
* changes:
  Preopt system server jars with updatable bootclasspath.
  Preopt APEX system server jars from prebuilts.
2021-09-17 11:20:10 +00:00
Jiakai Zhang
c9f9d56ed4 Merge "Revert^2 "Preopt APEX system server jars."" 2021-09-17 11:19:51 +00:00
Jingwen Chen
6117450ead bp2build: add converted modules to codegen metrics, and remove the
compat layer.

The list of converted modules is used for tracking bp2build progress.

The module_name_to_label aliases weren't really adding much value to
mixed builds, so let's drop the feature for now and simplify the code.

Test: CI
Test: USE_BAZEL_ANALYSIS=1 m droid
Change-Id: I3269344cfe6d1c72c108d66c6e820bc0ec19bb34
2021-09-17 08:47:16 +00:00
Jingwen Chen
16d90a8954 Remove __bp2build__ prefix trimming.
This is no longer needed after r.android.com/1792714

Test: CI
Change-Id: I808c3124cf1a4f3ebe5d25e41f346a818c3cc57c
2021-09-17 07:16:59 +00:00
Chih-hung Hsieh
935ae2c51d Merge "Use ccCmd to generate clang-tidy dependent file" 2021-09-17 01:59:23 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
62585e8436 Expose TocFile via CcInfo
To reflect what's provided in SharedLibraryInfoProvider

Move the logic for identifying the toc file into Starlark
instead of the Soong Go code.

Adapt TestGetCcInfoParseResults to expect the toc as well.

Test: build/bazel/cquery/request_type_test.go:TestGetCcInfoParseResults
Test: cc/library_test.go:TestCcLibrarySharedWithBazel
Test: build/bazel/ci/mixed_{libc,droid}.sh
Change-Id: I40ad47158cb98b14ca03c21e351988818cb01770
2021-09-16 20:55:10 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
4fbc62196d Clean up StarlarkFunctionBody for getCcInfoType
Instead of repeating, pull repetition into vars

Test: build/bazel/ci/mixed_{libc,droid}.sh
Change-Id: If3c8387ac0aeb6364e7e4bc58a4e3a39c3c708d5
2021-09-16 20:54:57 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
bc4e734e59 Incorporate cc_library_shared into mixed builds
The infrastructure is already there via its need in
`cc_library`. Therefore, just enable it by setting
the `bazelHandler` in `LibrarySharedFactory`, and
add a test to verify the functionality.

Bug: 198817980
Test: cc/library_test.go:TestCcLibrarySharedWithBazel
Change-Id: Ibff80616632af59a0e409110f8645e028f99c7d6
2021-09-16 18:13:52 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
ac5097fcf4 Create bp2build converter for cc_shared_library
Factor out shareable code with cc_static_library

Remove `Linkstatic` field for shared cases,
because it's redundant with the rule

Bug: 198241907
Test: cc_library_shared_conversion_test.go
Test: mixed_{libc,droid}.sh
Change-Id: I5be3b66f812893bce41edb425fbd143ab22d9051
2021-09-16 15:00:56 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
a5474e36c5 Remove Linkstatic field for static cases
With the explicit implementation of cc_library_shared,
this is now redundant for both, so remove it.

Test: cc_library_static_conversion_test.go
Test: mixed_{libc,droid}.sh
Change-Id: I6e7733ca08c254562e95e70d93c9f519719d8a18
2021-09-16 15:00:47 +00:00
Martin Stjernholm
33ce5d6c0e Merge "Remove fallback code path for missing BCP fragments that is no longer necessary." 2021-09-16 14:38:01 +00:00
Treehugger Robot
a66a9f1a14 Merge "Prevent systemserverclasspath_fragment from depending on prebuilts" 2021-09-16 11:34:03 +00:00
Paul Duffin
25322e4d98 Prevent systemserverclasspath_fragment from depending on prebuilts
When TARGET_BUILD_APPS is set then TARGET_BUILD_USE_PREBUILT_SDKS=true
which causes all java_sdk_library_import modules to be treated as
prefer:true.

That breaks the build when the systemserverclasspath_fragment's content
property references a source java_sdk_library module that has a
corresponding java_sdk_library_import prebuilt module.

This fixes the issue by marking the dependency from the
systemserverclasspath_fragment to the source module as one that must
not be replaced with a reference to the prebuilt module.

Test: - update art prebuilts to include service-art
      m TARGET_BUILD_APPS=Calendar apps_only
      - fails before, works afterwards
Bug: 199116972
Change-Id: Ia2d8ce7bb7e644336a42c901f7fb8ea50fd67909
2021-09-16 11:12:51 +01:00
Paul Duffin
1ea7c9fa52 Add test to TestJavaStableSdkVersion for legacy core platform
Adds a test case to TestJavaStableSdkVersion for the case where a
module uses sdk_version: "core_platform" but is in the list of modules
that can use the legacy version.

This required storing the lookup map in the Config to allow it to be
customized for the test.

Bug: 180399951
Test: m nothing
Change-Id: I404705c3fd8a559649c6ab2624856cf78f49f85c
2021-09-16 11:12:43 +01:00
Paul Duffin
9428970dac Improve the documentation in the android/sdk.go file
Makes it adhere to the go standard practice of prefixing documentation
comments with the name of the type/func/method.

Bug: 195754365
Test: m nothing
Change-Id: Idf3fe827edc9b6d67d12a99a4b27539ac938ea95
2021-09-16 09:06:50 +01:00
Paul Duffin
05732954c6 Remove unnecessary archTypeSpecificInfo.optimizableProperties()
The method is provided by an embedded type.

Bug: 195754365
Test: m nothing
Change-Id: I08ede08a393dbabf40f064befaf73ef2947380bd
2021-09-16 09:05:41 +01:00
Paul Duffin
f68f85a3ca Move setting of link type properties to linkPropertyInfo
Bug: 195754365
Test: m nothing
Change-Id: Ica90a42cd8e4a79251271164f137dcdf60b3bd55
2021-09-16 09:05:41 +01:00
Jiakai Zhang
519c5c82e5 Revert^2 "Preopt APEX system server jars."
This reverts commit 92346c4832.

Reason for revert: Fixed build error.

The build error is fixed by ag/15841934. This CL remains unchanged. This
CL will be submitted AFTER ag/15841934 is submitted.

Bug: 200024131
Test: 1. Patch this CL and ag/15841934 into internal master.
  2. sudo vendor/google/build/build_test.bash

Change-Id: I5f2b8357846fc7dda56e25ebe6ffb095e8047ec8
2021-09-16 06:25:26 +00:00
Chih-Hung Hsieh
8e09f2627d Use ccCmd to generate clang-tidy dependent file
* After this change, make libtinyxml2-tidy should generate
  correct out/.../libtinyxml2.tidy.d file.
  Touching one of the dependent files, e.g., tinyxml2.h,
  should invoke clang-tidy but not to recompile tinyxml2.o.
* Note that linking libraries still depend on .tidy targets,
  so make libtinyxml2 will call clang-tidy, regnerate
  tinyxml2.tidy.d, tinyxml2.tidy, tinyxml2.o.d, tinyxml2.o.
* A clang-tidy rule uses the same $cFlags for both clang and clang-tidy.
  To share it and avoid over long command lines, we use modern shell
  array variables and cannot use old bourne shell.

Bug: 199169329
Test: WITH_TIDY=1 make
Test: WITH_TIDY=1 make libtinyxml2-tidy | grep tinyxml2
Test: touch external/tinyxml2/tinyxml2.h; make libtinyxml2-tidy | grep tinyxml2
Change-Id: I6175add58d7313ee50c9308b78c9290a60770052
2021-09-16 02:25:52 +00:00
Treehugger Robot
b1a12462a9 Merge "Share cFlags, tidyFlags, etc. in a module" 2021-09-16 02:20:25 +00:00
Martin Stjernholm
b1e61cb8bc Remove fallback code path for missing BCP fragments that is no longer
necessary.

#codehealth

Test: m nothing
Bug: 179354495
Change-Id: Iaddf163e69b52cef82d522311e81bef9bdb4aa8d
2021-09-16 00:55:53 +01:00
Chih-Hung Hsieh
b8082295b6 Share cFlags, tidyFlags, etc. in a module
* In builder.go, share common flags in a module.
  * This replaces the sharing of cflags/cppflags/asflags in cc.go.
  * A unit test in apex_test.go now fails and is commented out.
    It is a failing test hidden by old optimization in cc.go.
* In module.go, expand the reference variable $someflags<n>,
  or ${someflags<n>} to keep many existing unit tests work as is.
* The build.ninja size was reduced from 8.1GB to 6.2GB,
  for aosp_arm64-eng WITH_TIDY=1 USE_RBE=true,
  and from 7.5GB to 5.6GB when USE_RBE is 0.
  Content of build.ninja is also more readable and searchable.
  Read/write build.ninja times are also reduced,
  depending on disk I/O speed.

Test: make WITH_TIDY=1
Change-Id: I17f96adf4844136d52e5d40f57a19d9e290162b7
2021-09-15 16:05:41 -07:00
Paul Duffin
96f1832762 Rename nativeLibInfoProperties.archType to archSubDir
Previously, the archType field was a string not an android.ArchType and
was used as the subdirectory into which arch specific files were
copied. This renames the field to archSubDir and clarifies the usage.

Bug: 195754365
Test: m nothing
Change-Id: Id4d6de12b40ee21e41bcd8b96a0ff04eaf615a80
2021-09-15 17:59:14 +01:00
Adrian Roos
79839d94c1 Merge "Revert "Preopt APEX system server jars."" 2021-09-15 14:31:42 +00:00
Adrian Roos
92346c4832 Revert "Preopt APEX system server jars."
This reverts commit ca9bc98e0c.

Reason for revert: breaks build
Bug: 200024131

Change-Id: Ide07b4c4d267370ae31107b1598b2f878c701282
2021-09-15 14:11:07 +00:00
Liz Kammer
83d07a4c41 Merge "Expand handling of unconverted deps in bp2build" 2021-09-15 13:49:48 +00:00
Paul Duffin
5ef58a302f Merge "Avoid direct access to Native_bridge_supported property" 2021-09-15 13:29:32 +00:00
Paul Duffin
c2c7f3e49b Merge "Rename SdkMemberTypeDependencyTag to SdkMemberDependencyTag" 2021-09-15 13:29:23 +00:00
Liz Kammer
adfade58a9 Merge "Bp2build: handle embedded structs as blueprint" 2021-09-15 12:39:29 +00:00
Jiakai Zhang
02669e8a30 Preopt system server jars with updatable bootclasspath.
Previously, we preopt system server jars without updatable bootclasspath
in the build system so that the artifacts can keep valid after a
mainline update. Things have been changed after then. We now re-compile
system server jars on the user's device after a mainline update
(b/189467174), so we no longer need the artifacts generated at build
time to keep valid. Therefore, we can preopt system server jars with
updatable bootclasspath to achieve better performance.

Bug: 199573699
Test: m services
Test: manual - 1. Build a system image and flash it into a device.
  2. adb root && adb shell grep "services" /proc/`adb shell pidof system_server`/maps
  3. See "/system/framework/oat/x86_64/services.{odex,vdex,art} in the
  output.
  4. adb logcat -d odrefresh:D odsign:D "*:S"
  5. See "odrefresh said artifacts are VALID" and no dex2oat invocation
  in the output.

Change-Id: I9c94a54aa15c46708067f4bc89ff05bc7af32a7b
2021-09-15 09:01:07 +00:00
Jiakai Zhang
ca9bc98e0c Preopt APEX system server jars.
The path to the artifacts will in the form of
/system/framework/oat/<arch>/<encoded-jar-path>@classes.{odex,vdex,art},
where <encoded-jar-path> is the path to the jar file with "/" replaced
by "@". For example,
/system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex

There will be a follow-up CL to update ART runtime to recognize
artifacts in that path.

Test: m com.android.art
Bug: 194150908
Change-Id: Ic89fd63c4b1cd565684cead83fc91dae3bc97a4c
2021-09-15 09:01:07 +00:00
Jiakai Zhang
204356f3b5 Preopt APEX system server jars from prebuilts.
Similar to the previous CL, but for jars from prebuilts.

Test: manual - 1. Patch aosp/1818020 and aosp/1810840.
  2. m SOONG_CONFIG_art_module_source_build=false com.android.art
Bug: 194150908
Change-Id: Idc0c73a78045a602ad3a91cb5071d291bd611015
2021-09-15 09:01:07 +00:00
Treehugger Robot
709f02707d Merge "Add system/sepolicy/apex to bp2build allowlist" 2021-09-15 08:10:14 +00:00
Treehugger Robot
cf6749630a Merge "Fix panic when a module has an invalid output path" 2021-09-15 04:23:13 +00:00
Cole Faust
64cb7c964a Fix panic when a module has an invalid output path
dep.OutputFile().Path() can panic if the OutputFile
is invalid, so move more of the code into the check
for validity. This changes the go crash into a
build error.

Bug: 158624492
Test: Apply the patchset 1 of ag/11815659, lunch aosp_x86_64-eng, m
Change-Id: Ic8a728be1b570ac73be7b2b9461676f9fd99c266
2021-09-14 17:35:19 -07:00
Guang Zhu
7b32612dc4 Merge "update build rules to use /data/local/tests/unrestricted" 2021-09-15 00:22:43 +00:00
Treehugger Robot
db3ff57368 Merge "Add {.aar} support for android_library" 2021-09-15 00:04:42 +00:00
Cole Faust
521e951ad4 Fix m product-graph
`m product-graph` runs a "non-full" build, which skips
some steps to improve performance. One of the steps
it skips is making a .installable_files file. Soong
reads this file and removes any files that were removed
from the list in this file. It errored out if the file
didn't exist. Make soong less strict about the presence
of this file, because if it doesn't exist, there shouldn't
be any installed files to remove either.

Fixes: 168105598
Test: rm -rf out/, m product-graph
Change-Id: I366f7b09d87911f9660d4e08c2d2f097cc04800f
2021-09-14 15:09:42 -07:00
Liz Kammer
37997c404b Add system/sepolicy/apex to bp2build allowlist
Technically, tzdata apex depends on
//system/sepolicy/apex:com.android.tzdata-file_contexts. Builds suceeded
regardless due to bp2build generating a filegroup for all files in a
directory.

This also requires an update to the check in apex/builder.go to address
the fact that outputs (including filegroups) from Bazel in mixed builds
will be in a Bazel out subdirectory. This change also corrects a
potential bug that would not support all subdirectories under
system/sepolicy as golang's path.Match does not treat ** as recursive.

Test: go test apex tests
Test: build/bazel/ci/mixed_droid.sh
Change-Id: I1076d60cf271e4cdd1ea990156ab0a39fcfa6535
2021-09-14 18:00:22 -04:00
Christopher Ferris
2551d2539e Merge "Make the script python3." 2021-09-14 21:03:01 +00:00
Saeid Farivar Asanjan
1fca301bd2 Add {.aar} support for android_library
Change-Id: I2c392d3dfc545c23495b03d0f236680fd59e1401
2021-09-14 21:02:43 +00:00