aboutsummaryrefslogtreecommitdiff
path: root/java/java_test.go
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove most paths from java.TestConfigColin Cross2020-06-091-12/+34
| | | | | | | | | | Now that tests don't need to specify every path passed to PathForSource or PathForModuleSrc, remove most of them from java.TestConfig. Leave a few that are globbed by lots of tests, and move a few that are globbed by a single test into the tests. Test: all soong tests Change-Id: Ica91d7203a6a7dbca0fd4fed84c78f149b8699e1
* Add default_to_stubs option to java_sdk_libraryJiyong Park2020-05-281-0/+27
| | | | | | | | | | | | | | | | | | | | | | Previously, when a lib that doesn't have sdk_version property set depends on a java_sdk_library, the impl library was used for linking. This might be too permissive because the client lib might be using empty sdk_version because it needed some private APIs from the platform, but not from the java_sdk_library. This actually happend for some of the CTS tests. They don't set sdk_version, but were directly depending on android.test.[base|runner|mock].stubs libraries. If we switch the references to the stub libraries into the corresponding java_sdk_library modules (e.g. aandroid.test.[base|runner|mock]), then we would be allowing private APIs to the CTS tests, which is not good. To solve this problem, default_to_stub property is introduced. It when set to true prevents the impl lib from being used for linking. When a module that doesn't have sdk_version depends on it, the widest API surface that the java_sdk_library provides is linked instead. Bug: 157007292 Test: m Change-Id: Id2acc3cafb71d1e90d4fdc9c0c70a73983355e0f
* Add support for Metalava implicit dependencies for remote execution.Ramy Medhat2020-05-271-1/+1
| | | | | Test: built aosp crosshatch userdebug with RBE_METALAVA=1 Change-Id: Ic64d98785e34717ef9bdad62b4885085f84f132a
* java_sdk_library: Only expose impl jars when they are builtPaul Duffin2020-05-261-0/+26
| | | | | | | | | | | | | The implementation jars are not built if api_only: true. In that case the jar paths must not be exposed implicitly as they will be nil and they will just be ignored. This change ensures that stubs are returned when the implementation jars are not built. Bug: 155164730 Test: m droid Change-Id: Ic495982a5dcb2754916260e7d91d921a5da288ae
* java_sdk_library: Control shared library usePaul Duffin2020-05-211-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, all java_sdk_library instances were assumed to be usable as shared libraries, i.e. referenced from <uses-library> in Android manifest. However, that was not true for any instances that specified api_only: true and will not be true for many of the new Android modules. One consequence of this assumption is that use of one of the api_only instances could (but fortunately does not appear to) have lead to an invalid library being referenced in an app's manifest which would prevent the app from loading. That would have been done automatically by the implicit sdk library tracking and manifest fixing mechanism and there would have been nothing a developer could have done about it. Changes: 1) Prevents api_only instances from participating in the automatic tracking which will prevent them from being added to Android manifests and breaking apps. 2) Add a new shared_library property that can have the same effect as api_only while still creating a runtime implementation library. 3) Renamed commonProperties to commonSdkLibraryProperties to disambiguate it from the ModuleBase.commonProperties field. 4) Extracts requiresRuntimeImplementationLibrary() to remove duplicate code accessing the Api_only property. 5) Tests for the api_only and shared_library behaviours. Test: m nothing - added tests, tests broke, fixed code, tests passed. Bug: 156723295 Change-Id: Iccf509e808d5ff53522188541a4c54d8f9ada93c
* Improve tracking of exported sdk librariesPaul Duffin2020-05-211-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The build tracks the java_sdk_library/_import modules that are referenced by libraries so that it can ensure that any Android app that includes code that depends on one of those modules has the appropriate <uses-library> entry in their manifest. Unfortunately, there were a couple of issues with that: 1) It only tracks direct references to the java_sdk_library module itself, e.g. android.test.mock. Direct references to the stubs module, e.g. android.test.mock.stubs were not tracked. Making it possible for Android apps to reference libraries which would not be available at runtime. 2) The logic for determining whether something was a java_sdk_library was repeated in a number of places making it difficult to allow java_sdk_library/_import instances to determine whether they should be treated as an Android shared library. 3) It tracks (and could use) even those java_sdk_library instances which do not represent a shared library, e.g. the ones that set api_only: true. While this change will simplifty fixing that the actual issue will be fixed in a follow up change. Changes: * Added EmbeddableSdkLibraryComponent and embedded it into java_sdk_library/_import, java_library and java_import. It provides the common code to minimize duplication. It contains an SdkLibraryToImplicitlyTrack field that if set will cause any references to the containing module to add the SdkLibraryParent to the list of implicit sdk libraries being tracked. * Changed code that assumed that anything that implemented SdkLibraryDependency required tracking to use the OptionalImplicitSdkLibrary() method to get the optional name of the sdk library to track. That will allow a follow up change to return nil from that method to exclude an sdk library from being tracked. * Moved SdkLibraryDependency from java.go to sdk_library.go as that is a better place for it to be. * Changed the stubs java_library/java_import creation code to initialize the SdkLibraryToImplicitlyTrack field with the name of the creating module. * Initialized the SdkLibraryToImplicitlyTrack field in the java_sdk_library/_import so that direct references to them will be tracked too. * Added tests to verify that direct access to the .stubs child of both java_sdk_library and java_sdk_library_import are tracked properly. Test: atest CtsProviderTestCases - which relies on android.test.mock being implicitly tracked to verify that I had not broken anything. Used aapt2 dump badging to read the manifest. m nothing - to run the new tests which failed before fixing the code. Bug: 156723295 Change-Id: Ia99def91e9b74d2ed0a777de04b476c00ea0393d
* java_sdk_library: Access outputs using tagsPaul Duffin2020-05-201-0/+107
| | | | | | | | | | Previously, in order to access say the public stubs source jar it was necessary to directly reference the module by name. This change adds support for accessing them indirectly via tags. Test: nothing Bug: 155164730 Change-Id: Id6d76e56c7b46944b2d2a44a2163fb05a5b03de9
* java_sdk_library: Improve consistency with ..._importPaul Duffin2020-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The scopePaths struct is used by both java_sdk_library and its prebuilt but was not populated in the same way. This change addresses those discrepancies in preparation for a follow up change which will allow access to some of those fields through OutputFileProvider. Changes: * Document the scopePaths field and struct. * Switch those fields that may not be fully populated from Paths to OptionalPath to make that 100% clear and protect against unchecked use. * Switch java_sdk_library_import to use the dependency extraction mechanism driven by the dependency tag. This should actually have been part of the change that added that mechanism. * Only create prebuilt_stubs_sources if sources have been provided. * Add dependencies from java_sdk_library_import on its stubs source child modules if sources have been provided. That will ensure the stubsSrcJar field is updated. * Updates current/removedApiFilePath if provided for the scope in java_sdk_library_import. * Extracts ApiStubsSrcProvider from ApiStubsProvider to allow it to be implemented by PrebuiltStubsSources so that it can provide access to the stubs src jar that it creates. Test: m nothing Bug: 148080325 Bug: 155164730 Change-Id: Ic5bf884b2b1e79841843e7c3b4642796ecd49f5d
* java_sdk_library: Add redirection to module-lib stubsPaul Duffin2020-05-201-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when using sdk_version: "module_current" any direct reference to an sdk library would use the public not module-lib stubs. This change corrects that. Prior to the addition of the module-lib api scope almost all java_sdk_library instances supported all the scopes to which a request for jars could be redirected, i.e. public, system and test. The exceptions to that are a few special instances that were used with sdk_version: "none" and so were either caught by the java_sdk_library special cases or dropped through to public. The addition of module-lib, plus the flexible control over which scopes are generated means that is no longer true. It is possible for a java_sdk_library to be requested for a scope it does not have which would have resulted in an empty set of paths being returned leading to confusing compilation errors. To avoid that this change also adds support for using the inheritance hierarchy defined by the apiScope.extends field to fall back to the closest available surface. Test: m nothing Bug: 155164730 Change-Id: I6aab75a772433ee0a36b6f1758a4aec4be2f9a49
* java_sdk_library: Add sdk_version for API scopesPaul Duffin2020-05-131-0/+14
| | | | | | | | | Allow the sdk_version against which the stubs for a scope are compiled to be specified in the module on a per scope basis. Bug: 155164730 Test: m nothing Change-Id: I5881e5ee7c2169c30f544882344a60a602dae917
* java_sdk_library: Remove some almost single use constantsPaul Duffin2020-05-131-6/+6
| | | | | | | | | | | The constants are only used in one place in the code and in the test. This change switches the test code to use the apiScope methods to generate the names and then inlines the constants in those methods. It makes it easier to see the naming convention. Test: m nothing Bug: 155480189 Change-Id: I966e82b8ae67624da168e05f5a2b062b832cb8cd
* java_sdk_library: Control API surfaces generatedPaul Duffin2020-05-081-0/+18
| | | | | | | | | | | | | Adds a per scope set of properties that allows explicit control over the API surfaces generated. Previously, the term active was used to determine whether it was generated but that was a little abstract and unclear so has been replaced by generated. Test: m nothing Bug: 155164730 Change-Id: I7539d89618b61f6b9d1a4b60cc3f9614b157f0d9
* add aidl.export_include_dirs to java_import module typeJiyong Park2020-03-241-0/+24
| | | | | | | | This allows a java prebuilt to export AIDL files to its clients. Bug: 151933053 Test: m Change-Id: I21b5d5ce647141a7c76f62490adbccb858b10323
* Move NDK test modules into cc/testing.goColin Cross2020-02-191-1/+0
| | | | | | | | Move the NDK modules defined in app_test.go into cc/testing.go in preparation for using sdk_version: "current" in more tests. Test: all soong tests Change-Id: I80bc31225fb4562fce42781219cefbbd6affae06
* Merge "Permissions XML file for java_sdk_library is mutated for APEX"Jiyong Park2020-02-191-1/+1
|\
| * Permissions XML file for java_sdk_library is mutated for APEXJiyong Park2020-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes a regression that was introduced with I597bccbb177b6b6320c3a3edeff467243230d384. With the change, the content of the permissions XML file for a java_sdk_library was determined before the java_sdk_library is mutated for an APEX. As a result, the file path to the implementation jar library was always set to /system/framework/*.jar regardless of whether the java_sdk_library is part of an APEX or not. This change fixes the problem, by creating the permissions XML file via a new module type. The content of the xml file is determined after the xml file is mutated for APEXes. Bug: 149600642 Test: m Change-Id: Id21f8d8285df49b0b3be1daf0f101f2bc978eeb0
* | Allow java_system_modules_import to replace java_system_modulesPaul Duffin2020-02-191-0/+115
|/ | | | | | | | | | | | | | Previously, there were some places where a java_system_module_import could not be used in place of a java_system_module. That was because the code assumed a *SystemModules type not a *systemModulesImport type. This change introduces a SystemModulesProvider interface that is used instead and is implemented on both types. Bug: 142940300 Test: m nothing ran new tests before changes to make sure they detected the issue and after to make sure the changes fixed the issue. Change-Id: I7b16ac5708880bdf61e6f5b1e6616c986f0ed763
* Reland: Get the dex2oat host tool path from module dependency on theMartin Stjernholm2020-02-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | binary module. This uses the Once cache for GlobalSoongConfig to propagate the dex2oat path from a module dependency to the singletons (both the one that writes out dexpreopt_soong.config and the one that creates the dexpreopted boot images). Unless dexpreopting is disabled altogether through DisablePreopt in dexpreopt.config, that means: - We must ensure at least one module registers a dex2oat tool dependency and resolves a GlobalSoongConfig using it, or else the singletons fail. That means we litter dex2oat dependencies in java modules even when they won't get dexpreopted and hence don't really need them. - We still assume there's at least one java_library or android_app in the build. This relands https://r.android.com/1205730 without changes - the necessary fixes are in the child CLs. Bug: 145934348 Test: m (check that out/soong/dexpreopt_soong.config points to dex2oatd64) Test: env USE_DEX2OAT_DEBUG=false m (check that out/soong/dexpreopt_soong.config points to dex2oat64) Test: env OUT_DIR=out-tools prebuilts/build-tools/build-prebuilts.sh on the aosp-build-tools branch Change-Id: I66661711b317d1e4ec434861982919bdde19b575
* Reland: Move the Once cache for dexpreopt.GlobalConfig into theMartin Stjernholm2020-02-131-2/+2
| | | | | | | | | | | | | | | | dexpreopt package. Preparation for a future CL that will need to get the make-written GlobalConfig from within dexpreopt. Also rename the Load*Config functions to Parse*Config, since they don't actually load the config files anymore. This relands https://r.android.com/1211982. Bug: 145934348 Test: m Change-Id: Icb9332a93811d77d2d8b06e983b92501b180a358
* Reland: Separate dexpreopt.GlobalSoongConfig to allow independentMartin Stjernholm2020-02-131-1/+7
| | | | | | | | | | | | | | caching of it. Introduce a Once cache for GlobalSoongConfig to allow it to get binary tool paths from ordinary module dependencies (coming in a future CL) that are then reused in singletons. This relands https://r.android.com/1205729. Bug: 145934348 Test: m Change-Id: I039d6e204bee5ddc16d8e2d85057fbec20e326fe
* java_sdk_library - replace .docs suffix with .stubs.sourcePaul Duffin2020-02-111-3/+3
| | | | | | | | | | | Previously, the .docs suffix was used for droidstubs internal modules that generate the stubs source. The name was confusing so this change replaces the suffix with .stubs.source to clarify the purpose of those modules. Bug: 148080325 Test: m droid Change-Id: I9d7a2ab19e4a331b515408912ac8f7e8b0e1b35d
* java_sdk_library use prebuilt jars for numeric sdk_versionPaul Duffin2020-02-041-0/+13
| | | | | | | | | | | | | | | | Previously, when a library that used a numeric sdk version also referenced a java_sdk_library it would use the current version of its API. That was dangerous as there is an expectation that an app building against a numbered version will also be targeted at that version and so building against a later version of the API could hide runtime incompatibilities. This change will use prebuilt versions of the java_sdk_library's api when being built for a numbered sdk version. Bug: 148080325 Test: m droid Change-Id: I3fd416553950785a443c1702e495a96debc33331
* Remove legacy properties from java_sdk_library_importPaul Duffin2020-02-031-6/+1
| | | | | | | | | | | | The legacy usages have all been updated so the legacy properties can be safely removed. The Libs property is kept so it can be used to specify properties common to all scopes. Bug: 148080325 Test: m droid TARGET_BUILD_APPS=Camera2 m Change-Id: I252ebbedbb463db3c7346e86d86b5880eea76fe9
* java_sdk_library_import - expose system and test stubsPaul Duffin2020-02-031-2/+57
| | | | | | | | | | | | | | | | | | | Previously, the java_sdk_library_import only exposed the public stubs. This change adds support for exposing system and test stubs too by adding separate structures for public, system and test scopes. The existing properties are kept for legacy reasons (and because libs can be common across the differents scopes). It extracts some code that is common to both sdk library and sdk library import. The legacy support will be removed in a future change once all existing usages have been switched over. Bug: 148080325 Test: m droid TARGET_BUILD_APPS=Camera2 m Change-Id: I0b26cc8af9ee044437ff3b80c1eca611816b9386
* Improve java_sdk_library handling of test_currentPaul Duffin2020-01-311-0/+13
| | | | | | | | | | | | | | | | When building a library against sdk_version: system_current it uses the system stubs of any java_sdk_library that it references. Previously, when building against sdk_version: test_current this used the public stubs of any java_sdk_library. This change causes it to use the test stubs instead to be consistent with the handling of system and public. Bug: 148080325 Test: updated the test ran m nothing which failed as expected fixed the code ran m nothing again which succeeded Change-Id: I58ec5bd243701c5a5c75664e2bb615ce7b2f2441
* Revert "Separate dexpreopt.GlobalSoongConfig to allow independen..."Hans Boehm2020-01-271-7/+1
| | | | | | | | | | | | | | | | | Revert submission 1211982-dex2oat-soong-dep Reason for revert: Build failures. See b/148312086. Reverted Changes: Ibc427a9a8: Make dex2oat(d) visible for use as implicit dexpre... I71df11c1e: Move the Once cache for dexpreopt.GlobalConfig int... I38317f2d5: Get the dex2oat host tool path from module depende... I440a09dba: Separate dexpreopt.GlobalSoongConfig to allow inde... Bug: 148312086 Bug: 145934348 Exempt-From-Owner-Approval: Plain revert Change-Id: Ice3990225635a737e49e9aed7373f06516fccea3
* Revert "Move the Once cache for dexpreopt.GlobalConfig into the ..."Hans Boehm2020-01-271-2/+2
| | | | | | | | | | | | | | | | | Revert submission 1211982-dex2oat-soong-dep Reason for revert: Build failures. See b/148312086. Reverted Changes: Ibc427a9a8: Make dex2oat(d) visible for use as implicit dexpre... I71df11c1e: Move the Once cache for dexpreopt.GlobalConfig int... I38317f2d5: Get the dex2oat host tool path from module depende... I440a09dba: Separate dexpreopt.GlobalSoongConfig to allow inde... Bug: 148312086 Bug: 145934348 Exempt-From-Owner-Approval: Plain revert Change-Id: I6b656afb5feaad70d958b9d38b6c6eab7b03fba1
* Revert "Get the dex2oat host tool path from module dependency on..."Hans Boehm2020-01-271-4/+0
| | | | | | | | | | | | | | | | | Revert submission 1211982-dex2oat-soong-dep Reason for revert: Build failures. See b/148312086. Reverted Changes: Ibc427a9a8: Make dex2oat(d) visible for use as implicit dexpre... I71df11c1e: Move the Once cache for dexpreopt.GlobalConfig int... I38317f2d5: Get the dex2oat host tool path from module depende... I440a09dba: Separate dexpreopt.GlobalSoongConfig to allow inde... Bug: 148312086 Bug: 145934348 Exempt-From-Owner-Approval: Plain revert Change-Id: I0cf6fef04434fd3c0b7957ee9abdcaabeb20b9d8
* Get the dex2oat host tool path from module dependency on the binaryMartin Stjernholm2020-01-241-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | module. This uses the Once cache for GlobalSoongConfig to propagate the dex2oat path from a module dependency to the singletons (both the one that writes out dexpreopt_soong.config and the one that creates the dexpreopted boot images). Unless dexpreopting is disabled altogether through DisablePreopt in dexpreopt.config, that means: - We must ensure at least one module registers a dex2oat tool dependency and resolves a GlobalSoongConfig using it, or else the singletons fail. That means we litter dex2oat dependencies in java modules even when they won't get dexpreopted and hence don't really need them. - We still assume there's at least one java_library or android_app in the build. Bug: 145934348 Test: m (check that out/soong/dexpreopt_soong.config points to dex2oatd64) Test: env USE_DEX2OAT_DEBUG=false m (check that out/soong/dexpreopt_soong.config points to dex2oat) Test: env OUT_DIR=out-tools prebuilts/build-tools/build-prebuilts.sh on the aosp-build-tools branch Change-Id: I38317f2d5e5cf6822f87daae25745767c8a3656c
* Move the Once cache for dexpreopt.GlobalConfig into the dexpreoptMartin Stjernholm2020-01-241-2/+2
| | | | | | | | | | | | | | package. Preparation for a future CL that will need to get the make-written GlobalConfig from within dexpreopt. Also rename the Load*Config functions to Parse*Config, since they don't actually load the config files anymore. Bug: 145934348 Test: m Change-Id: I71df11c1e042ca8135d273a7263e9539ea3cd68f
* Separate dexpreopt.GlobalSoongConfig to allow independent caching ofMartin Stjernholm2020-01-241-1/+7
| | | | | | | | | | | | it. Introduce a Once cache for GlobalSoongConfig to allow it to get binary tool paths from ordinary module dependencies (coming in a future CL) that are then reused in singletons. Bug: 145934348 Test: m Change-Id: I440a09dba7d337965a196527566b0966a18e3653
* Added java_system_modules_importPaul Duffin2020-01-151-0/+30
| | | | | | | | | | | | A prebuilt version of java_system_modules. It does not import the generated system module, it generates the system module from imported java libraries in the same way that java_system_modules does. It just acts as a prebuilt, i.e. can have the same base name as another module type and the one to use is selected at runtime. Bug: 142940300 Test: m nothing Change-Id: I126db49d18294fcd6e2b7ad0237f83e9c2fdef7a
* Add basic test for java_system_modulesPaul Duffin2020-01-151-0/+34
| | | | | | Bug: 142940300 Test: m nothing Change-Id: I8855df0832f93e40d31e457191590458c274bb5c
* Add support for java_test in sdkPaul Duffin2019-12-311-0/+7
| | | | | | | | | | | Adds java_test_import module type for use by the sdk snapshot and adds java_tests property to the sdk and sdk_snapshot module type. This is needed for the conscrypt test sdk. Bug: 143678475 Test: m nothing Change-Id: Ied4c56c978dac2f92a9b3bc34b3235d7eeba2fd3
* Generate .srcjar for prebuilt_stubs_sourcesPaul Duffin2019-12-201-13/+15
| | | | | | | | | | | | | | | | | | | | | Changes prebuilt_stubs_sources to generate a .srcjar from its input instead of just exposing the srcs it is given. This ensures that it can be used as a drop in replacement for a droidstubs module. Updates the test for prebuilt_stubs_sources to be more representative of the actual use made of it by sdk snapshot which outputs a directory not a glob pattern. Added some documentation of the prebuilts_stubs_sources srcs property to make it clear that it is supposed to be a set of directories. Extracts common code from sdk/testing.go for normalizing path/paths for testing. Bug: 143678475 Test: m conscrypt-module-sdk conscrypt-module-host-sdk conscrypt-module-test-sdk unzip those in place of external/conscrypt build core-current-stubs-source which expects it to provide a .srcjar. Change-Id: I8204a022557a9b0b45e19eac79ecba98ff95213d
* Improve cc tests by adding sanitizer mutatorsPaul Duffin2019-12-191-1/+0
| | | | | | | | | | | | | | | | | | | | This fixes an issue that arises when deduping cc build component registration code. The sanitize_runtime_deps and sanitize_runtime post deps mutators were not previously added when running cc tests. That meant the tests were not actually testing the same behavior as at runtime. Adding the mutators breaks the TestFuzzTarget test as the mutator adds libclang_rt.ubsan_standalone-aarch64-android as a dependency of libc++ and the former is not available. This fixes the test by adding the missing dependency as a cc prebuilt shared library. Test: m checkbuild Bug: 146540677 Change-Id: Ie13c7e6fcefef7d9cb1cc5364be3dc563ce40de5
* Dedup prebuilt mutator registrationPaul Duffin2019-12-191-2/+1
| | | | | | Test: m checkbuild Bug: 146540677 Change-Id: I9f8a11adf61fe6f352ec1eabc7c5bac332348ba2
* Dedup registration for cc default test configPaul Duffin2019-12-191-8/+1
| | | | | | | | | | | | | | | | The cc.GatherRequiredDepsForTest() method returns some default module definitions that are required when using cc module types like cc_library. Previously, the registration of the module types and mutators needed to process those default definitions was duplicated in the test config initialization. This change removes that duplicated code and replaces it with calls to cc.RegisterRequiredBuildComponentsForTest(ctx) which registers all the required build components. Test: m checkbuild Bug: 146540677 Change-Id: I80b6913c5691ff164ce9d308b9e1da24940f2d42
* Dedup prebuilt apis module type/mutator registrationPaul Duffin2019-12-191-4/+3
| | | | | | Test: m checkbuild Bug: 146540677 Change-Id: If5d6fdace2574df6314fbcf6441838cd11df58ae
* Dedup system modules and sdk library module type registrationPaul Duffin2019-12-191-3/+2
| | | | | | Test: m checkbuild Bug: 146540677 Change-Id: I982fcb8d723e8e2f7679434051ddc427d4fbd7be
* Dedup java genrule module type registrationPaul Duffin2019-12-191-1/+1
| | | | | | Test: m checkbuild Bug: 146540677 Change-Id: I17f24fe145b4bb453e82aabaecc9c251f2b9769b
* Dedup droiddoc module type registrationPaul Duffin2019-12-191-6/+4
| | | | | | | | | Some tests were changed as they were using the wrong name for the droiddoc_exported_dir module type. Test: m checkbuild Bug: 146540677 Change-Id: If57404760d2df3757c93e237696359355cf0c96e
* Merge "Add updatable_media_stub to framework"Jiyong Park2019-12-191-1/+1
|\
| * Add updatable_media_stub to frameworkJiyong Park2019-12-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The module framework is now a build-only library whose purpose is to provide hidden APIs from the non-updatable part of the platform and APIs from the modules. Merging updatable_media_stub to framework, like the stub libraries from other modules. As a result, updatable_media_stub can be removed from DefaultLibraries. Bug: N/A Test: m Exempt-From-Owner-Approval: cherry-pick from internal Merged-In: I7f80716119ad6ac627e5666def9fe17112dcde3b (cherry picked from commit 4c258d282b15bd0d9ba3de8dfa9762de1bd1adf4) Change-Id: I7f80716119ad6ac627e5666def9fe17112dcde3b
* | Dedup registration code for module types and singletonsPaul Duffin2019-12-191-20/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The registration of module types and singletons is duplicated between init() functions that register them for use in the build runtime and test context creation code that registers them for testing. This is a proof of concept for a mechanism that will allow the code to be shared. It defines a RegistrationContext interface that is implemented by both the TestContext and the new initRegistrationContext type. An instance of the the latter is available through the InitRegistrationContext variable. The intent is that the registration of the module types and singleton types will be extracted from the init() function into a separate function that takes a RegistrationContext parameter. That method is called from init() passing in the InitRegistrationContext and from a test passing in the TestContext. Something like this: func init() { RegisterBuildComponents(android.InitRegistrationContext) } func RegisterBuildComponents(ctx android.RegistrationContext) { ctx.RegisterModuleType(....) .... } A test would do something like this: ctx := android.NewTestContext() RegisterBuildComponents(ctx) Test: m nothing Change-Id: I97173cabb6d6cf7ce98fdb5f73418438b1997b35
* | Move filesystem into ConfigColin Cross2019-12-181-123/+20
|/ | | | | | | | | | | | The filesystem object was available through ModuleContext.Fs(), but gives too much access to the filesystem without enforicing correct dependencies. In order to support sandboxing the soong_build process move the filesystem into the Config. The next change will make it private. Bug: 146437378 Test: all Soong tests Change-Id: I5d3ae9108f120fd335b21efd612aefa078378813
* Use empty string for core image variantColin Cross2019-12-131-1/+1
| | | | | | | | | | | Use the empty string for the core image variant so that modules added to imageMutator do not change their build directory. Bug: 142286466 Test: m checkbuild Change-Id: Ida4534d9a4d6176236aaa480fed359ce27acfaa1 Merged-In: Ida4534d9a4d6176236aaa480fed359ce27acfaa1 (cherry picked from commit 72d685ee7f45e5393be44ae4159edf083ac918de)
* Merge "Cleanup java.DefaultsFactory()"Treehugger Robot2019-12-071-1/+1
|\
| * Cleanup java.DefaultsFactory()Paul Duffin2019-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function took a props varargs parameter but it was only ever called with no parameters. The props parameter meant it could not be used directly with RegisterModuleType() so the defaultsFactory() func was added which simply called through to DefaultsFactory(). Removing the props varargs parameter allowed it to be used directly with RegisterModuleType() and so the defaultsFactory() could be removed. This was needed because a follow up change adds a test in another package that uses java_defaults and so it needs the factory method (defaultsFactory()) to be exported. Test: m nothing Change-Id: I33d5c4d4ce8f349b1e6fc706d5e9656faf303b4f
* | Move ImageMutator after archMutatorColin Cross2019-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Move the ImageMutator to be registered just after the archMutator in preparation for moving it between osMutator and archMutator. Requries updating variants in a few tests that now run the ImageMutator. Bug: 142286466 Test: no change to build.ninja Test: all soong tests Change-Id: Ia9d2a7bc0e225bedec3c9a83ea04f471a931bf47