summaryrefslogtreecommitdiff
path: root/android/hooks.go
AgeCommit message (Collapse)Author
2025-01-31Return android.Module from BottomUpMutatorContext methods Colin Cross
Soong will never see modules that implement blueprint.Module but not android.Module any more, make all the BottomUpMutatorContext methods return android.Module. Test: builds Change-Id: I39a75dab02fcd24763c7b6a6bb558a5e138c5ad5
2024-12-04AddLoadHookWithPriority function in build/soong/android Spandan Das
This is a wrapper around `AddLoadHookWithPriority` in build/blueprint, and allows users to add a load hook at a specified priority. One use case for this is to defer autogenerated rro creation load hook of override_android_app Test: m nothing --no-skip-soong-tests Change-Id: Ib0f6cbcb87099700df4dfcc1d6af740f96c419e9
2024-10-23Introduce Soong API CreateModuleInDirectory(...) Jihoon Kang
The method allows generating module in a specified directory. Note that the method is only supported in LoadHookContext, and does not support BottomUpMutatorContext. Test: m nothing Bug: 375053752 Change-Id: I40ac7678b280a89cdca932632811fef3a1494353
2024-09-27Prevent adding new modules after the defaults mutator Cole Faust
Modules created after a mutator has run will not see the effects of that mutator. So it's better to create modules as early as possible. Bug: 361816274 Test: m nothing --no-skip-soong-tests Change-Id: I21c7fae7c137ab091fd8a63f7432a6df9b474959
2022-04-26Share CreateModule between hooks & mutators Liz Kammer
These contained duplicate code, but evolved separately in the effort to identify module type of those created with CreateModule. This refactors to share a common implementation between the two. Test: m json-module-graph and verify Type fields Test: CI Change-Id: Ifdb9a006d9b1bef7411f9ce3a4384797693b4bfc
2022-03-10add type to modules created by LoadHookContext Sam Delmerico
Modules created by a LoadHookContext do not currently set a module type when creating new modules, but it would make analysis of the module-graph.json much easier if this module type information was available. Bug: 174879786 Test: m json-module-graph && check that module which previously had a blank module type now have the field populated Change-Id: I3be5d259694a1540d21deb8a665ec7bea3464054
2022-01-08Use Module.GetProperties() instead of ModuleBase.generalProperties Usta
ModuleBase.generalProperties served the pupose of being a subset of ModuleBase.customizableProperties. But now with the removal of the latter, the former is simply a redirection to Module.GetProperties() Bug: 206961391 Test: m nothing and diff the ninja files Change-Id: I6dd8b7ba74eb5e7ffb61029b0f9129eec2ccfdaf
2022-01-04Remove customizableProperties from `android.ModuleBase` Usta
- customizableProperties was being used to access all properties, i.e. basically `GetProperties()` - generalProperties was a subset of properties, i.e. `initArchModule()` would only add new arch-specific properties to `customizableProperties` (and `archProperties`) but not `generalProperties` This PR sets generalProperties to contain all properties, which then makes customizableProperties redundant. And in arch.go, any iteration is done via `archProperties` instead. Bug: 206961391 Test: m nothing and diff the ninja files Change-Id: Ieb72b31c0a447fcbf34c92a04f002d7b9d777a86
2021-11-23Minor refactoring of Append/PrependProperties() methods Usta
Test: `m nothing` and compare ninja file Bug: n/a Change-Id: If6e4a0de0a8f4f479fe3cbe044cf50d07648c8d9
2020-06-04Add SrcPath to InstallHookContext David Srbecky
Needed by ART to find the intermediate files so that it can also install them in testcases directory for tests. Change-Id: If1b2ad132632c5dc7c6c7573b56680e2f422594a
2020-05-06Add hook to be called after defaults have been applied Paul Duffin
Previously, the only way for a module type to create modules (other than defining its own mutator) was to register a LoadHook. However, that is called before defaults are applied so any properties used in that hook cannot take advantage of defaults, e.g. java_sdk_library cannot use defaults to set its sdk_version property and have that affect its child modules. This change adds a new SetDefaultableHook() to DefaultableModule to register a hook that is called after any defaults have been applied. Also adds some tests to ensure that errors in the visibility property introduced in a DefaultableHook are reported in the gather phase of visibility processing. A follow up change will switch java_sdk_library to use that instead of the AddLoadHook() mechanism. Bug: 155295806 Test: m checkapi Change-Id: I13df3115f9e225f7324b6725eaeb16a78cc2538a
2020-01-28Follow input changes to proptools.CloneEmptyProperties Colin Cross
Test: m checkbuild Change-Id: I1fd53d03722d134009f7ed663f05bd6dc5980dd1
2020-01-24Simplify vendor conditionals Colin Cross
Support vendor conditionals with no Go code. Test: TestSoongConfigModule Change-Id: I42546e7f17324921ada80f4d8e1cd399830f8dfc
2020-01-06Use blueprint's load hooks Colin Cross
Make android.AddLoadHook wrap blueprint.AddLoadHook. Also pass the config object to ParseBlueprintsFiles. Test: all soong tests Change-Id: I60c988b717d395f52498ec23ef7c9046d9861a6e
2020-01-04Add EarlyModuleContext for LoadHookContext Colin Cross
Make LoadHookContext embed a new EarlyModuleContext instead of BaseModuleContext to reduce its API surface in preparation for moving it to run during parsing instead of mutators. Test: m checkbuild Change-Id: I1cd3ff3b636e7e24991a9184d7521903473e505a
2020-01-03Delete arch hooks Colin Cross
They are not used anywhere. Test: m checkbuild Change-Id: Ice7d68b97ca894c0c4c9efc6dc55c0870a132b9c
2019-10-03Separate InstallPath from OutputPath Colin Cross
Create a new type InstallPath that is similar to OutputPath to differentiate intermediates output paths from installed output paths. RelPathString is a poorly defined, undocumented function that is primarily used to get an install path relative to out/soong to generate an equivalent install path for Make relative to $(OUT_DIR). Move it to InstallPath for now, and fix the one remaining user on OutputPath. Add a method to create an NDK install path so that ndk_sysroot.go doesn't have to do it manually with PathForOutput. Bug: 141877526 Test: m checkbuild Change-Id: I83c5a0bd1fd6c3dba8d3b6d20d039f64f353ddd5
2019-09-26Make CreateModule return the newly created module Colin Cross
Allow mutators to modify properties of the newly created module by returning it. Test: m checkbuild Change-Id: I682caca86c0c8f7c3ae815a494d4c75962c8e2e8
2019-09-26Make CreateModule take an android.ModuleFactory Colin Cross
Reduce the boilerplate required to call CreateModule by taking an android.ModuleFactory instead of a blueprint.ModuleFactory. Test: m checkbuild Change-Id: I1259d2dd3f7893b5319c333bc180727ac40f9e91
2019-07-03Add a String() method to android.Module Colin Cross
Add a String() method to android.Module for use in debugging. Store the name and variations of the module as they are mutated. Test: TestModuleString Bug: 136473661 Change-Id: I74e393703dcfc96ed4e21ac4a4419a7858b59216
2019-06-06Consolidate baseContext, BaseContext, and BaseModuleContext Colin Cross
blueprint.BaseModuleContext is the set of methods available to all module-specific calls (GenerateBuildActions or mutators). The android package split the same functionality across baseContext (nee androidBaseContext), BaseModuleContext, and BaseContext. Consolidate all of them into android.BaseModuleContext. Test: m checkbuild Change-Id: I2d7f5c56fd4424032cb93edff6dc730ff33e4f1e
2019-06-06Remove repetition in android package names Colin Cross
Types in the android package don't need to be prefixed with 'android'. Test: m checkbuild Change-Id: Ieefcfc1a2c4161d9c412f40ef31867149ec21aec
2019-04-16Use LoadHook to create modules in java_sdk_library Colin Cross
Creating new modules in a mutator is dangerous, as other mutators that need to see the new modules may already have run, in this case the prebuilts mutator. Move SdkLibraryMutator to a LoadHook instead. Also moves registering the LoadHook mutator to testing.go so it is registered for all tests. Test: m checkbuild Change-Id: I08bd76a0e6205d2ca27861058067a1562c339eed
2019-02-13Create sysprop_library soong module Inseob Kim
A newly introduced sysprop_library soong module will generate a java_sdk_library and a cc_library from .sysprop description files. Both Java modules and C++ modules can link against sysprop_library module, thus giving consistency for using generated sysprop API. As Java controls accessibility of Internal / System properties with @hide and @SystemApi, 2 different header files will be created. And build system will selectively expose depending on the property owner and the place where the client libraries go into. Bug: 80125326 Bug: 122170616 Test: 1) Create sysprop_library module. Test: 2) Create empty txt files under prebuilts/sdk. Test: 3) Create api directory, make update-api, and see changes. Test: 4) Try to link against sysprop_library with various clients. Test: 5) Soc_specific, Device_specific, Product_specific, recovery flags work as intended. Change-Id: I78dc5780ccfbb4b69e5c61dec26b94e92d43c333
2017-11-30Replace ModuleContext.AConfig() with Config() Colin Cross
AConfig() now duplicates Config(). Replace the uses of AConfig() with Config(). Leave AConfig() for now until code in other projects is cleaned up. Test: m checkbuild Change-Id: Ic88be643049d21dba45dbd1a65588ed94bf43bdc
2017-11-07Let LoadHooks call CreateModule Colin Cross
Move AppendProperties and PrependProperties into TopDownMutatorContext so that LoadHooks can be a subset of TopDownMutatorContext that also includes CreateModule. Test: m checkbuild Bug: 35570956 Change-Id: Iffa6a6aec96f08821c2446e0e0f4622ab772b54c
2016-09-13Replace PropertyCustomizer with hooks Colin Cross
Replace PropertyCustomizer with a more extensible hooks mechanism. Instead of passing an object that satisifies an interface, pass a function pointer that takes a context interface as an argument. Callers can use lambdas to capture any other necessary parameters like property structs. Also add two new hooks, arch hooks that occur after splitting modules into arch variants, and install hooks that occur each time a file is installed to the output directory. Change-Id: I3a3e34aa97f1a92d3a31e5004b4b1ba68869d242