xref: /aosp_15_r20/tools/asuite/aidegen/lib/native_module_info.py (revision c2e18aaa1096c836b086f94603d04f4eb9cf37f5)
1*c2e18aaaSAndroid Build Coastguard Worker#!/usr/bin/env python3
2*c2e18aaaSAndroid Build Coastguard Worker#
3*c2e18aaaSAndroid Build Coastguard Worker# Copyright 2019 - The Android Open Source Project
4*c2e18aaaSAndroid Build Coastguard Worker#
5*c2e18aaaSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
6*c2e18aaaSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
7*c2e18aaaSAndroid Build Coastguard Worker# You may obtain a copy of the License at
8*c2e18aaaSAndroid Build Coastguard Worker#
9*c2e18aaaSAndroid Build Coastguard Worker#     http://www.apache.org/licenses/LICENSE-2.0
10*c2e18aaaSAndroid Build Coastguard Worker#
11*c2e18aaaSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
12*c2e18aaaSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
13*c2e18aaaSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*c2e18aaaSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
15*c2e18aaaSAndroid Build Coastguard Worker# limitations under the License.
16*c2e18aaaSAndroid Build Coastguard Worker
17*c2e18aaaSAndroid Build Coastguard Worker"""native_module_info
18*c2e18aaaSAndroid Build Coastguard Worker
19*c2e18aaaSAndroid Build Coastguard WorkerModule Info class used to hold cached module_bp_cc_deps.json.
20*c2e18aaaSAndroid Build Coastguard Worker"""
21*c2e18aaaSAndroid Build Coastguard Worker
22*c2e18aaaSAndroid Build Coastguard Workerimport logging
23*c2e18aaaSAndroid Build Coastguard Workerimport os
24*c2e18aaaSAndroid Build Coastguard Workerimport re
25*c2e18aaaSAndroid Build Coastguard Worker
26*c2e18aaaSAndroid Build Coastguard Workerfrom aidegen import constant
27*c2e18aaaSAndroid Build Coastguard Workerfrom aidegen.lib import common_util
28*c2e18aaaSAndroid Build Coastguard Workerfrom aidegen.lib import module_info
29*c2e18aaaSAndroid Build Coastguard Worker
30*c2e18aaaSAndroid Build Coastguard Worker_CLANG = 'clang'
31*c2e18aaaSAndroid Build Coastguard Worker_CPPLANG = 'clang++'
32*c2e18aaaSAndroid Build Coastguard Worker_MODULES = 'modules'
33*c2e18aaaSAndroid Build Coastguard Worker_INCLUDE_TAIL = '_genc++_headers'
34*c2e18aaaSAndroid Build Coastguard Worker_SRC_GEN_CHECK = r'^out/soong/.intermediates/.+/gen/.+\.(c|cc|cpp)'
35*c2e18aaaSAndroid Build Coastguard Worker_INC_GEN_CHECK = r'^out/soong/.intermediates/.+/gen($|/.+)'
36*c2e18aaaSAndroid Build Coastguard Worker
37*c2e18aaaSAndroid Build Coastguard Worker
38*c2e18aaaSAndroid Build Coastguard Workerclass NativeModuleInfo(module_info.AidegenModuleInfo):
39*c2e18aaaSAndroid Build Coastguard Worker    """Class that offers fast/easy lookup for module related details.
40*c2e18aaaSAndroid Build Coastguard Worker
41*c2e18aaaSAndroid Build Coastguard Worker    Class Attributes:
42*c2e18aaaSAndroid Build Coastguard Worker        c_lang_path: Make C files compiler path.
43*c2e18aaaSAndroid Build Coastguard Worker        cpp_lang_path: Make C++ files compiler path.
44*c2e18aaaSAndroid Build Coastguard Worker    """
45*c2e18aaaSAndroid Build Coastguard Worker
46*c2e18aaaSAndroid Build Coastguard Worker    c_lang_path = ''
47*c2e18aaaSAndroid Build Coastguard Worker    cpp_lang_path = ''
48*c2e18aaaSAndroid Build Coastguard Worker
49*c2e18aaaSAndroid Build Coastguard Worker    def __init__(self, force_build=False, module_file=None):
50*c2e18aaaSAndroid Build Coastguard Worker        """Initialize the NativeModuleInfo object.
51*c2e18aaaSAndroid Build Coastguard Worker
52*c2e18aaaSAndroid Build Coastguard Worker        Load up the module_bp_cc_deps.json file and initialize the helper vars.
53*c2e18aaaSAndroid Build Coastguard Worker        """
54*c2e18aaaSAndroid Build Coastguard Worker        if not module_file:
55*c2e18aaaSAndroid Build Coastguard Worker            module_file = common_util.get_blueprint_json_path(
56*c2e18aaaSAndroid Build Coastguard Worker                constant.BLUEPRINT_CC_JSONFILE_NAME)
57*c2e18aaaSAndroid Build Coastguard Worker        self.force_build = force_build
58*c2e18aaaSAndroid Build Coastguard Worker        if not os.path.isfile(module_file):
59*c2e18aaaSAndroid Build Coastguard Worker            self.force_build = True
60*c2e18aaaSAndroid Build Coastguard Worker        super().__init__(self.force_build, module_file)
61*c2e18aaaSAndroid Build Coastguard Worker
62*c2e18aaaSAndroid Build Coastguard Worker    def _load_module_info_file(self, module_file):
63*c2e18aaaSAndroid Build Coastguard Worker        """Load the module file.
64*c2e18aaaSAndroid Build Coastguard Worker
65*c2e18aaaSAndroid Build Coastguard Worker        Args:
66*c2e18aaaSAndroid Build Coastguard Worker            module_file: String of path to file to load up. Used for testing.
67*c2e18aaaSAndroid Build Coastguard Worker
68*c2e18aaaSAndroid Build Coastguard Worker        Returns:
69*c2e18aaaSAndroid Build Coastguard Worker            Tuple of module_info_target and dict of json.
70*c2e18aaaSAndroid Build Coastguard Worker        """
71*c2e18aaaSAndroid Build Coastguard Worker        if self.force_build:
72*c2e18aaaSAndroid Build Coastguard Worker            self._discover_mod_file_and_target(True)
73*c2e18aaaSAndroid Build Coastguard Worker        mod_info = common_util.get_json_dict(module_file)
74*c2e18aaaSAndroid Build Coastguard Worker        NativeModuleInfo.c_lang_path = mod_info.get(_CLANG, '')
75*c2e18aaaSAndroid Build Coastguard Worker        NativeModuleInfo.cpp_lang_path = mod_info.get(_CPPLANG, '')
76*c2e18aaaSAndroid Build Coastguard Worker        name_to_module_info = mod_info.get(_MODULES, {})
77*c2e18aaaSAndroid Build Coastguard Worker        root_dir = common_util.get_android_root_dir()
78*c2e18aaaSAndroid Build Coastguard Worker        module_info_target = os.path.relpath(module_file, root_dir)
79*c2e18aaaSAndroid Build Coastguard Worker        return module_info_target, name_to_module_info
80*c2e18aaaSAndroid Build Coastguard Worker
81*c2e18aaaSAndroid Build Coastguard Worker    def get_module_names_in_targets_paths(self, targets):
82*c2e18aaaSAndroid Build Coastguard Worker        """Gets module names exist in native_module_info.
83*c2e18aaaSAndroid Build Coastguard Worker
84*c2e18aaaSAndroid Build Coastguard Worker        Args:
85*c2e18aaaSAndroid Build Coastguard Worker            targets: A list of build targets to be checked.
86*c2e18aaaSAndroid Build Coastguard Worker
87*c2e18aaaSAndroid Build Coastguard Worker        Returns:
88*c2e18aaaSAndroid Build Coastguard Worker            A list of native projects' names if native projects exist otherwise
89*c2e18aaaSAndroid Build Coastguard Worker            return None.
90*c2e18aaaSAndroid Build Coastguard Worker        """
91*c2e18aaaSAndroid Build Coastguard Worker        projects = []
92*c2e18aaaSAndroid Build Coastguard Worker        for target in targets:
93*c2e18aaaSAndroid Build Coastguard Worker            if target == constant.WHOLE_ANDROID_TREE_TARGET:
94*c2e18aaaSAndroid Build Coastguard Worker                print('Do not deal with whole source tree in native projects.')
95*c2e18aaaSAndroid Build Coastguard Worker                continue
96*c2e18aaaSAndroid Build Coastguard Worker            rel_path, _ = common_util.get_related_paths(self, target)
97*c2e18aaaSAndroid Build Coastguard Worker            for path in self.path_to_module_info:
98*c2e18aaaSAndroid Build Coastguard Worker                if common_util.is_source_under_relative_path(path, rel_path):
99*c2e18aaaSAndroid Build Coastguard Worker                    projects.extend(self.get_module_names(path))
100*c2e18aaaSAndroid Build Coastguard Worker        return projects
101*c2e18aaaSAndroid Build Coastguard Worker
102*c2e18aaaSAndroid Build Coastguard Worker    def get_module_includes(self, mod_name):
103*c2e18aaaSAndroid Build Coastguard Worker        """Gets module's include paths from module name.
104*c2e18aaaSAndroid Build Coastguard Worker
105*c2e18aaaSAndroid Build Coastguard Worker        The include paths contain in 'header_search_path' and
106*c2e18aaaSAndroid Build Coastguard Worker        'system_search_path' of all flags in native module info.
107*c2e18aaaSAndroid Build Coastguard Worker
108*c2e18aaaSAndroid Build Coastguard Worker        Args:
109*c2e18aaaSAndroid Build Coastguard Worker            mod_name: A string of module name.
110*c2e18aaaSAndroid Build Coastguard Worker
111*c2e18aaaSAndroid Build Coastguard Worker        Returns:
112*c2e18aaaSAndroid Build Coastguard Worker            A set of module include paths relative to android root.
113*c2e18aaaSAndroid Build Coastguard Worker        """
114*c2e18aaaSAndroid Build Coastguard Worker        includes = set()
115*c2e18aaaSAndroid Build Coastguard Worker        mod_info = self.name_to_module_info.get(mod_name, {})
116*c2e18aaaSAndroid Build Coastguard Worker        if not mod_info:
117*c2e18aaaSAndroid Build Coastguard Worker            logging.warning('%s module name %s does not exist.',
118*c2e18aaaSAndroid Build Coastguard Worker                            common_util.COLORED_INFO('Warning:'), mod_name)
119*c2e18aaaSAndroid Build Coastguard Worker            return includes
120*c2e18aaaSAndroid Build Coastguard Worker        for flag in mod_info:
121*c2e18aaaSAndroid Build Coastguard Worker            for header in (constant.KEY_HEADER, constant.KEY_SYSTEM):
122*c2e18aaaSAndroid Build Coastguard Worker                if header in mod_info[flag]:
123*c2e18aaaSAndroid Build Coastguard Worker                    includes.update(set(mod_info[flag][header]))
124*c2e18aaaSAndroid Build Coastguard Worker        return includes
125*c2e18aaaSAndroid Build Coastguard Worker
126*c2e18aaaSAndroid Build Coastguard Worker    def is_module_need_build(self, mod_name):
127*c2e18aaaSAndroid Build Coastguard Worker        """Checks if a module need to be built by its module name.
128*c2e18aaaSAndroid Build Coastguard Worker
129*c2e18aaaSAndroid Build Coastguard Worker        If a module's source files or include files contain a path looks like,
130*c2e18aaaSAndroid Build Coastguard Worker        'out/soong/.intermediates/../gen/sysprop/charger.sysprop.cpp' or
131*c2e18aaaSAndroid Build Coastguard Worker        'out/soong/.intermediates/../[email protected]_genc++_headers/gen'
132*c2e18aaaSAndroid Build Coastguard Worker        and the paths do not exist, that means the module needs to be built to
133*c2e18aaaSAndroid Build Coastguard Worker        generate relative source or include files.
134*c2e18aaaSAndroid Build Coastguard Worker
135*c2e18aaaSAndroid Build Coastguard Worker        Args:
136*c2e18aaaSAndroid Build Coastguard Worker            mod_name: A string of module name.
137*c2e18aaaSAndroid Build Coastguard Worker
138*c2e18aaaSAndroid Build Coastguard Worker        Returns:
139*c2e18aaaSAndroid Build Coastguard Worker            A boolean, True if it needs to be generated else False.
140*c2e18aaaSAndroid Build Coastguard Worker        """
141*c2e18aaaSAndroid Build Coastguard Worker        mod_info = self.name_to_module_info.get(mod_name, {})
142*c2e18aaaSAndroid Build Coastguard Worker        if not mod_info:
143*c2e18aaaSAndroid Build Coastguard Worker            logging.warning('%s module name %s does not exist.',
144*c2e18aaaSAndroid Build Coastguard Worker                            common_util.COLORED_INFO('Warning:'), mod_name)
145*c2e18aaaSAndroid Build Coastguard Worker            return False
146*c2e18aaaSAndroid Build Coastguard Worker        if self._is_source_need_build(mod_info):
147*c2e18aaaSAndroid Build Coastguard Worker            return True
148*c2e18aaaSAndroid Build Coastguard Worker        if self._is_include_need_build(mod_info):
149*c2e18aaaSAndroid Build Coastguard Worker            return True
150*c2e18aaaSAndroid Build Coastguard Worker        return False
151*c2e18aaaSAndroid Build Coastguard Worker
152*c2e18aaaSAndroid Build Coastguard Worker    @staticmethod
153*c2e18aaaSAndroid Build Coastguard Worker    def _is_source_need_build(mod_info):
154*c2e18aaaSAndroid Build Coastguard Worker        """Checks if a module's source files need to be built.
155*c2e18aaaSAndroid Build Coastguard Worker
156*c2e18aaaSAndroid Build Coastguard Worker        If a module's source files contain a path looks like,
157*c2e18aaaSAndroid Build Coastguard Worker        'out/soong/.intermediates/../gen/sysprop/charger.sysprop.cpp'
158*c2e18aaaSAndroid Build Coastguard Worker        and the paths do not exist, that means the module needs to be built to
159*c2e18aaaSAndroid Build Coastguard Worker        generate relative source files.
160*c2e18aaaSAndroid Build Coastguard Worker
161*c2e18aaaSAndroid Build Coastguard Worker        Args:
162*c2e18aaaSAndroid Build Coastguard Worker            mod_info: A dictionary of module info to check.
163*c2e18aaaSAndroid Build Coastguard Worker
164*c2e18aaaSAndroid Build Coastguard Worker        Returns:
165*c2e18aaaSAndroid Build Coastguard Worker            A boolean, True if it needs to be generated else False.
166*c2e18aaaSAndroid Build Coastguard Worker        """
167*c2e18aaaSAndroid Build Coastguard Worker        if constant.KEY_SRCS not in mod_info:
168*c2e18aaaSAndroid Build Coastguard Worker            return False
169*c2e18aaaSAndroid Build Coastguard Worker        for src in mod_info[constant.KEY_SRCS]:
170*c2e18aaaSAndroid Build Coastguard Worker            if re.search(_INC_GEN_CHECK, src) and not os.path.isfile(src):
171*c2e18aaaSAndroid Build Coastguard Worker                return True
172*c2e18aaaSAndroid Build Coastguard Worker        return False
173*c2e18aaaSAndroid Build Coastguard Worker
174*c2e18aaaSAndroid Build Coastguard Worker    @staticmethod
175*c2e18aaaSAndroid Build Coastguard Worker    def _is_include_need_build(mod_info):
176*c2e18aaaSAndroid Build Coastguard Worker        """Checks if a module needs to be built by its module name.
177*c2e18aaaSAndroid Build Coastguard Worker
178*c2e18aaaSAndroid Build Coastguard Worker        If a module's include files contain a path looks like,
179*c2e18aaaSAndroid Build Coastguard Worker        'out/soong/.intermediates/../[email protected]_genc++_headers/gen'
180*c2e18aaaSAndroid Build Coastguard Worker        and the paths do not exist, that means the module needs to be built to
181*c2e18aaaSAndroid Build Coastguard Worker        generate relative include files.
182*c2e18aaaSAndroid Build Coastguard Worker
183*c2e18aaaSAndroid Build Coastguard Worker        Args:
184*c2e18aaaSAndroid Build Coastguard Worker            mod_info: A dictionary of module info to check.
185*c2e18aaaSAndroid Build Coastguard Worker
186*c2e18aaaSAndroid Build Coastguard Worker        Returns:
187*c2e18aaaSAndroid Build Coastguard Worker            A boolean, True if it needs to be generated else False.
188*c2e18aaaSAndroid Build Coastguard Worker        """
189*c2e18aaaSAndroid Build Coastguard Worker        for flag in mod_info:
190*c2e18aaaSAndroid Build Coastguard Worker            for header in (constant.KEY_HEADER, constant.KEY_SYSTEM):
191*c2e18aaaSAndroid Build Coastguard Worker                if header not in mod_info[flag]:
192*c2e18aaaSAndroid Build Coastguard Worker                    continue
193*c2e18aaaSAndroid Build Coastguard Worker                for include in mod_info[flag][header]:
194*c2e18aaaSAndroid Build Coastguard Worker                    match = re.search(_INC_GEN_CHECK, include)
195*c2e18aaaSAndroid Build Coastguard Worker                    if match and not os.path.isdir(include):
196*c2e18aaaSAndroid Build Coastguard Worker                        return True
197*c2e18aaaSAndroid Build Coastguard Worker        return False
198*c2e18aaaSAndroid Build Coastguard Worker
199*c2e18aaaSAndroid Build Coastguard Worker    def is_suite_in_compatibility_suites(self, suite, mod_info):
200*c2e18aaaSAndroid Build Coastguard Worker        """Check if suite exists in the compatibility_suites of module-info.
201*c2e18aaaSAndroid Build Coastguard Worker
202*c2e18aaaSAndroid Build Coastguard Worker        Args:
203*c2e18aaaSAndroid Build Coastguard Worker            suite: A string of suite name.
204*c2e18aaaSAndroid Build Coastguard Worker            mod_info: Dict of module info to check.
205*c2e18aaaSAndroid Build Coastguard Worker
206*c2e18aaaSAndroid Build Coastguard Worker        Returns:
207*c2e18aaaSAndroid Build Coastguard Worker            True if it exists in mod_info, False otherwise.
208*c2e18aaaSAndroid Build Coastguard Worker        """
209*c2e18aaaSAndroid Build Coastguard Worker        raise NotImplementedError()
210*c2e18aaaSAndroid Build Coastguard Worker
211*c2e18aaaSAndroid Build Coastguard Worker    def get_testable_modules(self, suite=None):
212*c2e18aaaSAndroid Build Coastguard Worker        """Return the testable modules of the given suite name.
213*c2e18aaaSAndroid Build Coastguard Worker
214*c2e18aaaSAndroid Build Coastguard Worker        Args:
215*c2e18aaaSAndroid Build Coastguard Worker            suite: A string of suite name. Set to None to return all testable
216*c2e18aaaSAndroid Build Coastguard Worker            modules.
217*c2e18aaaSAndroid Build Coastguard Worker
218*c2e18aaaSAndroid Build Coastguard Worker        Returns:
219*c2e18aaaSAndroid Build Coastguard Worker            List of testable modules. Empty list if non-existent.
220*c2e18aaaSAndroid Build Coastguard Worker            If suite is None, return all the testable modules in module-info.
221*c2e18aaaSAndroid Build Coastguard Worker        """
222*c2e18aaaSAndroid Build Coastguard Worker        raise NotImplementedError()
223*c2e18aaaSAndroid Build Coastguard Worker
224*c2e18aaaSAndroid Build Coastguard Worker    def is_testable_module(self, mod_info):
225*c2e18aaaSAndroid Build Coastguard Worker        """Check if module is something we can test.
226*c2e18aaaSAndroid Build Coastguard Worker
227*c2e18aaaSAndroid Build Coastguard Worker        A module is testable if:
228*c2e18aaaSAndroid Build Coastguard Worker          - it's installed, or
229*c2e18aaaSAndroid Build Coastguard Worker          - it's a robolectric module (or shares path with one).
230*c2e18aaaSAndroid Build Coastguard Worker
231*c2e18aaaSAndroid Build Coastguard Worker        Args:
232*c2e18aaaSAndroid Build Coastguard Worker            mod_info: Dict of module info to check.
233*c2e18aaaSAndroid Build Coastguard Worker
234*c2e18aaaSAndroid Build Coastguard Worker        Returns:
235*c2e18aaaSAndroid Build Coastguard Worker            True if we can test this module, False otherwise.
236*c2e18aaaSAndroid Build Coastguard Worker        """
237*c2e18aaaSAndroid Build Coastguard Worker        raise NotImplementedError()
238*c2e18aaaSAndroid Build Coastguard Worker
239*c2e18aaaSAndroid Build Coastguard Worker    def has_test_config(self, mod_info):
240*c2e18aaaSAndroid Build Coastguard Worker        """Validate if this module has a test config.
241*c2e18aaaSAndroid Build Coastguard Worker
242*c2e18aaaSAndroid Build Coastguard Worker        A module can have a test config in the following manner:
243*c2e18aaaSAndroid Build Coastguard Worker          - AndroidTest.xml at the module path.
244*c2e18aaaSAndroid Build Coastguard Worker          - test_config be set in module-info.json.
245*c2e18aaaSAndroid Build Coastguard Worker          - Auto-generated config via the auto_test_config key in
246*c2e18aaaSAndroid Build Coastguard Worker            module-info.json.
247*c2e18aaaSAndroid Build Coastguard Worker
248*c2e18aaaSAndroid Build Coastguard Worker        Args:
249*c2e18aaaSAndroid Build Coastguard Worker            mod_info: Dict of module info to check.
250*c2e18aaaSAndroid Build Coastguard Worker
251*c2e18aaaSAndroid Build Coastguard Worker        Returns:
252*c2e18aaaSAndroid Build Coastguard Worker            True if this module has a test config, False otherwise.
253*c2e18aaaSAndroid Build Coastguard Worker        """
254*c2e18aaaSAndroid Build Coastguard Worker        raise NotImplementedError()
255*c2e18aaaSAndroid Build Coastguard Worker
256*c2e18aaaSAndroid Build Coastguard Worker    def get_robolectric_test_name(self, module_name):
257*c2e18aaaSAndroid Build Coastguard Worker        """Returns runnable robolectric module name.
258*c2e18aaaSAndroid Build Coastguard Worker
259*c2e18aaaSAndroid Build Coastguard Worker        There are at least 2 modules in every robolectric module path, return
260*c2e18aaaSAndroid Build Coastguard Worker        the module that we can run as a build target.
261*c2e18aaaSAndroid Build Coastguard Worker
262*c2e18aaaSAndroid Build Coastguard Worker        Arg:
263*c2e18aaaSAndroid Build Coastguard Worker            module_name: String of module.
264*c2e18aaaSAndroid Build Coastguard Worker
265*c2e18aaaSAndroid Build Coastguard Worker        Returns:
266*c2e18aaaSAndroid Build Coastguard Worker            String of module that is the runnable robolectric module, None if
267*c2e18aaaSAndroid Build Coastguard Worker            none could be found.
268*c2e18aaaSAndroid Build Coastguard Worker        """
269*c2e18aaaSAndroid Build Coastguard Worker        raise NotImplementedError()
270*c2e18aaaSAndroid Build Coastguard Worker
271*c2e18aaaSAndroid Build Coastguard Worker    def is_robolectric_test(self, module_name):
272*c2e18aaaSAndroid Build Coastguard Worker        """Check if module is a robolectric test.
273*c2e18aaaSAndroid Build Coastguard Worker
274*c2e18aaaSAndroid Build Coastguard Worker        A module can be a robolectric test if the specified module has their
275*c2e18aaaSAndroid Build Coastguard Worker        class set as ROBOLECTRIC (or shares their path with a module that does).
276*c2e18aaaSAndroid Build Coastguard Worker
277*c2e18aaaSAndroid Build Coastguard Worker        Args:
278*c2e18aaaSAndroid Build Coastguard Worker            module_name: String of module to check.
279*c2e18aaaSAndroid Build Coastguard Worker
280*c2e18aaaSAndroid Build Coastguard Worker        Returns:
281*c2e18aaaSAndroid Build Coastguard Worker            True if the module is a robolectric module, else False.
282*c2e18aaaSAndroid Build Coastguard Worker        """
283*c2e18aaaSAndroid Build Coastguard Worker        raise NotImplementedError()
284*c2e18aaaSAndroid Build Coastguard Worker
285*c2e18aaaSAndroid Build Coastguard Worker    def is_auto_gen_test_config(self, module_name):
286*c2e18aaaSAndroid Build Coastguard Worker        """Check if the test config file will be generated automatically.
287*c2e18aaaSAndroid Build Coastguard Worker
288*c2e18aaaSAndroid Build Coastguard Worker        Args:
289*c2e18aaaSAndroid Build Coastguard Worker            module_name: A string of the module name.
290*c2e18aaaSAndroid Build Coastguard Worker
291*c2e18aaaSAndroid Build Coastguard Worker        Returns:
292*c2e18aaaSAndroid Build Coastguard Worker            True if the test config file will be generated automatically.
293*c2e18aaaSAndroid Build Coastguard Worker        """
294*c2e18aaaSAndroid Build Coastguard Worker        raise NotImplementedError()
295*c2e18aaaSAndroid Build Coastguard Worker
296*c2e18aaaSAndroid Build Coastguard Worker    def is_robolectric_module(self, mod_info):
297*c2e18aaaSAndroid Build Coastguard Worker        """Check if a module is a robolectric module.
298*c2e18aaaSAndroid Build Coastguard Worker
299*c2e18aaaSAndroid Build Coastguard Worker        Args:
300*c2e18aaaSAndroid Build Coastguard Worker            mod_info: ModuleInfo to check.
301*c2e18aaaSAndroid Build Coastguard Worker
302*c2e18aaaSAndroid Build Coastguard Worker        Returns:
303*c2e18aaaSAndroid Build Coastguard Worker            True if module is a robolectric module, False otherwise.
304*c2e18aaaSAndroid Build Coastguard Worker        """
305*c2e18aaaSAndroid Build Coastguard Worker        raise NotImplementedError()
306*c2e18aaaSAndroid Build Coastguard Worker
307*c2e18aaaSAndroid Build Coastguard Worker    def is_native_test(self, module_name):
308*c2e18aaaSAndroid Build Coastguard Worker        """Check if the input module is a native test.
309*c2e18aaaSAndroid Build Coastguard Worker
310*c2e18aaaSAndroid Build Coastguard Worker        Args:
311*c2e18aaaSAndroid Build Coastguard Worker            module_name: A string of the module name.
312*c2e18aaaSAndroid Build Coastguard Worker
313*c2e18aaaSAndroid Build Coastguard Worker        Returns:
314*c2e18aaaSAndroid Build Coastguard Worker            True if the test is a native test, False otherwise.
315*c2e18aaaSAndroid Build Coastguard Worker        """
316*c2e18aaaSAndroid Build Coastguard Worker        raise NotImplementedError()
317