Commit Graph

8392 Commits

Author SHA1 Message Date
Colin Cross
82201c2db1 Merge changes Ib238a83a,I9ed6a649 into main
* changes:
  Use rsp for kotlin classpath
  Move kotlin stdlib after javac jars
2024-08-08 18:11:59 +00:00
Treehugger Robot
edcbad4054 Merge changes Ifc905b14,I62166c6d into main
* changes:
  Fix IDEInfo for java_import
  Add IdeInfo for android_library_import
2024-08-08 01:24:10 +00:00
Spandan Das
6d26f80c6c Fix IDEInfo for java_import
`Jars` property in module_bp_java_deps.json should be relative to the
android build top, and not relative to the Android.bp file

Bug: 356572093
Test: m out/soong/module_bp_java_deps.json and verified that `jars` in
an arbitrary java_import module is relative to android top

Change-Id: Ifc905b14500dfa4254b27505fcc8af8f18349587
2024-08-08 00:06:29 +00:00
Spandan Das
b08bf77438 Add IdeInfo for android_library_import
The information will be used for IDE autocompletion.

Test: {
  "jars": [
    "out/soong/.intermediates/prebuilts/misc/common/androidx-test/androidx.test.core-nodeps/android_common/turbine-combined/androidx.test.core-nodeps.jar",
    "out/soong/.intermediates/prebuilts/misc/common/androidx-test/androidx.test.core-nodeps/android_common/busybox/R.jar"
  ],
  "path": [
    "prebuilts/misc/common/androidx-test"
  ]
}

Bug: 356572093

Change-Id: I62166c6d5cfa1cf0c49adf42d5d8b4ca40ab5a11
2024-08-08 00:06:23 +00:00
Colin Cross
1f75cdf980 Use rsp for kotlin classpath
Support long classpaths by passing the classpath in a file to the script
that generates build.xml.

Bug: 308016794
Test: builds
Flag: EXEMPT refactor
Change-Id: Ib238a83a26acba7ede8e55298397dbeb9a57a866
2024-08-07 14:11:43 -07:00
Colin Cross
edec77c453 Split jarjarIfNecessary out of compileJavaHeader
A future CL is going to change transitive classpath behavior when
jarjar is enabled.  In preparation, split the jarjar rules out
of compileJavaHeader into a separate jarjarIfNecessary method, and
use it on the classes and resource jars too.

Also tweak the naming of the output files in repackageFlagsIfNecessary
to be prettier.

Bug: 308016794
Test: all soong tests pass
Flag: EXEMPT refactor
Change-Id: I2b182cd30631f2bd7925341b9171e6b3c0e8d450
2024-08-07 14:11:43 -07:00
Colin Cross
d1d8f17e9e Move kotlin stdlib after javac jars
A future CL is going to treat local jars separately from dependency
jars.  Rearrange the order of the kotlin standard library jars to
come after the local jars produced by javac, which will better match
the future ordering and ease ninja file comparisions.

Bug: 308016794
Test: all soong tests pass
Flag: EXEMPT refactor
Change-Id: I9ed6a649350451bf1788077752db5222f50c0247
2024-08-07 14:11:43 -07:00
Colin Cross
7727c7f096 Convert JavaInfoProvider to *JavaInfo
Convert JavaInfoProvider to return a *JavaInfo instead of a JavaInfo.
This will reduce copying when reading the provider, and also allows
JavaInfo to recursively contain a depset of JavaInfos from
dependencies.

Bug: 308016794
Test: go test ./java/...
Flag: EXEMPT refactor
Change-Id: Ibf6d9b797f760ad1fe815d59839839fdfad91733
2024-08-07 14:11:43 -07:00
Treehugger Robot
d40aac1340 Merge "Don't hold on to WritablePath" into main 2024-08-07 20:48:50 +00:00
Treehugger Robot
6fb39c1fce Merge "Annotate Set property as android:Path" into main 2024-08-06 22:37:14 +00:00
Spandan Das
7811e46669 Annotate Set property as android:Path
This allows use of filegroups as inputs.

Test: go build ./java
Change-Id: Ibe8634b49c30dcf62f80dfa89875c43ad741eaff
2024-08-06 21:28:33 +00:00
Zi Wang
f5bf74f35d Merge "Remove unused tagSplitter function" into main 2024-08-06 19:36:03 +00:00
Treehugger Robot
4f18cfdd7d Merge "Revert "Revert "Enable from-text stub generation in non-sdk java..."" into main 2024-08-06 18:50:04 +00:00
mrziwang
d9279cd476 Remove unused tagSplitter function
Test: CI
Bug: 357675466
Change-Id: I844476e8afbf9f3cc9f4556ba27ea62f9262cb0c
2024-08-06 10:47:03 -07:00
Treehugger Robot
72ae33f6fa Merge "Disable ResourceProcessorBusyBox in kythe builds" into main 2024-08-06 17:34:36 +00:00
Spandan Das
29207b57cf Move the installation rules of boot images to soong
This CL adds moves the installation rules of boot images to soong. This
will eventually allow us to build devices by skipping `katiBuild` and
moving straight to `katiPackaging`

Details
1. Drop `no_full_install` from dex_bootjars singleton. This ensures that
   the files installed by this singleton module does not get skipped
when generating the soong installs file (out/soong/installs-*)
2. Replace PackageFile with InstallFile. This registers the installation
   rules for both make-built and soong-built images (e.g.
aosp_cf_system_x86_64)
3. Implement `AndroidMkEntries` for dex_bootjars singleton. OutputFile
   needs to be non-nil so that this module does not get elided when
generating out/soong/Android-*. `OutputFile` was abritrarily set to one
of the many files installed by this singleton.

Test: no diff in
target/product/vsoc_x86_64/obj/PACKAGING/system_intermediates/file_list.txt
(top of stack)
Bug: 355700341
Bug: 355703904

Change-Id: I3531defa6bba58ef78f6d66e881502a8222fc229
2024-08-06 02:27:17 +00:00
Spandan Das
a62d9563b4 Disable ResourceProcessorBusyBox in kythe builds
ResourceProcessorBusyBox generates the R.jar binary from R.txt without
creating an intermediate R.srcjar file. Disable this behavior in kythe
builds (ctx.Config().EmitXrefRules()) to support xrefs to R imports

Test: XREF_CORPUS=$internal_corpus m nothing
Test: aninja -t query out/soong/.intermediates/frameworks/libs/systemui/animationlib/animationlib_tests/android_common/animationlib_tests.kzip
Test: verified that an R.srcjar is present in its deps

Bug: 354854007
Change-Id: I2d63c3393c5bc58103c267c4593172ce77fbc79c
2024-08-06 00:45:49 +00:00
Jihoon Kang
b0f4c0239d Revert "Revert "Enable from-text stub generation in non-sdk java..."
Revert submission 3207397-revert-2982300-java_api_library_non_sdk-FIKZOSARQI

Reason for revert: Post submit build breakage culprit fixed

Reverted changes: /q/submissionid:3207397-revert-2982300-java_api_library_non_sdk-FIKZOSARQI

Change-Id: Ic79b7fd074f02febba94183cb1479874efe044b5
2024-08-06 00:15:25 +00:00
Treehugger Robot
9b10ca4711 Merge "Hide unflagged mainline prebuilts with missing source." into main 2024-08-05 23:10:53 +00:00
Jihoon Kang
f6d9965cc5 Merge "Revert "Enable from-text stub generation in non-sdk java_sdk_library"" into main 2024-08-05 20:51:31 +00:00
Liana Kazanova
a574cd28a8 Revert "Enable from-text stub generation in non-sdk java_sdk_library"
Revert submission 2982300-java_api_library_non_sdk

Reason for revert: DroidMonitor: Potential culprit for b/357648959 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Reverted changes: /q/submissionid:2982300-java_api_library_non_sdk

Change-Id: I5ef7afd9ec3e10ea99f82d02172843ad9b2cfda9
2024-08-05 19:45:03 +00:00
Spandan Das
85bd4625ed Hide unflagged mainline prebuilts with missing source.
Partner worksapces contain two versions of mainline prebuilts - BigAndroid
and Go. These two prebuilts export dexpreopt'd system server artifacts
to be installed in system image. Since the install paths are same, we
run into duplicate installation rules issue unless one of them is
hidden.

This hiding was previously done by creating a dependendency between
source aosp apex to BA and Go google prebuilts. However, this
implementaion had the unfortunate side effect on the packaging name of
the Google mainline prebuilts - the name becomes the aosp apex name.

Instead of creating the dependency to aosp apex, this CL hides all
mainline apex_set(s) if it has not been flagged using
RELEASE_APEX_CONTRIBUTIONS_*. Since there are some non mainline apex
prebuilts, apex_name will be used to determine whether the prebuilt is a
mainline module.

Test: m nothing --no-skip-soong-tests
Test: In partner workspaces, downloaded the CLs in b/355682304#comment7
Test: m out/target/product/generic/obj/PACKAGING/system_intermediates/file_list.txt
verified that aosp apexes are not installed, but mainline prebuilts are
installed

Test: unset RELEASE_APEX_CONTRIBUTIONS_ADSERVICES to build from source
Test: m out/target/product/generic/obj/PACKAGING/system_intermediates/file_list.txt
verified that aosp adservices is installed, and adservices prebuilt is
**not* installed.

Bug: 355682304
Change-Id: Idacb65313553bdea5c0593976694de478034229e
2024-08-05 18:25:37 +00:00
Treehugger Robot
99417ba9ea Merge "Enable from-text stub generation in non-sdk java_sdk_library" into main 2024-08-05 18:25:36 +00:00
Spandan Das
acfa26b5ba Merge "Create an installation rule to copy vdex to common arch device directory" into main 2024-08-05 16:38:53 +00:00
Spandan Das
715594304d Create an installation rule to copy vdex to common arch device directory
The installation rules for soong built system images are generated by
soong, but the installation rules rules for make built images are still
generated by make in dex_preopt_libart.mk. There is an existing
discrepancy between the two. Make built images generates three
installation rules for
1. system/framework/<primary_arch>/$bootjar.vdex (symlink)
2. system/framework/<secondary_arch>/$bootjar.vdex (symlink)
3. system/framework/$bootjar.vdex (actual file)

Soong copies the file to (1), creates a symlink from (2) to (1) and
skips (3) altogether. This CL makes the Soong installation rules match
Make installation rules. This will eventually allow
us to build devices by skipping `katiBuild` and moving straight to
`katiPackaging`.

Test: no diff in make built installed files
target/product/vsoc_x86_64/obj/PACKAGING/system_intermediates/file_list.txt
(top of stack)

Test: debugfs out/target/product/vsoc_x86_64/system/etc/aosp_cf_system_x86_64.img
verified system/framework/boot-apache-xml.vdex exists
verified system/framework/x86/boot-apache-xml.vdex exists as a symlink
verified system/framework/x86_64/boot-apache-xml.vdex exists as a symlink

Bug: 355700341

Change-Id: I52853c07674b77a984b5a5ac5dcd69236b642b46
2024-08-05 02:18:03 +00:00
Cole Faust
3bec2a77a6 Merge "Tag resource_dirs as android:"path"" into main 2024-08-01 17:22:45 +00:00
Cole Faust
d65add2253 Tag resource_dirs as android:"path"
Resource_dirs is queried using PathsWithOptionalDefaultForModuleSrc,
which includes all the infrastructure to resolve module references,
but needs to be tagged android:"path" to be able to add the module
references as dependencies.

Test: Manually
Change-Id: Ie3f75332c9a4cc0ee4b4c93268188440ff7ce249
2024-07-31 16:42:33 -07:00
Jerome Gaillard
6524e1d51c Merge "Handle missing dependencies in ravenwood.go" into main 2024-07-31 11:02:10 +00:00
Jihoon Kang
062eb663c5 Enable from-text stub generation in non-sdk java_sdk_library
This change allows from-text stubs to be generated for all
java_sdk_library modules, unlike how it is currently limited to the
modules that contribute to the api surfaces (i.e. the SDK).

This change accomplish this by modifying the dependency of the
from-text stubs generation, so that the sdk_library generated from-text
stubs generating java_api_library modules no longer depend on the full
api surface stubs, but generate the stubs in the module level, and
combined later to generate the full api surface stubs.

This change also removes the java_api_library modules defined in
core-libraries/Android.bp, which are passed to generate the system
modules. Given that the from-text vs from-source toggle is done within
the java_sdk_library stubs level, these modules no longer need to exist.

Implementation details:
- Allow sdk_version to be specified in java_api_library modules. For
  java_sdk_library-generated java_api_library modules, they inherit that
  of the sdk_library module. Some java_sdk_library modules that do not
  contribute to the api surface are allowed to set sdk_version to
  something other than "none" or "core".
- Implement java_api_library to implement `SdkContext`. This allows
  java_api_library to collect required deps from sdk_version (classpath,
  bootclasspath, system modules), and pass the collected jars when
  generating the stubs srcjar in metalava and compiling the stubs srcjar
  in javac.
- Remove hardcoded list of sdk_library modules that are allowed to
  genereate stubs from the api signature files, and allow from-text
  stubs generation by default. Modules that are not able to generate
  stubs from the api signature files are specified by setting the newly
  introduced `Build_from_text_stubs` property to `false`.

Test: ENABLE_HIDDENAPI_FLAGS=true m
Bug: 327507877
Change-Id: Ia35d2f3cf9fae48fc8c4bd99a84ae18d7c0e7bee
2024-07-30 22:35:06 +00:00
Colin Cross
7707b246ef Don't hold on to WritablePath
Since only a single rule can write to a given WritablePath, it is
unecessary to hold on to the WritablePath once the rule has been
created.  Keeping a WritablePath causes complications, as it
prevents using the input Path as the output when no modifications to
the input file are necessary.  The normal pattern should be to create
a WritablePath using PathForModuleOut, build the rule that writes to
the WritablePath, and then store the WritablePath as a Path for use
as an input to any future rules.

WithoutRel previously only existed on OutputPath, which required
keeping the output path of the module as an OutputPath for as long
as possible in order to call WithoutRel on it at the end of the module.

Add WithoutRel to Path, make it always return a Path type, and implement
it on all the types that implement Path by using a helper in basePath.

Replace long-lived WritablePaths with Paths.

Test: all soong tests pass
Flag: EXEMPT refactor
Change-Id: I40f28075ce151e4be80d6cfc7ec173dfa46f9bbf
2024-07-30 14:46:13 -07:00
Treehugger Robot
33128360bc Merge "Make stub_libs property configurable" into main 2024-07-30 21:34:47 +00:00
Cole Faust
aaff782cd6 Make stub_libs property configurable
To replace soong config module types with selects.

Bug: 342006386
Test: m nothing --no-skip-soong-tests
Change-Id: I76394c0c8e2bc98ec03a3a9d8cff0ba2af4ab0d1
2024-07-30 12:59:44 -07:00
Jerome Gaillard
44fc5bf548 Handle missing dependencies in ravenwood.go
This otherwise causes a crash when attempting any build
on macOS.

Test: build on macOS
Change-Id: Ib69160cd798091ae5f45416f332a0ea9927e1e50
2024-07-30 17:11:42 +00:00
Colin Cross
be891d5a52 Merge changes I5f2fd123,Ie8d8e229,Id2194f6b into main
* changes:
  Move RelativeToTop out of basePath
  Make PathForArbitraryOutput return an OutputPath
  Run TestClasspath subtests in parallel
2024-07-30 16:30:54 +00:00
Treehugger Robot
77cd0a0080 Merge "Introduce build_from_text_stubs property in java_sdk_library" into main 2024-07-29 23:13:52 +00:00
Jihoon Kang
48e2ac926b Introduce build_from_text_stubs property in java_sdk_library
Note that this property is currently a no-op. This change is submitted
separately in order to prevent submitting the entire topic in git_main
to mark a main-only module with this property.

Test: m nothing
Bug: 327507877
Change-Id: I62c2e3522bf9d0c5f7955e7c9bd2e0f66458e48c
2024-07-29 21:38:11 +00:00
Colin Cross
3b1c6847c4 Make PathForArbitraryOutput return an OutputPath
The only place basePath is used as a Path is when being returned from
PathForArbitraryOutput.  Using it as a Path requires implementing the
RelativeToTop() method on it, which then allowed that method to be
inherited by SourcePath, breaking the contract on RelativeToTop that
specifies that the returned Path is of the same concrete type as the
input Path.

Make PathForArbitraryOutput return an OutputPath, and update OutputPath
to support base paths that are not out/soong.  This also fixes
RelativeToTop, which was previously not working for PathForArbitraryOutput
paths.

Test: all soong tests pass
Flag: EXEMPT refactor
Change-Id: Ie8d8e2290961f35280e97137d2bd641c4d57ab87
2024-07-29 14:00:46 -07:00
Colin Cross
e0aa52f6c7 Run TestClasspath subtests in parallel
Call t.Parallel() to make the subtests of TestClasspath run in
parallel, which drops the runtime from 12 seconds to 1.7 seconds.

Test: TestClasspath
Flag: EXEMPT refactor
Change-Id: Id2194f6b5f925b480280e9cf8da5d5767a467430
2024-07-29 14:00:46 -07:00
Makoto Onuki
7c52907acf Merge "Support resource APKs" into main 2024-07-25 22:18:19 +00:00
Makoto Onuki
3380f6deb3 Support resource APKs
- android_ravenwood_test can now have `resource_apk: "ANDROID_APP_MODULE"`.
This will copy the APK to the test directory as "ravenwood-res.apk".

- android_ravenwood_libgroup can now have `data: ["MODULE"]`.
We use this to add framework-res.apk (as `data:["framework-res"]`)
to the ravenwood runtime path.

Bug: 339614874
Test: m nothing --no-skip-soong-tests
Test: ATEST="atest --no-bazel-mode" $ANDROID_BUILD_TOP/frameworks/base/ravenwood/run-ravenwood-tests.sh
   Do it on both aosp/main and goog/main

Flag: EXEMPT: Host side change only

Change-Id: I36516fec068a6359688a1dbedcb10a49c4631441
2024-07-25 12:41:07 -07:00
Rashid Zaman
3bd28705f4 Fix presigned apk check for privileged apps
The validation checks that run for presigned apps currently expect that
privileged apps have uncompressed dex files but if
DONT_UNCOMPRESS_PRIV_APPS_DEXS is true (UncompressPrivAppDex false) this
doesn't have to be the case so make the validation consistent with this.
Also make TestAndroidAppImport_Preprocessed verify that extra arguments
to 'check_prebuilt_presigned_apk.py' are correct for both privileged and
non-privileged apps.

Test: m nothing --no-skip-soong-tests
Test: Add presigned, privileged android_app_import module with
compressed dex to PRODUCT_PACKAGES for aosp_cf_x86_64_phone,
lunch aosp_cf_x86_64_phone-trunk_staging-userdebug &&
m DONT_UNCOMPRESS_PRIV_APPS_DEXS=true no longer fails due to validation
error.

Change-Id: I7e22cf525cd9d99d1ecb24e4e2e99c3f9de48146
2024-07-25 12:04:26 -07:00
Rashid Zaman
5800d421c3 Convert TestAndroidAppImport_Preprocessed to test fixtures
In preparation for a subsequent CL convert the test to use test
fixtures.

Test: m nothing --no-skip-soong-tests
Change-Id: I12f3802419105c7ffc8e00e95a069432c6b99d53
2024-07-25 11:27:58 -07:00
Filip Zakrzewski
c9f487b0e8 Add android.car.builtin to the Code Coverage instrumented list.
BUG=339901608

TEST=no

Change-Id: I3457dd843f3ebcefda4253b128ed142a7fa13e82
2024-07-24 04:27:45 +00:00
Treehugger Robot
b137e55a39 Merge "Specify Is_stubs_module property in top level sdk library" into main 2024-07-23 19:42:06 +00:00
Paul Duffin
278193669e Pass config files to metalava
Adds a filegroup "metalava-config-files" whose contents are passed to
Metalava using the `--config-file` option.

Bug: 354699349
Test: m checkapi
Change-Id: I1e246517c2ef678e41214c975aecee97f9faca67
2024-07-23 10:38:01 +01:00
Jihoon Kang
e4a9017327 Specify Is_stubs_module property in top level sdk library
java_sdk_library's "magic" will always resolve to stubs when either of
the following conditions are met:
- the module sets `api_only` property to "true": this signifies that
  the module does not create an implementation library, thus the "magic"
  always returns stubs
- the module sets `default_to_stubs` property set to "true": this
  signifies that the reverse dependencies outside of the same apex will
  always get the stubs, even when the rdep does not specify the
  sdk_version.

This change utilize this information and mark the top level sdk_library
as a stubs module when any of the above conditions are met, in order to
minimize the false positives in container violation errors.

Test: Run container enforcement and observe results
Bug: 354029496
Change-Id: I04b52c5662f635ab1837eb33a39f187ae8998238
2024-07-22 22:31:50 +00:00
Joe Onorato
a5d171773d Add jarjar_rename property to java modules.
It's the same mechanism that aconfig uses, but now it's exposed directly
to Android.bp files.  (I had wanted to test it out there before making
it a property just in case it didn't work well)

Bug: 352385368
Test: go test -v -run TestJarJar.*
Change-Id: I72d797d08a250be93779ee4b038a1b8fc62123b7
2024-07-20 17:46:15 -07:00
Spandan Das
8aac993b94 Add all compile deps to module_bp_java_deps.json
`Dependencies` in module_bp_java_deps.json currently only contains the
`libs` and `static_libs` of the corresponding module. This is only a
subset of the dependencies which are required to compile the java
module. Most notably, the SDK deps (determined using `sdk_version`) are
missing.

This CL adds all the compile dependencies to the json file. Implementation
details:
1. Add a `compileDepNames` to java.Module in base.go. Almost all the
   module types in java package are composed with the java.Module
struct.
2. Populate this property in java.Module.collectDeps. This function is
   used by java.Module.compile to determine the classpath used for
compilation.
3. Return `compileDepNames` in java.Module.CompilerDeps.

Since `compileDepNames` is populated in `GenerateAndroidBuildActions`,
update existing unit tests that check for correctness of IDEInfo.Deps

Bug: 353811607
Test: m nothing --no-skip-soong-tests
Test: cat out/soong/module_bp_java_deps.json | jq '."DebuggingRestrictionController".dependencies'
[
  "android_system_stubs_current", <-- missing previously
  "core-lambda-stubs", <-- missing previously
  "core-public-stubs-system-modules", <-- missing previously
  "com.google.android.material_material",
  ...
  ...
]

Change-Id: I166c0eaf6e87ca7adc98bb4e21447cf82612d103
2024-07-19 01:03:27 +00:00
Treehugger Robot
bd3fd1daca Merge "Populate java_api_libray's IDEInfo" into main 2024-07-18 22:29:17 +00:00
Spandan Das
4ae68018a0 Populate java_api_libray's IDEInfo
Adding the srcjar to module_bp_java_deps.json is useful for IDE
autocompletion of rdeps.

Bug: 353806911
Test: cat out/soong/module_bp_java_deps.json | jq '."core.current.stubs.from-text"'
{
  "dependencies": [
    "stub-annotations"
  ],
  "srcjars": [
    "out/soong/.intermediates/build/soong/java/core-libraries/core.current.stubs.from-text/android_common/metalava/core.current.stubs.from-text-stubs.srcjar"
  ],
  "path": [
    "build/soong/java/core-libraries"
  ],
  "libs": [
    "stub-annotations"
  ]
}

Change-Id: Ie4ad985a7da40b478453735dfdb10d0ac63ab8f4
2024-07-18 21:35:28 +00:00