• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4#
5# Copyright (c) 2020 Huawei Device Co., Ltd.
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18
19import os
20
21
22def get_config_path():
23    search_path = os.getcwd()
24    root_path = os.path.abspath(os.sep)
25    while search_path != root_path:
26        config_path = os.path.join(search_path, 'ohos_config.json')
27        if os.path.isfile(config_path):
28            return config_path
29        search_path = os.path.dirname(search_path)
30    return os.path.abspath(
31        os.path.join(os.path.dirname(__file__), 'common', 'config.json'))
32
33
34CONFIG_JSON = get_config_path()
35CONFIG_STRUCT = {
36    "root_path": None,
37    "board": None,
38    "kernel": None,
39    "product": None,
40    "product_path": None,
41    "device_path": None,
42    "device_company": None,
43    "os_level": None,
44    "version": None,
45    "patch_cache": None
46}
47
48BUILD_TOOLS_CFG = {
49    "Linux": {
50        "build_tools_path": 'prebuilts/build-tools/linux-x86/bin',
51        "gn": 'https://repo.huaweicloud.com/harmonyos/compiler/gn/' +\
52              '1717/linux/gn-linux-x86-1717.tar.gz',
53        "ninja": 'https://repo.huaweicloud.com/harmonyos/compiler/ninja/' +\
54                 '1.10.1/linux/ninja-linux-x86-1.10.1.tar.gz',
55        "clang": 'https://repo.huaweicloud.com/harmonyos/compiler/clang/' +\
56                 '10.0.1-62608/linux/llvm.tar.gz'
57    },
58    "Windows": {
59        "build_tools_path": 'prebuilts\\build-tools\\win-x86\\bin',
60        "gn": 'https://repo.huaweicloud.com/harmonyos/compiler/gn/' +\
61              '1744/windows/gn-windows-amd64.zip',
62        "ninja": 'https://repo.huaweicloud.com/harmonyos/compiler/ninja/' +\
63                 '1.9.0/windows/ninja-win.zip'
64    }
65}
66