add BuildContext class and fix enabled features
Add a BuildContext class to simplify parsing the build context dict, and
fix the parsing of enabledBuildFeatures, which was being parsed as a
list of strings when it's actually a list of dicts like:
[{'name': '<feature_name>'}]
Test: atest build_test_suites_test
Bug: 361605425
Change-Id: I6424c444daf1582e92313c39f43207cb274aa78f
This commit is contained in:
@@ -14,9 +14,10 @@
|
||||
# limitations under the License.
|
||||
|
||||
from abc import ABC
|
||||
from typing import Self
|
||||
import argparse
|
||||
import functools
|
||||
from typing import Self
|
||||
from build_context import BuildContext
|
||||
|
||||
|
||||
class OptimizedBuildTarget(ABC):
|
||||
@@ -30,7 +31,7 @@ class OptimizedBuildTarget(ABC):
|
||||
def __init__(
|
||||
self,
|
||||
target: str,
|
||||
build_context: dict[str, any],
|
||||
build_context: BuildContext,
|
||||
args: argparse.Namespace,
|
||||
):
|
||||
self.target = target
|
||||
@@ -38,13 +39,13 @@ class OptimizedBuildTarget(ABC):
|
||||
self.args = args
|
||||
|
||||
def get_build_targets(self) -> set[str]:
|
||||
features = self.build_context.get('enabledBuildFeatures', [])
|
||||
features = self.build_context.enabled_build_features
|
||||
if self.get_enabled_flag() in features:
|
||||
return self.get_build_targets_impl()
|
||||
return {self.target}
|
||||
|
||||
def package_outputs(self):
|
||||
features = self.build_context.get('enabledBuildFeatures', [])
|
||||
features = self.build_context.enabled_build_features
|
||||
if self.get_enabled_flag() in features:
|
||||
return self.package_outputs_impl()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user