From 88e5657082a347f2e4f1e7c41801ecf6b7c8b017 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Thu, 24 Nov 2022 22:57:36 -0500 Subject: [PATCH] =?UTF-8?q?[tools]=20=E6=94=AF=E6=8C=81=E9=80=9A=E8=BF=87-?= =?UTF-8?q?-project-name=3Dxxx=E8=AE=BE=E7=BD=AE=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E7=A8=8B=E6=96=87=E4=BB=B6=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=20=E9=BB=98=E8=AE=A4=E4=B8=BAproject.xx=20=E4=B8=8E=E5=8E=9F?= =?UTF-8?q?=E6=9D=A5=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4=20=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=EF=BC=9Ahttps://club.rt-thread.org/ask/article/f998b2?= =?UTF-8?q?1633f90916.html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/building.py | 22 ++++++++++------------ tools/options.py | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/tools/building.py b/tools/building.py index ada75f7806..f471e3cb12 100644 --- a/tools/building.py +++ b/tools/building.py @@ -812,35 +812,37 @@ def GenTargetProject(program = None): from keil import MDK2Project, MDK4Project, MDK5Project, ARMCC_Version if os.path.isfile('template.uvprojx') and GetOption('target') not in ['mdk4']: # Keil5 - MDK5Project('project.uvprojx', Projects) + MDK5Project(GetOption('project-name') + '.uvprojx', Projects) print("Keil5 project is generating...") elif os.path.isfile('template.uvproj') and GetOption('target') not in ['mdk5']: # Keil4 - MDK4Project('project.uvproj', Projects) + MDK4Project(GetOption('project-name') + '.uvproj', Projects) print("Keil4 project is generating...") elif os.path.isfile('template.Uv2') and GetOption('target') not in ['mdk4', 'mdk5']: # Keil2 - MDK2Project('project.Uv2', Projects) + MDK2Project(GetOption('project-name') + '.Uv2', Projects) print("Keil2 project is generating...") else: print ('No template project file found.') exit(1) print("Keil Version: " + ARMCC_Version()) + print("Keil-MDK project has generated successfully!") if GetOption('target') == 'iar': from iar import IARProject, IARVersion print("IAR Version: " + IARVersion()) - IARProject('project.ewp', Projects) + IARProject(GetOption('project-name') + '.ewp', Projects) + print("IAR project has generated successfully!") if GetOption('target') == 'vs': from vs import VSProject - VSProject('project.vcproj', Projects, program) + VSProject(GetOption('project-name') + '.vcproj', Projects, program) if GetOption('target') == 'vs2012': from vs2012 import VS2012Project - VS2012Project('project.vcxproj', Projects, program) + VS2012Project(GetOption('project-name') + '.vcxproj', Projects, program) if GetOption('target') == 'cb': from codeblocks import CBProject - CBProject('project.cbp', Projects, program) + CBProject(GetOption('project-name') + '.cbp', Projects, program) if GetOption('target') == 'ua': from ua import PrepareUA @@ -852,7 +854,7 @@ def GenTargetProject(program = None): if GetOption('target') == 'cdk': from cdk import CDKProject - CDKProject('project.cdkproj', Projects) + CDKProject(GetOption('project-name') + '.cdkproj', Projects) if GetOption('target') == 'ses': from ses import SESProject @@ -919,10 +921,6 @@ def EndBuilding(target, program = None): project_path = GetOption('project-path') project_name = GetOption('project-name') - if not isinstance(project_name, str) or len(project_name) == 0: - project_name = "dist_ide_project" - print("\nwarning : --project-name not specified, use default project name: {0}.".format(project_name)) - if not isinstance(project_path, str) or len(project_path) == 0 : project_path = os.path.join(BSP_ROOT, 'rt-studio-project', project_name) print("\nwarning : --project-path not specified, use default path: {0}.".format(project_path)) diff --git a/tools/options.py b/tools/options.py index 0840deed81..db5f52f632 100644 --- a/tools/options.py +++ b/tools/options.py @@ -51,7 +51,7 @@ def AddOptions(): AddOption('--project-name', dest = 'project-name', type = 'string', - default = None, + default = "project", help = 'set project name') AddOption('--reset-project-config', dest = 'reset-project-config',