• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# Copyright (c) 2021 Huawei Device Co., Ltd.
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16import sys
17import os
18import argparse
19
20
21def run(args):
22    exist_targets = []
23    for ndk_lib in args.ndk_lib_target_list:
24        if not ndk_lib.startswith("//"):
25            raise Exception(
26                "ndk target '{}' configuration error.".format(ndk_lib))
27        _build_gn_file = ndk_lib[len('//'):].split(':')[0]
28        ndk_lib_def_file = os.path.realpath(
29            os.path.join(args.source_root_dir, _build_gn_file))
30        if not os.path.exists(ndk_lib_def_file):
31            continue
32        exist_targets.append(ndk_lib)
33    return exist_targets
34
35
36def main(argv):
37    parser = argparse.ArgumentParser()
38    parser.add_argument('--ndk-lib-target-list', nargs='+', required=True)
39    parser.add_argument('--source-root-dir', required=True)
40    args = parser.parse_args(argv)
41    exist_targets = run(args)
42    for _target in exist_targets:
43        print(_target)
44
45
46if __name__ == '__main__':
47    sys.exit(main(sys.argv[1:]))
48