add config file for dsoftbus

Signed-off-by: liubb_0516 <liubeibei8@huawei.com>
This commit is contained in:
liubb_0516 2021-08-23 12:05:17 +08:00
parent fb50a51b4c
commit bd5a7bcc05
3 changed files with 137 additions and 0 deletions

60
Kconfig Normal file
View File

@ -0,0 +1,60 @@
mainmenu "Dsoftbus Configuration"
comment "Select discovery protocol"
config enable_discovery_coap
bool "Enable discovery with coap"
default y
help
Answer Y to enable discovery with coap
config enable_discovery_ble
bool "Enable discovery with ble"
default n
help
Answer Y to enable discovery with ble
comment "Select connection protocol"
config enable_connection_tcp
bool "Enable connection with tcp"
default y
help
Answer Y to enable connection with tcp
config enable_connection_br
bool "Enable connection with br"
default n
help
Answer Y to enable connection with br
config enable_connection_ble
bool "Enable connection with ble"
default n
help
Answer Y to enable connection with ble
comment "Select transmission feature"
config enable_trans_udp
bool "Enable transmission with udp"
default n
help
Answer Y to enable transmission with udp
config enable_trans_udp_file
bool "Enable file transmission"
default n
depends on enable_trans_udp
help
Answer Y to enable file transmission with udp
comment "Other configuration"
config enable_auth_account
bool "Enable auth account"
default n
help
Answer Y to enable authenticate account
config enable_auto_networking
bool "Enable automatic networking"
default y
help
Answer Y to enable automatic networking

View File

@ -61,9 +61,11 @@ Note:If the text contains special characters, please escape them according to th
</filefilter>
<filefilter name="copyrightPolicyFilter" desc="copyright文件头校验策略的过滤条件" >
<filteritem type="filepath" name="core/frame/standard/server/src/softbus_server.cfg" desc="cfg文件为json格式,无法添加版权头"/>
<filteritem type="filepath" name="Kconfig" desc="配置文件无法添加版权头"/>
</filefilter>
<filefilter name="defaultPolicyFilter" desc="根目录LICENSE文件校验策略的过滤条件xxx" >
<filteritem type="filepath" name="core/frame/standard/server/src/softbus_server.cfg" desc="cfg文件为json格式,无法添加License"/>
<filteritem type="filepath" name="Kconfig" desc="配置文件无法添加版权头"/>
</filefilter>
</filefilterlist>
</oatconfig>

75
config.py Normal file
View File

@ -0,0 +1,75 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
from PyInquirer import prompt
def enable_option(file_name):
option_list = []
try:
with open('.config', 'r') as f:
for line in f:
if line.startswith('CONFIG_'):
str1 = line.split('=')
option_list.append(str1[0][7:])
except IOError:
print('No config file')
return
if os.path.exists('.config'):
os.system('rm .config')
file_data = ''
with open(file_name, 'r') as f:
for line in f:
if '=' in line:
str1 = line.split('=')
if str1[0].strip() in option_list:
line = str1[0] + '= true\n'
else:
line = str1[0] + '= false\n'
file_data += line
with open(file_name, 'w') as f:
f.write(file_data)
def ask_option():
options_prompt = {
'type': 'list',
'name': 'option',
'message': 'Which platform do you want to config?',
'default': 'standard',
'choices': ['standard', 'small', 'mini']
}
answers = prompt(options_prompt)
return answers['option']
def update_config_file():
option = ask_option()
os.system('menuconfig')
if (option == 'standard'):
enable_option('./adapter/default_config/feature_config/standard/config.gni')
elif (option == 'small'):
enable_option('./adapter/default_config/feature_config/small/config.gni')
else:
enable_option('./adapter/default_config/feature_config/mini/config.gni')
if __name__ == '__main__':
print('##### Welcome to Dsoftbus #####')
update_config_file()