Pass BuildRelease to apply and _apply_transformation methods
Pass BuildRelease to apply and _apply_transformation methods in class of transformations, so that transformation could use the build_release information to decide whether certain steps of the transformation should be performed. Test: atest mainline_modules_sdks_test --host Bug: 254111089 Merged-In: If71a921752f4c481030efb0fd391fb328b5dffb6 Change-Id: I8341541572072ef72ab37dfe816296a1375e4cea
This commit is contained in:
@@ -438,7 +438,7 @@ def read_test_data(relative_path):
|
||||
|
||||
class TestAndroidBpTransformations(unittest.TestCase):
|
||||
|
||||
def apply_transformations(self, src, transformations, expected):
|
||||
def apply_transformations(self, src, transformations, build_release, expected):
|
||||
producer = mm.SdkDistProducer(
|
||||
subprocess_runner=mock.Mock(mm.SubprocessRunner),
|
||||
snapshot_builder=mock.Mock(mm.SnapshotBuilder),
|
||||
@@ -450,7 +450,8 @@ class TestAndroidBpTransformations(unittest.TestCase):
|
||||
with open(path, "w", encoding="utf8") as f:
|
||||
f.write(src)
|
||||
|
||||
mm.apply_transformations(producer, tmp_dir, transformations)
|
||||
mm.apply_transformations(
|
||||
producer, tmp_dir, transformations, build_release)
|
||||
|
||||
with open(path, "r", encoding="utf8") as f:
|
||||
result = f.read()
|
||||
@@ -471,7 +472,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
|
||||
module = MAINLINE_MODULES_BY_APEX["com.android.ipsec"]
|
||||
transformations = module.transformations(mm.S, mm.Sdk)
|
||||
|
||||
self.apply_transformations(src, transformations, expected)
|
||||
self.apply_transformations(src, transformations, mm.S, expected)
|
||||
|
||||
def test_common_mainline_module_tiramisu(self):
|
||||
"""Tests the transformations applied to a common mainline sdk on T.
|
||||
@@ -486,7 +487,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
|
||||
module = MAINLINE_MODULES_BY_APEX["com.android.ipsec"]
|
||||
transformations = module.transformations(mm.Tiramisu, mm.Sdk)
|
||||
|
||||
self.apply_transformations(src, transformations, expected)
|
||||
self.apply_transformations(src, transformations, mm.Tiramisu, expected)
|
||||
|
||||
def test_optional_mainline_module(self):
|
||||
"""Tests the transformations applied to an optional mainline sdk on S.
|
||||
@@ -502,7 +503,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
|
||||
module = MAINLINE_MODULES_BY_APEX["com.android.wifi"]
|
||||
transformations = module.transformations(mm.S, mm.Sdk)
|
||||
|
||||
self.apply_transformations(src, transformations, expected)
|
||||
self.apply_transformations(src, transformations, mm.S, expected)
|
||||
|
||||
def test_optional_mainline_module_tiramisu(self):
|
||||
"""Tests the transformations applied to an optional mainline sdk on T.
|
||||
@@ -517,7 +518,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
|
||||
module = MAINLINE_MODULES_BY_APEX["com.android.wifi"]
|
||||
transformations = module.transformations(mm.Tiramisu, mm.Sdk)
|
||||
|
||||
self.apply_transformations(src, transformations, expected)
|
||||
self.apply_transformations(src, transformations, mm.Tiramisu, expected)
|
||||
|
||||
def test_art(self):
|
||||
"""Tests the transformations applied to a the ART mainline module.
|
||||
@@ -533,7 +534,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
|
||||
module = MAINLINE_MODULES_BY_APEX["com.android.art"]
|
||||
transformations = module.transformations(mm.S, mm.Sdk)
|
||||
|
||||
self.apply_transformations(src, transformations, expected)
|
||||
self.apply_transformations(src, transformations, mm.S, expected)
|
||||
|
||||
def test_art_module_exports(self):
|
||||
"""Tests the transformations applied to a the ART mainline module.
|
||||
@@ -549,7 +550,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
|
||||
module = MAINLINE_MODULES_BY_APEX["com.android.art"]
|
||||
transformations = module.transformations(mm.S, mm.HostExports)
|
||||
|
||||
self.apply_transformations(src, transformations, expected)
|
||||
self.apply_transformations(src, transformations, mm.S, expected)
|
||||
|
||||
def test_r_build(self):
|
||||
"""Tests the transformations that are applied for the R build.
|
||||
@@ -567,7 +568,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
|
||||
module = MAINLINE_MODULES_BY_APEX["com.android.ipsec"]
|
||||
transformations = module.transformations(mm.R, mm.Sdk)
|
||||
|
||||
self.apply_transformations(src, transformations, expected)
|
||||
self.apply_transformations(src, transformations, mm.R, expected)
|
||||
|
||||
|
||||
class TestFilterModules(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user