• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3#
4# Copyright (c) 2024 Huawei Device Co., Ltd.
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17
18import argparse
19import autotest_sdk
20
21
22class MainClass:
23    path = ''
24    work_path = ''
25
26    def __init__(self, path, expected_path='') -> None:
27        self.path = path
28        self.sdklinter = autotest_sdk.SDKLinterTest(path, expected_path)
29
30    def diff(self):
31        data_sdk = self.sdklinter.data_sdk
32
33
34def run():
35    parser = argparse.ArgumentParser(description='test for ArkTS')
36    parser.add_argument('--project_path', help='project path.')
37    parser.add_argument('--expected_path', default='',
38                        help='expected files dir')
39    parser.add_argument(
40        '--mode', help='set object to sdk or codelinter. TODO future RT.')
41    parser.add_argument('--verify', action='store_true', help='verify')
42    parser.add_argument('--update', action='store_true', help='update')
43
44    args = parser.parse_args()
45    print(args.project_path, args.expected_path)
46    m = MainClass(args.project_path, expected_path=args.expected_path)
47    if args.mode == 'sdk':
48        obj = m.sdklinter
49    obj.open_output()
50    if args.verify:
51        obj.verify()
52    if args.update:
53        obj.update()
54
55
56if __name__ == '__main__':
57    run()
58