Convert all of the callers of OtherModuleProvider/OtherModuleHasProvider
to use the type-safe android.OtherModuleProvider API.
Bug: 316410648
Test: builds
Change-Id: Id77f514d68761a262d9ea830a601dbed804bbbe5
Convert all of the callers of SetProvider to use the type-safe
android.SetProvider API.
Bug: 316410648
Test: builds
Change-Id: If58f4b5355264ddab2045bc3591a4eac19cd58fc
Installed files should only depend on other installed files, change
the deps arguments of the ctx.Install* methods from Paths to
InstallPaths.
Bug: 311428265
Test: builds
Change-Id: I1ebef60a943bdbe907744cc43aa985371ac56d32
Merged-In: I1ebef60a943bdbe907744cc43aa985371ac56d32
This Cl adds a new rule to Soong to generate test spec metadata. Also, this CL adds a provider in various test module to provide test spec related data to the Soong rule.
Will add providers and test code to other Module in the future changes.
Provider added for the following test modules in this change: android_robolectric_test, android_test, bootclasspath_fragment_test, java_test, java_test_host, python_test, python_test_host, sh_test,and sh_test_host.
Bug: 296873595
Change-Id: I5f89f72d5874bb7838ae357efdb8c6ca208e18a7
The conversion of FirstUniqueStrings to be implemented on top of the
generic firstUnique accidentally used a different threshold to switch
from the list implementation to the map implementation. Modify the
threshold of firstUnique to match the old value from FirstUniqueStrings
now that it doesn't have the reflection overhead. While we're at it,
also make firstUnique make a copy of the list, and make FirstUniqueStrings
a pure wrapper around firstUnique.
Test: BenchmarkFirstUniqueStrings
Change-Id: Icc2febea663142c508ff2e4be65a8a68121631d5
Don't panic when the instrumented_for dependency is missing or when
instrumentedApp or files generated from instrumentedApp are nil. Fixes
unbundled tradefed build.
Fixes: 283451533
Test: tapas google-tradefed-all && BUILD_BROKEN_DISABLE_BAZEL=true nothing on tradefed branch
Change-Id: Ibcd0da75fc55c7c0a697e98ae6bdd9fd3662259c
Downstream infra needs this information to determine if a module is
testable to TradeFed.
Test: m out/target/product/coral/module-info.json
Bug: 268670243
Change-Id: Ibdf99c86cb6abe726552a6e4ffbdc756f751907b
Some tests need to add custom tradefed options, but still want to
keep most of the soong autogenerated tradefed xml file.
Expose a test_options: { tradefed_options: [...] } property that
will allow tests to add more options to the autogenerated xml file.
Fixes: 184895128
Test: go test, and verified that the ninja files did not change for aosp_arm64
Change-Id: I50d4ad139322e9e207202f1e1a50f5bbb424aa6f
This reverts commit 8ec823cba1.
Reason for revert: DroidMonitor: Potential culprit for Bug b/262965953 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.
Change-Id: I236cc36981d8b30527ca286632727f8ca267e969
Add AndroidMkEmitAssignList to emit a line to assign the items from
the given list of string arrays.
Test: treehugger
Change-Id: Id5acbef38ea4e91349bd2461f226db352d4b8123
Some tests need to add custom tradefed options, but still want to
keep most of the soong autogenerated tradefed xml file.
Expose a test_options: { tradefed_options: [...] } property that
will allow tests to add more options to the autogenerated xml file.
Fixes: 184895128
Test: go test, and verified that the ninja files did not change for aosp_arm64
Change-Id: I75f7eb002c8325ce7cdc76e12e76e16195320620
Mark Robolectric tests as belonging to the `robolectric-tests` suite
since tools expect test modules to belong to at least one suite.
Note that tests not marked with a suite implicitly get annotated with
the `null-suite`.
This is also required for Atest Bazel mode which only includes files of
test modules with a non-empty suite attribute in the Tradefed test
directory.
See aosp/2181295 for more details.
Test: m out/target/product/vsoc_x86_64/module-info.json
Bug: 222437352
Bug: 228799625
Change-Id: I9dedaf1661a351c32d2affbaf1f9b89d672acc3a
The first line of each section will be
```
include $(CLEAR_VARS) # <module type>
...
```
Bug: 257037252
Test: treehugger
Change-Id: Iba586155b682fe4e1e5817d8397eda8f9d9c8789
Allow new robolectric to break soong's exepected machine type restrictions
Test: mma in /external/robolectric
Bug: 244627502
Change-Id: If58a36b2d84804d586d9c8a773e2e739867fa987
Currently, Robolectric test written in Kotlin may not run, especially
when shards are in used, for example SettingsRoboTests has 10 shards.
This is because Robolectric test currently only recognize java files,
adding kt files to fix.
Rename current uniqueSrcFiles to uniqueJavaFiles, and compiledJavaSrcs
to uniqueSrcFiles. uniqueSrcFiles will contains both Java and Kotlin
files.
Note: android.FirstUniquePaths cannot be used, seems the behavior is
different and cause build error.
Bug: 252355400
Test: cd build/soong && mm
Test: m RunSettingsRoboTests with Kotlin tests
Change-Id: Id530ae4dcabffe01a06f44fe4234ffc67b73a601
Some libraries are only used for tests, but
are not test module types. These modules get warnings
about @VisibleForTesting usages when they really
shouldn't. Expose a test flag that module authors
can use to make lint treat a module as test code.
Bug: 235339747
Test: Manually tested applying it to SystemUI-tests
Change-Id: I1356749a669dc80a7725605d7159da27c9a211b4
Previously Soong's install rules have been disabled when embedded
in Make (ctx.Config().KatiEnabled() == true). The primary blocker
for moving installation into Soong has been the `required` proeprty,
which is too vague to be easily handled in Soong. Keeping
installation in Make has resulted in two host bin directories,
the Make-owned directory (e.g. out/host/linux-x86/bin), and the
Soong-owned directory (e.g. out/soong/host/linux-x86/bin). The
lack of knowledge in Soong about the final, Make-owned installation
location makes it hard to support NOTICE files entirely in Soong.
This patch begins to solve this problem by supporting the creation of
the installation rules into Soong, but rather than writing the rules
to the ninja file it writes them to a Makefile and lets Kati convert
them to ninja. This allows Kati to inject extra dependencies to
handle the `required` property.
Converting all modules to create their installation rules in Soong
would be too complex, so only modules that return true from
InstallBypassMake will use the Soong installation rules. This
is currently only set for robolectric tests.
Bug: 204136549
Test: m checkbuild
Change-Id: I28af9fa7fadece8ea1f98f5efd140c823751cae7
Robolectric tests are installed by Soong, which means Make doesn't
know about the install location to create the phony rules. Add
a phony rule in Soong for now until Soong's installation rules are
fleshed out.
Bug: 184946827
Test: m SettingsRoboTests
Change-Id: I60d76474949800e1a737714d86df84eff9a92214
Replace the android.BuildOs constant with Config.BuildOS so that it
can vary based on the product config.
Bug: 190084016
Test: all Soong tests
Change-Id: Ia67f872d8b2ab788747a22e3a9659dc21c9775cd
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
The version of robolectric in external/robolectric-shadows is based
on 4.1 and is difficult to update. Support using the prebuilt versions
in prebuilts/misc/common/robolectric, with the caveat that they won't
support the in-progress SDK version.
Bug: 181886851
Test: manual
Change-Id: Ie3a861cf6d637f97cf00212c02322f92c1043f0a
Export information about java dependencies through a Provider
instead of accessing the module directly.
Test: java_test.go
Test: no changes to build.ninja
Change-Id: Ifc5d566bf6f6ebc0ad399e948effaa1ef6a22876
I added in case anyone needs to access AndroidMkEntries to generate
footer lines, but nobody uses it, and it only confuses people.
Test: m nothing, TreeHugger
Change-Id: Ic8a450e3c306d9228c1fdec212c7441bd6aaee03
Enable the RuleBuilder and RuleBuilderCommand methods to access
the BuilderContext by passing it to NewRuleBuilder instead of
RuleBuilder.Build.
Test: genrule_test.go
Test: rule_builder_test.go
Test: m checkbuild
Change-Id: I63e6597e19167393876dc2259d6f521363b7dabc
I931f9145f1ced21a9f86d647cfbb6d2b645b4f18 made robolectric_android-all-stub
empty, breaking running robolectric tests packaged by Soong.
To enable using robolectric-host-android_all instead, make the
runtimes module a host module.
Also remove the empty robolectric_android-all-stub dependency.
Test: m checkbuild
Change-Id: Idc158d84fd8b6d98d824a6bdc8be297ac43ec2f2
This change fixes some places where host arch is assumed to be x86 to
form a path element like linux-x86. In preparation for non-x86 host
targets, the host arch part is derived from the context.
In addition, InstallForceOS() is refactored so that it can override not
only OsType, but also ArchType. Without this, the paths for the
robolectic modules will be changed from linux-x86 to linux-common, which
breaks several other places where the old paths are expected.
Bug: 134795810
Test: m
Change-Id: Ib38c715948ae546e55021ece82bac1d82e9e5da0
frameworks/base still has the tree on R while the build system considers
current development to be S which causes issues when Robolectric goes
looking for an R jar but instead finds an S jar. Therefore, for the
moment, we are hardcoding this to be tagged as R. In the future,
hopefully these two sources of truth can be aligned better.
Bug: b/157635117
Test: N/A or manual
Change-Id: I7495735b1c6c4369408bdf8805f59fad6aac5128
Instead of UnbundledBuild, use AlwaysUsePrebuiltSdks
to determine if java modules needs to be built against prebuilt sdks.
And rename UnbundledBuildUsePrebuiltSdks to AlwaysUsePrebuiltSdks to
express its behavior more correctly.(It can be orthgonal to "Unbundled")
Bug: 160390776
Test: TARGET_BUILD_UNBUNDLED_IMAGE=true m vendorimage
Change-Id: I0be7265c1959d8774c295372cd7a9250169f6df9
Package a slightly modified copy of the robolectric tests with
the dependencies statically included into the testcases directory
and into a robolectric-tests.zip.
Test: m robolectric-tests
Change-Id: I73f51727695136d2a849d36af1683e93f7e156a3
Add a rule that runs Android lint on each java and android module
and produces reports in xml, html and text formats.
Bug: 153485543
Test: m out/soong/.intermediates/packages/apps/Settings/Settings-core/android_common/lint-report.html
Change-Id: I5a530975b73ba767fef45b257d4f9ec901a19fcb
Use a method to add the properties that are present on all java modules.
Bug: 153485543
Test: m checkbuild
Change-Id: I7803b15eb0de810c8ab8d4b9acf2511935a26fb6
AndroidMkEntries now returns multiple AndroidMkEntires so that a module
can emit multiple Make modules if needed.
Bug: 128708192
Test: m
Change-Id: I56b6f76d22943b80329951c5acb80a1b932441ad
Move shardPaths and shardTests to android.ShardPaths and
android.ShardStrings for reuse in other packages.
Test: m checkbuild
Change-Id: I868802872c73616b80f56cbf11f959c01a8b793a
Add deviceProperties to robolectric tests so they can set
sdk_version. Use Dependency.BaseModuleName() instead of
ctx.OtherModuleName() to get the dependency name to pass to Make
to support prebuilts in libs, which may have a "prebuilt_" prefix
in ctx.OtherModuleName().
Test: m RunLauncherRoboTests
Change-Id: I59a889bd6107b989f336b147d0eaccabef611894
This change migrates some of AndroidMk()s in java/androidmk.go to
AndroidMkEntries(), mainly focusing on deduping test-related helper
funcs.
Test: Soong tests
Test: Built a system image
Test: Manual inspection of diffs
Change-Id: I7810085521600d9ea2df078837688ade41c04825
Explicitly pass the list of tests as LOCAL_ROBOTEST_FILES, and
support sharding the list of tests into multiple test runners.
Also filter out BaseRobolectricTest.java, which covers the only
use of LOCAL_ROBOTEST_FILES in Android.mk files.
Bug: 133878985
Test: m RunSettingsLibRoboTests runs the same number of tests before and after
Test: m RunSettingsLibRoboTests runs the same number of tests when sharded
Change-Id: Id85ffe03c98e722303eaa6def17812ed2244c6a6
I forgot we supported integer properties, use an integer instead
of a string for test_options.timeout.
Test: m checkbuild
Change-Id: I22d3135b31ec93d15b530c430b9e9cda6dd3f416