Commit graph

3682 commits

Author SHA1 Message Date
Paul Duffin
3d9f268437 Fix TestTurbine to work without javaMockFS()
Bug: 182638834
Test: m nothing
Change-Id: Idf400b5f0d171a504acf006425cbfc514b391e74
2021-03-18 08:02:38 +00:00
Paul Duffin
57c4d79c00 Fix testDexpreoptBoot to work without javaMockFS()
Bug: 182638834
Test: m nothing
Change-Id: I1725d6ce7e1201d8d77e95d3cebb7d8cc882d437
2021-03-18 08:02:38 +00:00
Paul Duffin
171de3ef7c Fix TestClasspath to work without javaMockFS()
Bug: 182638834
Test: m nothing
Change-Id: Icd6fe93cbda418cb4eaf5e99800894d4c4cc5e6f
2021-03-18 08:02:38 +00:00
Paul Duffin
76101fa5ec Convert TestClasspath to test fixtures
The main complication with this change was that many of the tests check
paths that are provided by the default java modules. The location of
them is different in the test fixtures that it is when using
testConfig() and so the test needed to be changed.

Bug: 182638834
Test: m nothing
Change-Id: I6d325dbd3ba39e5de7e53c576d7cfe07bd95a965
2021-03-18 08:02:38 +00:00
Paul Duffin
e26e597fc8 Merge "Fix app tests to work without javaMockFS()" 2021-03-18 08:00:29 +00:00
Paul Duffin
9e993c6162 Merge "Convert app tests that depend on javaMockFS() to test fixtures" 2021-03-18 07:59:54 +00:00
Paul Duffin
8a6fef4db3 Merge "Convert TestUsesLibraries to test fixtures" 2021-03-18 07:59:04 +00:00
Paul Duffin
220ddd7a6b Clean up java package use of python build components
Bug: 182885307
Test: m nothing
Change-Id: I206ebc075c568a09008ec8b63122922dd87ba318
2021-03-17 23:56:58 +00:00
Paul Duffin
1b29e003f3 Add prebuilt_platform_compat_config
It just provides the metadata needed by the global singleton as the
rest is in the apex.

Bug: 182402754
Test: m nothing
Change-Id: I511df7a3a06dab13ddb9ad63392ae5310dfee9c4
2021-03-17 18:16:31 +00:00
Paul Duffin
29072a9c1e Separate metadata provider from apex contents provider
The platform_compat_config_singleton only needs access to the metadata
so this separates that method into its own interface, distinct from the
one needed by the apex. This also adds a test to ensure that the merging
still works.

Bug: 182402754
Test: m nothing
Change-Id: I5212239786810e5fc5eb99831b1122db93d1329f
2021-03-17 18:16:28 +00:00
Paul Duffin
afeee22c17 Add emptyFixtureFactory in java package
Bug: 182402754
Test: m nothing
Change-Id: I6a01b846a8aee5a0ace9e6ac056ee439bf6f12f7
2021-03-17 17:50:22 +00:00
Paul Duffin
961543309f Reorganize the platform_compat_config.go file
The types and methods are separated and interleaved with each other
so this moves them so that they are together.

Bug: 182402754
Test: m nothing
Change-Id: I275f6af30491d2440499b9ee3f201eea227d23f8
2021-03-17 17:50:22 +00:00
Colin Cross
45a4971808 Merge changes from topic "rule_builder_rsp"
* changes:
  Remove unescaped spans support from RuleBuilder
  Add explicit rspfile argument to RuleBuilderCommand.FlagWithRspFileInputList
  Ninja escape RuleBuilder rule params
2021-03-17 15:14:19 +00:00
Paul Duffin
2645a2912f Fix app tests to work without javaMockFS()
Bug: 182638834
Test: m nothing
Change-Id: Ia1815557e6d9dba1cb24f824a988c7599263bf85
2021-03-17 14:01:02 +00:00
Paul Duffin
cdb88a996a Convert app tests that depend on javaMockFS() to test fixtures
Bug: 182638834
Test: m nothing
Change-Id: Ice668cf58695839d4929a0744822c0ded441d9c4
2021-03-17 14:01:02 +00:00
Paul Duffin
d234b418a5 Convert TestUsesLibraries to test fixtures
This test relies on files provided by javaMockFS() so has been
converted to test fixtures to allow it to remove that dependency which
will allow javaMockFS() to be removed.

Bug: 182638834
Test: m nothing
Change-Id: I77b0205c91ff94b1c3c9ca00d4711451e3671571
2021-03-17 14:01:02 +00:00
Treehugger Robot
797b03eec9 Merge "Run InitAndroidArchModule last in factory functions." 2021-03-17 11:07:13 +00:00
Yuexi Ma
b96a04ba49 Merge "Export a few utility methods" 2021-03-17 01:40:51 +00:00
Martin Stjernholm
b79c7f1101 Run InitAndroidArchModule last in factory functions.
It calls InitAndroidModule which retrieves the properties, so all
AddProperties must go before it.

Test: `m nothing` with new ART prebuilt drop that has a
  prebuilt_boot_image module.
Bug: 177892522
Change-Id: Ia09db9ef17148d36d8d4f25df3f1bf4f528a2fc8
2021-03-17 00:31:15 +00:00
Colin Cross
70c4741215 Add explicit rspfile argument to RuleBuilderCommand.FlagWithRspFileInputList
Using $out.rsp as the rsp file adds extra complexity around keeping
the $ unescaped.  Make callers to FlagWithRspFileInputList provide
an explicit path for the rsp file instead.

Bug: 182612695
Test: rule_builder_test.go
Change-Id: I3f531d80c1efa8a9d09aac0a63790c5b11a9f0c6
2021-03-16 16:52:56 -07:00
Christian Wailes
7d1f1cf27c Merge "Add test suite to legacy core platform allowlist." 2021-03-16 23:02:39 +00:00
Yuexi Ma
627263fece Export a few utility methods
Add a few utility methods to support generating TradeFed test plan in C-Suite

Test: go test .
Change-Id: I86a505068b5d5aa0f5a37b3e3a2465839a7480ef
2021-03-16 15:57:59 -07:00
Jaewoong Jung
9f315dea28 Merge "Improve java.go readability." 2021-03-16 21:32:48 +00:00
Treehugger Robot
8974f1706e Merge "Don't depend on nonexistent manifest when manifest_check is disabled." 2021-03-16 20:02:42 +00:00
Ulya Trafimovich
a76d6606ce Don't depend on nonexistent manifest when manifest_check is disabled.
This is a follow-up for https://android-review.googlesource.com/1614807.

Bug: 132357300
Test: lunch aosp_cf_x86_64_phone-userdebug && m
Test: lunch qemu_trusty_arm64-userdebug && \
  m out/soong/.intermediates/packages/apps/DocumentsUI/DocumentsUI/android_common/DocumentsUI-unsigned.apk
Change-Id: I84c5d171bd976f35f342abd94b592506c71e4b1d
2021-03-16 15:34:50 +00:00
Paul Duffin
dc92abb705 Fix hiddenapi tests to work without javaMockFS()
Bug: 182638834
Test: m nothing
Change-Id: I32e0173f3c2e97b6d6d831c6cfa51cc500f8d2b1
2021-03-16 14:25:21 +00:00
Paul Duffin
175947f654 Convert hiddenapi tests to use test fixtures
These tests rely on files provided by javaMockFS() so have been
converted to test fixtures to allow them to remove that dependency
which will allow javaMockFS() to be removed.

Bug: 182638834
Test: m nothing
Change-Id: Ifd4069a74fcf67e555f998ddbc4de3fde26b2aae
2021-03-16 14:25:21 +00:00
Paul Duffin
163043d615 Fix TestJavaSdkLibrary... tests to work without javaMockFS()
Bug: 182638834
Test: m nothing
Change-Id: I140b88b3fdf2c532d266a196fee84675c518d859
2021-03-16 14:25:21 +00:00
Paul Duffin
22b77cd538 Convert JavaSdkLibrary... tests in java package to test fixtures
These tests rely on files provided by javaMockFS() so need to are being
converted to test fixtures to allow them to remove that dependency
which will allow javaMockFS() to be removed.

Bug: 182638834
Test: m nothing
Change-Id: If736b95d134fe73c0a0ccd438ec31e93568fb929
2021-03-16 14:25:21 +00:00
Ulyana Trafimovich
2002bfa817 Merge "Reimplement verify_uses_libraries.sh in manifest_check.py." 2021-03-16 13:37:03 +00:00
Paul Duffin
4defbf4d39 Switch platform_compat_config to use common arch
Bug: 182816033
Test: m nothing
Change-Id: If8886edd9278d67fe2b6288a6bd8b152f2314401
2021-03-15 23:19:39 +00:00
Jaewoong Jung
bc15e3a798 Improve java.go readability.
Test: TreeHugger
Change-Id: I98bb7bddb740451ff2ccd28dcdaddff27e35a8cd
2021-03-15 13:58:44 -07:00
Julien Desprez
f666b151eb Remove tradefed static_lib heuristic
Test: presubmit
Bug: 180736967
Change-Id: I98b675dec086122e821caae9a9add8758d252724
2021-03-15 13:07:53 -07:00
Paul Duffin
4eb4b41cef Provide preparer for using platform_compat_config modules
Bug: 181070625
Test: m nothing
Change-Id: I92ec022fae0951a21c2e885d3ded7c98daacfcfc
2021-03-15 19:56:38 +00:00
Paul Duffin
05f72de083 Convert TestJavaSdkLibraryEnforce to test fixtures
Bug: 182638834
Test: m nothing
Change-Id: I99efe76008f9ca0996177f47923274ca594a6858
2021-03-15 17:17:43 +00:00
Paul Duffin
aa6caa7fa8 Create sub tests for each test in TestJavaSdkLibraryEnforce
Bug: 182638834
Test: m nothing
Change-Id: I509b071ee4e470da45159b2174aae7acf1b0eb1a
2021-03-15 17:17:43 +00:00
Paul Duffin
2ff6d1b6d2 Provide support for preparing tests with prebuilt_apis
Adds general support for generating a set of prebuilt apis for a set of
releases and modules. Plus some wrappers for common use cases.

This temporarily will delete any existing conflicting files and replace
them so that it can be used in tests without first removing
javaMockFS(). The future update that removes javaMockFS() will also
remove that workaround.

Bug: 182638834
Test: m nothing
Change-Id: If4e2118f2384b9866cf3f85a5afec1e2e4f9ac95
2021-03-15 17:17:40 +00:00
Paul Duffin
ba2afa93d2 Merge "Extract PrepareForTestWithJavaSdkLibraryFiles from javaMockFS()" 2021-03-15 17:14:03 +00:00
Paul Duffin
56372081ed Merge "Convert testJavaError to test fixtures" 2021-03-15 17:13:55 +00:00
Paul Duffin
6f6f1eb83c Merge "Clean up testApp and testAppConfig" 2021-03-15 17:13:45 +00:00
Ulya Trafimovich
0aba252e15 Reimplement verify_uses_libraries.sh in manifest_check.py.
Previously there were two different scripts that did similar things:
1) build/soong/scripts/manifest_check.py
2) build/make/core/verify_uses_libraries.sh

Both scripts extracted <uses-library> tags and `targetSdkVersion` from
the manifests of Java modules, but 1) worked for XML manifests, and 2)
worked for APKs. This CL reimplements the functionality from 2) in 1),
so that one script can handle both XML manifests and APKs.

Bug: 132357300

Test: lunch cf_x86_64_phone-userdebug && m && launch_cvd \
      adb wait-for-device && adb root && adb logcat \
      | grep -E 'ClassLoaderContext [a-z ]+ mismatch'
      # empty grep output, no errors

Change-Id: Id1b66e4f3f30f307dba70cb111c7571762cb546a
2021-03-15 13:50:49 +00:00
satayev
2338d6f6e4 Merge "Don't track modules that are only available to APEXes." 2021-03-15 12:47:00 +00:00
Nicolas Geoffray
fb856f6add Merge "Treat core_platform as stable unless module uses legacy" 2021-03-15 08:42:43 +00:00
Remi NGUYEN VAN
aa52d66cd5 Merge "Add service-connectivity-pre-jarjar to legacy core platform list" 2021-03-15 01:32:47 +00:00
Paul Duffin
bf028b533d Extract PrepareForTestWithJavaSdkLibraryFiles from javaMockFS()
Needed for tests in both java and sdk packages.

Bug: 182638834
Test: m nothing
Change-Id: Ia8c5e7db47d8b63bf8dcf2965b3af60a4d35a9e5
2021-03-14 01:08:26 +00:00
Paul Duffin
6bac49c560 Convert testJavaError to test fixtures
Bug: 182638834
Test: m nothing
Change-Id: If6de91cd60fea36c945f2b0d51a04e26c838e4af
2021-03-14 01:08:26 +00:00
Paul Duffin
0ed42d3c9d Clean up testApp and testAppConfig
Previously, testAppConfig added some extra files to the mock filesystem
before passing them to testConfig. However, those files are only needed
for TestApp so this converts TestApp to use test fixtures and populates
the mock filesystem with the extra files.

Without those extra files testApp and testAppConfig are equivalent to
testJava and testConfig respectively.

Bug: 181070625
Test: m nothing
Change-Id: I1d8a51223adde5b656948725bc4bc91040533625
2021-03-13 16:06:36 +00:00
Paul Duffin
012b6679d3 Switch to Assert... functions in dexpreopt_bootjars_test.go
Bug: 181070625
Test: m nothing
Change-Id: I74a0be8fab257966aecffa914fcc7c1e6f750eb2
2021-03-13 16:02:30 +00:00
Chris Wailes
4bf7f0db22 Add test suite to legacy core platform allowlist.
Test: atest DexManagerTests
Bug: 174783329
Merged-In: Ife2be3cbc15f06ae382c08c2d6a5c5962feb0caf
Change-Id: Ife2be3cbc15f06ae382c08c2d6a5c5962feb0caf
2021-03-12 14:57:26 -08:00
Paul Duffin
e84b1338c5 Migrate from result methods to function Asserts
Bug: 181070625
Test: m nothing
Change-Id: Iadb85270290acb52c55f2ad70c9f145f1c34b611
2021-03-12 22:24:51 +00:00
Jaewoong Jung
b37b009b16 Merge "Delete defaultsFactory in java.go." 2021-03-12 18:37:38 +00:00
Julien Desprez
c001dc6d2f Merge "Remove the robolectric heuristic out of java_test" 2021-03-12 15:40:19 +00:00
Paul Duffin
451aeef583 Convert testDexpreoptBoot to use test fixtures
Bug: 181070625
Test: m nothing
Change-Id: Iaca15c87c68383630aed015e0e17adad3c37c4b1
2021-03-12 09:02:13 +00:00
Paul Duffin
32a8aadfaa Merge "Add prebuilt_boot_image and add boot_images to sdk" 2021-03-12 08:06:45 +00:00
Paul Duffin
c7cdd1513c Merge "Improve name of getModuleHeaderJarsAsNormalizedPaths" 2021-03-12 07:59:39 +00:00
Julien Desprez
3f4e7a10a6 Remove the robolectric heuristic out of java_test
Test: presubmit
Bug: 180736967
Change-Id: I65193d1639088149d8c2f1d5b7d4311e9f69a609
2021-03-12 03:41:21 +00:00
Treehugger Robot
d13e31a8cc Merge changes I0ad54aa7,I1d6d20ec
* changes:
  Propagate LANG environment variable to lint in RBE
  Default lint RBE to local exec strategy
2021-03-12 01:11:49 +00:00
Artur Satayev
533b98cde3 Don't track modules that are only available to APEXes.
Modules that are not available for platform are developed with
updatability in mind, and do not require manual approvals.

Bug: 181223240
Test: checkbuild
Change-Id: I10b91053b3ef5a9ff5400d9d7a68fae3144a671c
2021-03-11 18:13:18 +00:00
Paul Duffin
4e99ef761a Improve name of getModuleHeaderJarsAsNormalizedPaths
Bug: 182402568
Test: m nothing
Change-Id: I93bfe10f0ac62bf018cfee6738fa080d9404b1cb
2021-03-11 15:53:25 +00:00
Paul Duffin
fc9c218e83 Merge "Ensure java_system_modules_import uses prebuilts" 2021-03-11 15:50:58 +00:00
Paul Duffin
a2fcd19aef Merge "Improve system modules tests" 2021-03-11 15:50:34 +00:00
Paul Duffin
6f688d03c8 Merge "Convert system modules tests to use fixtures" 2021-03-11 15:11:20 +00:00
Paul Duffin
8075291a94 Merge "Separate system modules tests into their own file" 2021-03-11 15:10:54 +00:00
Paul Duffin
f18ff339a9 Merge "prebuilt_apis should create a java_system_modules_import" 2021-03-11 15:09:47 +00:00
Jaewoong Jung
48b8df14be Merge "Populate baseline_file values." 2021-03-11 15:04:52 +00:00
Paul Duffin
4f0a75abde Ensure java_system_modules_import uses prebuilts
Make sure that java_system_modules_import always depends on the
prebuilt by adding dependencies in the ComponentDepsMutator() method
which is called before prebuilts without a corresponding source are
renamed from prebuilt_<x> to <x>. That requires the prebuilt_ prefix
to be provided but it ensures that the dependencies are safe.

Similar logic also makes sure java_system_modules always depends on
the source module and not on a renamed prebuilt module.

Bug: 182402568
Test: m nothing
Change-Id: I30db95978f5d9b205951011edf40585ee36c0c4c
2021-03-11 09:40:02 +00:00
Paul Duffin
c52bea9555 Improve system modules tests
The previous approach of looking for substrings in the command that
matched the base name of the jar could not differentiate between
whether the jar was a prebuilt or a source as they both have the same
base name.

The tests also did not cover the case when there was both prebuilts
and source modules.

This change:
1. Checks that the inputs to the command come from the appropriate
   module.
2. Adds a mixed test.
3. Deduped the source and prebuilt module definitions.

The new test reveals the buggy behavior which will be fixed in a follow
up change.

Bug: 182402568
Test: m nothing
Change-Id: I384ecca097cbe3560e7589c23fb99c176a42fd9b
2021-03-11 09:39:18 +00:00
Paul Duffin
f23e346f6c Convert system modules tests to use fixtures
Bug: 182402568
Test: m nothing
Change-Id: I0535e60a692925b141e465d8e1ec92be21d54c88
2021-03-11 08:32:01 +00:00
Paul Duffin
db284be913 Separate system modules tests into their own file
java_test.go is getting too big.

Bug: 182402568
Test: m nothing
Change-Id: I9c3818f1d747a230fcb66687319a3a14d557a57c
2021-03-11 08:21:49 +00:00
Paul Duffin
d6c2a65211 prebuilt_apis should create a java_system_modules_import
Previously it was creating a java_system_modules which worked fine
because apart from the prebuilt nature the two are functionally
identical. However a follow up change will differentiate between them
which would break this code.

Bug: 182402568
Test: m nothing
Change-Id: Ifc13ce31235494e338d730c61a99d8887c5a2c5b
2021-03-11 08:01:19 +00:00
Paul Duffin
f7f65dafb4 Add prebuilt_boot_image and add boot_images to sdk
Bug: 177892522
Test: m nothing
Change-Id: I640359acd6840507f32d7034c97d4d1c7ff591e9
2021-03-11 07:24:26 +00:00
Colin Cross
9c78cb83d0 Propagate LANG environment variable to lint in RBE
Without LANG, lint's text output is ASCII instead of UTF-8, causing
differences between local and remote execution.

Bug: 181681346
Bug: 182415460
Test: m USE_RBE=true RBE_LINT=true
Change-Id: I0ad54aa731582c9b54abb80f50ba508c75992b91
2021-03-10 18:03:05 -08:00
Colin Cross
9b93af488b Default lint RBE to local exec strategy
Match other tools by defaulting to local exec strategy.

Also use the local absolute path when using the local exec strategy.

Bug: 181681346
Test: m USE_RBE=true RBE_LINT=true
Test: m USE_RBE=true RBE_LINT=true RBE_LINT_EXEC_STRATEGY=remote
Change-Id: I1d6d20ec69663b99d6d9af1d8e5e67b48a5cd050
2021-03-10 18:03:05 -08:00
Jaewoong Jung
6df5e0307d Merge "Lineage properties support module references." 2021-03-11 00:59:32 +00:00
Colin Cross
42e49979f2 Merge "Add comment to lintPaths" 2021-03-10 22:55:03 +00:00
Paul Duffin
29e98e5ede Merge "Support test fixtures in java package" 2021-03-10 22:27:00 +00:00
Jaewoong Jung
75c7cead62 Delete defaultsFactory in java.go.
The factory function became obsolete a long time ago. The module
description text will be correctly extracted with this change.

Test: TreeHugger
Change-Id: If4eb936d34e5a71e6f298f53827a887f34af7cae
2021-03-10 11:41:50 -08:00
Colin Cross
068f33f6cf Merge changes from topic "lint_rbe"
* changes:
  Pass ANDROID_SDK_HOME to metalava so it doesn't write to ~/.android
  Support remoting lint commands with RBE
2021-03-10 18:13:31 +00:00
Colin Cross
ad22bc2995 Add comment to lintPaths
Test: none
Change-Id: Ia7db6e27fedd95df2ebfc573e35a44a93acb031b
2021-03-10 10:10:40 -08:00
Aaron Huang
0a19d6389a Add service-connectivity-pre-jarjar to legacy core platform list
This is a library pre jarjar version which still has dependencies
on legacy core platform APIs and this library will be inculded in
service-connectivity. Thus, this change replaces service-connectivity
with service-connectivity-pre-jarjar.

Bug: 177046265
Test: build pass
Change-Id: I1a84ff07318da03f368cbccb25b6cabebb2de403
Merged-In: I1a84ff07318da03f368cbccb25b6cabebb2de403
2021-03-10 22:29:52 +08:00
Paul Duffin
043f5e7881 Treat core_platform as stable unless module uses legacy
The sdk_version: "core_platform" refers to the stable core platform
unless the module is in the exception list. This change makes sure that
CheckStableSdkVersion() reflects that behavior.

Bug: 180399951
Test: m nothing
Change-Id: Ia0b1e13322352b87f5a3c6621e37f23ba637ffb6
2021-03-10 13:04:03 +00:00
Paul Duffin
95bdab4000 Support test fixtures in java package
Restructures the java package test setup code to create FixturePreparer
instances for setting up a test fixture and converts some tests to
use it.

The goal with this change is not to switch all the java tests over to
directly using the new model but instead to ensure that the majority of
the java tests run with the new model, to allow existing tests to
easily switch to the new model when needed and to allow dependent
packages to be switched to the new model.

Bug: 181070625
Test: m nothing
Change-Id: I1c9d96ddbc973aaf9733dcd7fa0479f79b0f471f
2021-03-10 10:13:09 +00:00
Nicolas Geoffray
a0acfa8b85 Merge "Reinstate the enforcement of stable core platform API usage" 2021-03-10 09:45:52 +00:00
Jaewoong Jung
1a97ee0b20 Populate baseline_file values.
Set baseline_file properties of droidstubs generated in sdk_libary.go to
incompatibilities modules auto-generated by prebuilt_api. This requires
prebuilt_api to generate the modules whether next_api_dir is set or not.

Test: TreeHugger
Bug: 180123247
Change-Id: I690604a8a54e9d9419f072a28a0c0e7734abbd85
2021-03-09 16:26:03 -08:00
Jaewoong Jung
1c1b6e6d95 Lineage properties support module references.
They should have had `android:"path"` tags attached so that users can
point them to filegroup modules.

Test: app_test.go & app_import_test.go
Bug: 182175153
Change-Id: I5580408488ffe5fc12c869cbfb7a468713dcbc96
2021-03-09 15:14:34 -08:00
Jaewoong Jung
05ebca4f7f Merge "Add additional_certificates to android_app_import." 2021-03-09 14:55:24 +00:00
Ulyana Trafimovich
35570c14ce Merge "Disable verify_uses_libraries check if dexpreopt is globally disabled." 2021-03-09 08:40:23 +00:00
Jaewoong Jung
25ae8dec91 Add additional_certificates to android_app_import.
Bug: 182175153
Test: app_import_test,go
Change-Id: I467e98065945b59dcc574a18144756edccdea441
2021-03-08 17:37:46 -08:00
Colin Cross
7314fedd37 Merge "Support robolectric prebuilts in android_robolectric_test" 2021-03-08 19:08:10 +00:00
Paul Duffin
0805d4ebdd Merge "Clean up cc.RegisterRequiredBuildComponentsForTest()" 2021-03-06 08:43:56 +00:00
Julien Desprez
b1778a42cb Merge "Revert "Revert "Attempt to run all java_test_host that look unit..."" 2021-03-06 02:40:44 +00:00
Colin Cross
cd2df5dec6 Merge "Exempt framework-res from UseApiFingerprint" 2021-03-05 23:34:37 +00:00
Colin Cross
3903d401d0 Merge changes from topic "lint_repackage"
* changes:
  Remove lint outputs to prevent showing old lint results on error
  Make common dependencies of lint use restat
  Use repackaged lint binary
2021-03-05 23:34:14 +00:00
Colin Cross
382ba06c27 Pass ANDROID_SDK_HOME to metalava so it doesn't write to ~/.android
Give metalava an ANDROID_SDK_HOME directory in the out tree so it
doesn't write to ~/.android.

Bug: 181908035
Test: mv ~/.android ~/.android.bak && m car-doc-stubs
Change-Id: I63064ece62ff4aa1eb93cbb6c9e33038c1e8a19d
2021-03-05 14:01:44 -08:00
Paul Duffin
eaadd67a99 Reinstate the enforcement of stable core platform API usage
It appears as though change I3a39be5f0b8736de4822c6a14072c78d4e4ad89d
accidentally stopped enforcing the use of the stable core platform
API in AOSP when the changes from rvc-dev-plus-aosp-without-vendor were
merged in.

Unfortunately, since then some additional usages of legacy core
platform APIs have crept in so this adds the affected modules to the
list of modules allowed to use the legacy core platform APIs.

Bug: 180399951
Test: m checkbuild
Change-Id: Ieddaf859f568bc8ee486692474a4dec48b3d25e6
Merged-In: I15e5a6c2f07e73718803501d705de0d7ab9bec90
Merged-In: Ib084ee6676d4a201f4b60533221036245d3be759
Merged-In: I629ed1454def5cf8164a6079034e2c610ed0a554
Merged-In: Ia7613f35c4392eac51c94b0d1da29ecac82eb103
2021-03-05 21:29:41 +00:00
Colin Cross
2669e7edf0 Exempt framework-res from UseApiFingerprint
Generating the API fingerpring depends on framework-res, so the
fingerprint cannot be embedded into framework-res.  Hardcode an
exemption to UseApiFingerprint.

Bug: 181978889
Test: TARGET_BUILD_VARIANT=user UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true vendor/google/build/build_mainline_modules.sh
Change-Id: I621f36d5eb157dd97baa132ff109b4df791eedcc
2021-03-05 19:54:31 +00: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
31972dc487 Support remoting lint commands with RBE
Bug: 181681346
Bug: 181912787
Test: m USE_RBE=true RBE_LINT=true lint-check
Change-Id: I10596c40dc5e29075ba0cab51ea9a98cc58b3188
2021-03-05 11:13:40 -08:00
Paul Duffin
d6ceb8600c Clean up cc.RegisterRequiredBuildComponentsForTest()
Changes this function so it only registers components from the cc
package by pushing the call to genrule.RegisterGenruleBuildComponents()
down into those packages whose tests need it.

This will make it easier to migrate cc package tests to test fixtures
as the RegisterRequiredBuildComponentsForTest() no longer overlaps with
preparers from the genrule packages.

Bug: 181070625
Test: m nothing
Change-Id: Ic00c7e480dc738d7a88d038aca6ab95a1502a24a
2021-03-05 18:20:33 +00:00
Julien Desprez
b216661e84 Revert "Revert "Attempt to run all java_test_host that look unit..."
Revert reland the change after tests have been fixed

Reason for revert: relanding after fixes
Reverted Changes:
I89fbce4d7:Revert "Exclude some tests for java_test_host onbo...
Iaa89f9b7e:Revert "Attempt to run all java_test_host that loo...

Change-Id: Idaa80b2d5a8d3ba026e33b453bd163a4e2d31118
2021-03-05 18:08:36 +00:00
Jaewoong Jung
62751102a9 Clear remains of java.Dependency interface.
Test: TreeHugger
Change-Id: If9dab2022a308b776d7ad760a61f0db97509b9b2
2021-03-05 14:57:51 +00:00
Julien Desprez
bbfd5f5e7c Merge "Revert "Attempt to run all java_test_host that look unit tests"" 2021-03-04 21:50:34 +00:00
Julien Desprez
1ab84fa433 Revert "Attempt to run all java_test_host that look unit tests"
Revert submission 1597083-java_test_host_default

Reason for revert: Getting ready for b/181888225 just in case
Reverted Changes:
I220551549:Attempt to run all java_test_host that look unit t...
I29dbbbf46:Exclude some tests for java_test_host onboarding

Change-Id: Iaa89f9b7e9ad72ed962cef285c70a6263e63ffd5
2021-03-04 21:08:36 +00:00
Ulya Trafimovich
6e55ef157c Disable verify_uses_libraries check if dexpreopt is globally disabled.
Without dexpreopt the check is not necessary, and although it is good to
have, it is difficult to maintain on non-linux build platforms where
dexpreopt is generally disabled (the check may fail due to various
unrelated reasons, such as a failure to get manifest from an APK).

Bug: 181570790
Bug: 132357300
Test: m nothing
Change-Id: Ie012690e8f047ae9256e26565d162c19af4e8921
2021-03-04 18:40:40 +00:00
Colin Cross
5c113d13eb Remove lint outputs to prevent showing old lint results on error
The lint rules dumped the text output file to stdout on error.  If the
lint binary exited without updating the output file it would show old
results.

Remove the output files before running lint, and only dump the text
output file if it exists.

Bug: 181681346
Test: m lint-check
Change-Id: I4fa962b1212e8715f234912a9a5e049d5c1540e8
2021-03-04 10:01:34 -08:00
Colin Cross
00d93b143f Make common dependencies of lint use restat
Use restat for the api_versions.xml and annotations.zip dependencies
of lint so that frameworks/base changes don't always result in
rerunning lint on every module.

Bug: 181681346
Test: m lint-check
Change-Id: Ic6a540b41cf79b21441311a8baefe528a3d90d8b
2021-03-04 10:00:09 -08:00
Colin Cross
84f3dc1c9d Use repackaged lint binary
Lint references lint-classpath.jar, which does not contain any classes
by has a manifest that points to other jars for the classpath.  This
breaks dependency tracking during the build.  Use a lint tool that
is repackaged into a single jar.

Bug: 181681346
Test: m lint-check
Change-Id: I07d2b7404c18626e03c5af3ef5a75dd7f899cb0e
2021-03-04 09:56:15 -08:00
Lukács T. Berki
ddebd2c82a Merge "cd to / before running soong_build ." 2021-03-04 07:07:02 +00:00
Julien Desprez
ce45b73070 Merge "Attempt to run all java_test_host that look unit tests" 2021-03-04 02:00:58 +00:00
Lukacs T. Berki
7690c09953 cd to / before running soong_build .
This lets one avoid any decisions as to when to chdir there during its
execution and leads to better sandboxing because the pwd doesn't leak to
init() functions anymore.

Test: Manual.
Change-Id: I1560da8ed3a621249426f9e8908aa890c21e13ba
2021-03-03 09:14:22 +01:00
Ulyana Trafimovich
97df5e65b0 Merge "Do verify_uses_libraries check for APKs after patching library names." 2021-03-02 13:49:34 +00:00
Ulyana Trafimovich
ae5cdfffa3 Merge "Respect provides_uses_lib for modules added via [optional_]uses_libs" 2021-03-02 13:47:03 +00:00
Ulyana Trafimovich
71284b60ae Merge "Add provides_uses_library example to TestUsesLibrary check." 2021-03-02 13:46:49 +00:00
Ulyana Trafimovich
00c27b7a68 Merge "Stricten TestUsesLibrary check." 2021-03-02 13:46:19 +00:00
Martin Stjernholm
db5138230d Recognise the Google-signed ART APEXes as well.
Test: `m nothing` in internal tree
Bug: 180325915
Change-Id: I83eb660ad7cb480fba2a7874ee7e7f9d35646871
2021-03-01 22:33:51 +00:00
Ulya Trafimovich
fe927a265e Do verify_uses_libraries check for APKs after patching library names.
Some of the `uses_libs`/`optional_uses_libs` libraries may have a
library name that is different from the module name. In that case it is
necessary to patch these properties after `provides_uses_lib` for the
library is applied.

Bug: 132357300
Test: m nothing
Change-Id: I2e2248053787557f955a6b363c22e3bad0301ec7
2021-03-01 17:50:16 +00:00
Ulya Trafimovich
eea486a580 Respect provides_uses_lib for modules added via [optional_]uses_libs
Previously `provides_uses_lib` property affected only those
<uses-library> dependencies that are automatically deduced by Soong as
implicit Java SDK libraries reachable from the `libs` property. Other
<uses-library> dependencies that are explicitly added in `uses_libs` and
`optional_uses_libs` properties ignored `provides_uses_lib`.

As TestUsesLibraries shows (see the TODOs), Soong behaviour is still
incorrect in two ways (to be addressed in follow-up CLs):

- `uses_libs`/`optional_uses_libs` are passed to manifest_fixer
- verify_uses_libraries check is based on `uses_libs`/
  `optional_uses_libs`, and not on the CLC as it should be

Bug: 132357300
Test: m nothing
Change-Id: I0ec7aab9dcd44554d1a79ddd382491c562266fa3
2021-03-01 17:31:23 +00:00
Paul Duffin
c572b5bf62 Merge "Avoid hiddenapi ignoring prebuilt with missing dex implementation jar" 2021-03-01 17:04:53 +00:00
Paul Duffin
69804ac388 Merge "Allow java_sdk_library_import to contribute to hiddenapi processing" 2021-03-01 17:04:39 +00:00
Paul Duffin
0a8d5248ef Merge "Retrieve dex implementation jars from apex for java_sdk_library_import" 2021-03-01 17:04:27 +00:00
Paul Duffin
ec0fe1775b Avoid hiddenapi ignoring prebuilt with missing dex implementation jar
Previously, when a prebuilt was preferred but did not provide a
suitable boot dex jar both the source and the prebuilt were silently
ignored which meant that the "hiddenapi list" command was not given a
complete set of boot dex jars. That could either lead to incorrect
hiddenapi flags being set or the "hiddenapi list" command failing if it
could not find a class. Debugging the cause of either of those cases
can be very time consuming so this change fails early and makes the
cause very explicit.

Bug: 181267622
Test: m nothing
Change-Id: I6763ddb9ba90ed2e501d0cf7984f6655237e905d
2021-03-01 12:58:28 +00:00
Paul Duffin
3785673f9b Allow java_sdk_library_import to contribute to hiddenapi processing
Invokes hiddenAPIExtractInformation() on the java_sdk_library_import's
dex implementation jar provided by the deapexer (on behalf of
prebuilt_apex) so that hiddenAPI can extract the information it needs,
if anything, from the dex file.

The dex file provided by deapexer has already had the hiddenapi
information encoded into it so it does not need to do that again.

Usually, it would require a classes implementation jar as well in
order to extract information from UnsupportedAppUsage annotations but
that is not available for a java_sdk_library_import. Fortunately, the
modules that are currently affected by this do not contain any such
annotations. This just uses a public api stubs jar instead.

Bug: 181267622
Test: m nothing
Change-Id: I96275e46f8b7fecba88075319e9f2da5ae315c03
2021-03-01 12:58:28 +00:00
Paul Duffin
3985351df6 Retrieve dex implementation jars from apex for java_sdk_library_import
Bug: 181267622
Test: m nothing
Change-Id: Idd6af2482f48bd3a05db88b8a06dbbbdee01ef78
2021-03-01 12:58:28 +00:00
Colin Cross
75ce9eccf3 Remove global state from sysprop libraries
Sysprop libraries use a global list to rewrite dependencies from
implementation libraries to public stub libraries when appropriate.
Remove the global list, and instead add a dependency from the
implementation to the public stub that forwards the JavaInfo.

Bug: 181367697
Test: sysprop_test.go
Change-Id: Ia7995feb3c079ca9bb6a403daaae3e3329fd7f6a
2021-02-26 16:28:12 -08:00
Colin Cross
b014f0787e Propagate java resources in apps with no code
Use the java resources jar as the dex jar when building apps that
have no code.

Also remove maybeStrippedDexJar, the dex jar is never stripped now.

Fixes: 176305357
Test: TestAppJavaResources
Change-Id: Ic8b1165bd35d71237d307e7f5f895764e203a10d
2021-02-26 16:28:12 -08:00
Ulya Trafimovich
861a896c96 Add provides_uses_library example to TestUsesLibrary check.
Current test behaviour is incorrect, because libraries added via
`uses_libs`/`optional_uses_libs` ignore `provides_uses_lib` property.
The added TODO entries point at the incorrect behaviour, to be fixed in
the follow-up CLs.

Bug: 132357300
Test: m nothing

Change-Id: I35bfe227797aa37aa539e872052335677c798ee5
2021-02-26 15:19:39 +00:00
Ulya Trafimovich
2eaf5c5256 Stricten TestUsesLibrary check.
- Verify argument order for manifest_fixer args verify_uses_libraries.
- Rewrite manifest_fixer test so that it reveals arguments that should
  not be there, add a TODO to remove them.

Bug: 132357300
Test: m nothing
Change-Id: I910e13b84f0464fc06b5b98395ddb45bf4120223
2021-02-26 14:53:06 +00:00
Julien Desprez
069b75077a Attempt to run all java_test_host that look unit tests
Currently includes some heuristic for the first round of
onboarding.

Test: presubmit
Bug: 180736967
Change-Id: I220551549ed3c1468390655cb911f3b8c0f8880d
2021-02-25 10:12:49 -08:00
Jaewoong Jung
8431282af4 Fix the releax_check flag format verb.
%b prints base 2 numbers. %t is the right one to use for booleans.

Test: TreeHugger
Change-Id: Ifbae0170ba03583182ae848bcfc6bb104f1be7e0
2021-02-24 21:09:10 -08:00
Paul Duffin
eafc16bf14 Allow pre-singleton types to be registered in RegistrationContext
Bug: 181070625
Test: m droid
Change-Id: I708b78ed0b42ec55b0442307f40531cfe1233c2b
2021-02-24 10:17:19 +00:00
Christoffer Quist Adamsen
a72571f0d1 Merge "Allow missing classes in R8 builds" 2021-02-24 07:25:18 +00:00
Treehugger Robot
9a4279309f Merge "Update soong copy of java binaries when Make copy is installed" 2021-02-23 21:35:20 +00:00
Treehugger Robot
7eacdbf8a6 Merge "Add non-fatal mode for verify_uses_libraries check." 2021-02-23 20:45:42 +00:00
Colin Cross
44b85d01c9 Update soong copy of java binaries when Make copy is installed
m <modulename> is handled by Make and installs the Make copy of a host
java binary in out/host/linux-x86/bin, and doesn't depend on the Soong
copy in out/soong/host/linux-x86/bin.  That can leave a stale binary
in the Soong directory, and since the Soong directory is first in the
path set up by envsetup.sh, can result in confusing behavior to end
users.

cc_binary already has the Make binary depend on the Soong binary
so that they are both updated.  Do the same for java_binary.

Fixes: 180405155
Test: m metalava
Change-Id: Ic84a131a2851cc4a18ce3725da3c4067137d6120
2021-02-23 11:19:57 -08:00
Paul Duffin
ece454400d Merge changes from topic "hiddenapi_additional_annotations"
* changes:
  Sort hiddenapi monolithic files by signature
  Remove duplicates in monolithic hidden API files
  Remove implicit dependency from <x> -> <x>-hiddenapi
2021-02-23 12:48:24 +00:00
Jiyong Park
d4cbf34032 Fix infinite recursion when printing unrecognized linktype
Bug: N/A
Test: remove some cases from String() so that some linktypes go to the
default path. Then run m nothing. No infinite recursion. Error is
correctly shown.
PANIC=String method: unrecognized linktype: 5
Change-Id: I424755bc89871fc2144ff22d6391f57157cd434d

Change-Id: Ice791025dc50f44ffabd1050bafc5ea35023d32c
2021-02-23 04:02:23 +00:00
Treehugger Robot
277303f042 Merge "Add ctx to AndroidMkExtraEntriesFunc" 2021-02-22 22:40:31 +00:00
Treehugger Robot
a61a042fa6 Merge "Limit the number of the Java source files in a single compilation unit" 2021-02-22 19:54:00 +00:00
Ulya Trafimovich
8c35fcf4d5 Add non-fatal mode for verify_uses_libraries check.
The new mode is enabled with environment variable
RELAX_USES_LIBRARY_CHECK. If the variable is set to true, then a
verify_uses_libraries check failure does not fail the build, instead it
sets a special compiler filter "extract" for dexpreopt, which means that
the DEX file will be extracted, but it won't be compiled to native code.
Class loader context will be set to empty in this case (not &, as it is
going to be deprecated soon).

If the variable RELAX_USES_LIBRARY_CHECK is unset or set to something
other than "true", then the old behaviour of the verify_uses_libraries
check is preserved.

The intended use case for this flag is to have a smoother migration path
for the Java modules that need to add <uses-library> information in
the build files. The flag allows to quickly silence build errors. This
flag should be used with caution and only as a temporary measure, as it
masks real errors and affects performance.

verify_uses_libraries check is reworked so that it writes the error
message to a status file (which is used instead of the former timestamp
file). Currently the stored error message is not used, but it may be
used later to produce a warning. Dexpreopt command checks if the status
file exists and is nonempty; if that is the case, then compiler filter
is set to "extract".
Bug: 132357300

Test: Manually add some mismatch between the libraries in the Android.bp
      and Android.mk files for dexpreopted apps, build with
      RELAX_USES_LIBRARY_CHECK=true and obsserve that the build doesn't
      fail and they are compiled with compiler-filter "extract".
      Unset RELAX_USES_LIBRARY_CHECK and observe that the build fails.

Change-Id: Ibb5d993a25b1df1d2e70b7d5aafc6997f9d64e67
2021-02-22 15:41:03 +00:00
Christoffer Quist Adamsen
e850737ee4 Allow missing classes in R8 builds
Bug: 180878971
Bug: 72683872
Test: TARGET_PRODUCT=aosp_arm64 m -j core-oj
Change-Id: I663220567eb8f034d3efccc60228aef91c716e8e
2021-02-22 12:09:01 +00:00
Treehugger Robot
f0a869847a Merge "Remove EnforceRROExemptedTargets" 2021-02-20 01:47:43 +00:00
Colin Cross
aa2555387d Add ctx to AndroidMkExtraEntriesFunc
Add a ctx parameter to AndroidMkExtraEntriesFunc to allow them to
access providers.

Test: m checkbuild
Change-Id: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
Merged-In: Id6becc1e425c3c3d8519248f8c0ce80777fac7cc
2021-02-19 23:05:40 +00:00
Jeongik Cha
cee5ba973d Remove EnforceRROExemptedTargets
There is no more target relying on EnforceRROExemptedTargets

Bug: 150820813
Test: m
Change-Id: If50d22c0e4f99e8c50d6a30cb94a0c3a5646b6fa
2021-02-19 12:16:12 +09:00
Pedro Loureiro
8a75058d3f Merge "Add support for lint baseline files" 2021-02-18 15:53:13 +00:00
Treehugger Robot
ca52bfcf0f Merge "Further simplify the link type check routine" 2021-02-18 13:54:27 +00:00
Jiyong Park
4941e4b9d1 Merge "Linktype check error message becomes more correct" 2021-02-18 11:32:03 +00:00
Jiyong Park
7f87e1ab49 Further simplify the link type check routine
Bug: 180477804
Test: m nothing
Change-Id: I216be96cf844fe42ba0cec467eea8520ff4ef4f2
2021-02-18 20:29:05 +09:00
Pedro Loureiro
5d190cc24e Add support for lint baseline files
Test: m droid
Test: go test ^TestJavaLint # (from soong/build/java)

Change-Id: I249a0a0597b0bf8495460ed283b476ad2eb36edc
2021-02-18 11:15:30 +00:00
Anton Hansson
3de06eae5b Merge "Use genrule instead of filegroup for api files" 2021-02-18 09:28:01 +00:00
Jiyong Park
670e0f62a6 Linktype check error message becomes more correct
The type linkType has String() method and the error message is created
using it.

Bug: 180477804
Test: m nothing
Change-Id: I74fe9c93b74904177dbe9d29cd3aa3304b67ba4f
2021-02-18 13:10:18 +09:00