Commit graph

30 commits

Author SHA1 Message Date
Colin Cross
c68db4b305 Remove InstallBypassMake and ToMakePath
InstallBypassMake and ToMakePath are obsolete, remove them.

Bug: 204136549
Test: m checkbuild
Change-Id: Ie5a6f7254b3d317ed6039e114ed6aec35e1ce273
2021-12-15 15:22:53 -08:00
Colin Cross
6301c3cffa Export Soong install rules to Make
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
2021-10-29 16:34:55 -07:00
Colin Cross
ffe2c918e9 Merge "Add phony name for robolectric tests" 2021-09-24 19:51:41 +00:00
Colin Cross
8304a1330e Add phony name for robolectric tests
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
2021-09-24 10:41:55 -07:00
Joseph Murphy
c964841e2d Changes tree built Robolectric name
Bug: b/194219998
Test: locally ran all in-tree Robolectric tests
Change-Id: If13583f6a2882e2e78d3004afc476debf6692df9
Merged-In: If13583f6a2882e2e78d3004afc476debf6692df9
2021-09-22 17:58:07 +00:00
Colin Cross
0c66bc615b Replace android.BuildOs with Config.BuildOS
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
2021-07-20 12:46:48 -07: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
Colin Cross
2787e8e65e Support robolectric prebuilts in android_robolectric_test
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
2021-03-05 19:22:30 +00:00
Colin Cross
dcf71b299c Convert java.Dependency to JavaInfo provider
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
2021-02-09 15:36:25 -08:00
Jaewoong Jung
02b11a6035 Remove AndroidMkExtraFootersFunc entries param.
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
2020-12-07 10:23:54 -08:00
Colin Cross
f1a035e6be Pass pctx and ctx to NewRuleBuilder
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
2020-12-01 16:22:16 -08:00
Joseph Murphy
bac4ee008b Merge "Adds a workaround to fix version inconsistency" 2020-11-17 01:23:39 +00:00
Colin Cross
5aa29a7fc2 Make robolectric runtimes a host module
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
2020-09-15 11:26:12 -07:00
Jiyong Park
87788b5247 Don't assume host arch is always x86
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
2020-09-08 15:12:10 +09:00
Joseph Murphy
bc98d2ffe8 Adds a workaround to fix version inconsistency
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
2020-08-20 00:45:45 +00:00
Jeongik Cha
816a23a50d Introduce AlwaysUsePrebuiltSdks
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
2020-08-07 12:15:52 +09:00
Colin Cross
cf0e4220eb Add dist target for robolectric-tests.zip
Also remove stray fmt.Println.

Test: m robolectric-tests
Change-Id: Ia463c2b395fadd6ab33b2ce8364f2119b2a2be1e
2020-07-20 17:19:02 -07:00
Colin Cross
8eebb135b3 Package robolectric tests for tradefed
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
2020-07-19 19:33:40 -07:00
Colin Cross
014489c1e6 Add support for running Android lint on java and android modules.
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
2020-06-16 15:44:16 -07:00
Colin Cross
ce6734e666 Consolidate adding common java properties
Use a method to add the properties that are present on all java modules.

Bug: 153485543
Test: m checkbuild
Change-Id: I7803b15eb0de810c8ab8d4b9acf2511935a26fb6
2020-06-15 18:16:10 -07:00
Jiyong Park
0b0e1b9804 AndroidMkEntries() returns multiple AndroidMkEntries structs
AndroidMkEntries now returns multiple AndroidMkEntires so that a module
can emit multiple Make modules if needed.

Bug: 128708192
Test: m

Change-Id: I56b6f76d22943b80329951c5acb80a1b932441ad
2019-12-11 17:25:27 +09:00
Colin Cross
0a2f719bca Move sharding functions for reuse
Move shardPaths and shardTests to android.ShardPaths and
android.ShardStrings for reuse in other packages.

Test: m checkbuild
Change-Id: I868802872c73616b80f56cbf11f959c01a8b793a
2019-09-29 23:26:37 -07:00
Jaewoong Jung
2784fda152 Merge "Migrate java/androidmk.go to new system #1" 2019-09-27 14:40:24 +00:00
Colin Cross
e323f3cca3 Fix robolectric tests with sdk_version and prebuilt dependencies
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
2019-09-18 16:33:27 +00:00
Jaewoong Jung
b0c127cfd7 Migrate java/androidmk.go to new system #1
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
2019-09-10 07:38:31 -07:00
Colin Cross
d2d1177168 Support sharding robolectric tests
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
2019-06-13 15:19:03 -07:00
Colin Cross
7e5bf1cc8c Merge "Make test_options.timeout an int64" am: 76acdadaf7
am: acb00184c3

Change-Id: Id7a50b086ce755877e2656c98b5be8896b456bfd
2019-05-30 20:24:06 -07:00
Colin Cross
2f9a7c8ab0 Make test_options.timeout an int64
I forgot we supported integer properties, use an integer instead
of a string for test_options.timeout.

Test: m checkbuild
Change-Id: I22d3135b31ec93d15b530c430b9e9cda6dd3f416
2019-05-30 11:19:32 -07:00
Colin Cross
3ec27ec6cf Support android_robolectric_test with merged binary resources
android_robolectric_test with merged binary resources
requires a gnerated test_config.properties file pointing
to the APK containing binary resources.

Test: m RunSettingsLibRoboTests
Change-Id: Ic84714c09ea1bae70537556c8385405fe392f79f
2019-05-07 11:15:46 -07:00
Colin Cross
0ef0816727 Support robolectric_test
robolectric_test will compile a suite of tests that run in
robolectric.  For now it also generates a Run* rule, later
that will be removed in favor of atest.

Bug: 123248659
Test: m RunSettingsLibRoboTests
Change-Id: I12407d0b0d639e31c1969077ba787e8985e6a506
2019-05-01 16:41:44 -07:00