-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[tool]: 允许通过rtconfig.py自定义工程名与链接文件夹,增强eclipse脚本处理 #10648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wdfk-prog
wants to merge
5
commits into
RT-Thread:master
Choose a base branch
from
wdfk-prog:eclipse
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+253
−94
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6d61514
[tool]Add project-name option for custom project naming in IDE targets
wdfk-prog 0fc5f25
[tool][rt_studio]:Support custom project naming
wdfk-prog 27bcc3e
[tool][eclipse]:Add project-name support and enhance folder linking
wdfk-prog 85e9c7f
[tool][eclipse]: Add pre-build and post-build step settings
wdfk-prog 26dd8ee
[tools][eclipse]: Improve RelativeProjectPath function to handle mult…
wdfk-prog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
# 2025-01-05 Bernard Add logging as Env['log'] | ||
# 2025-03-02 ZhaoCake Add MkDist_Strip | ||
# 2025-01-05 Assistant Refactor SCons PreProcessor patch to independent class | ||
# 2025-09-01 wdfk-prog Add project-name option for custom project naming in IDE targets | ||
|
||
import os | ||
import sys | ||
|
@@ -802,19 +803,21 @@ def local_group(group, objects): | |
|
||
EndBuilding(target, program) | ||
|
||
def GenTargetProject(program = None): | ||
def GenTargetProject(program = None, project_name = None): | ||
if project_name is None: | ||
project_name = GetOption('project-name') | ||
|
||
if GetOption('target') in ['mdk', 'mdk4', 'mdk5']: | ||
from targets.keil import MDK2Project, MDK4Project, MDK5Project, ARMCC_Version | ||
|
||
if os.path.isfile('template.uvprojx') and GetOption('target') not in ['mdk4']: # Keil5 | ||
MDK5Project(Env, GetOption('project-name') + '.uvprojx', Projects) | ||
MDK5Project(Env, project_name + '.uvprojx', Projects) | ||
print("Keil5 project is generating...") | ||
elif os.path.isfile('template.uvproj') and GetOption('target') not in ['mdk5']: # Keil4 | ||
MDK4Project(Env, GetOption('project-name') + '.uvproj', Projects) | ||
MDK4Project(Env, project_name + '.uvproj', Projects) | ||
print("Keil4 project is generating...") | ||
elif os.path.isfile('template.Uv2') and GetOption('target') not in ['mdk4', 'mdk5']: # Keil2 | ||
MDK2Project(Env, GetOption('project-name') + '.Uv2', Projects) | ||
MDK2Project(Env, project_name + '.Uv2', Projects) | ||
print("Keil2 project is generating...") | ||
else: | ||
print ('No template project file found.') | ||
|
@@ -825,20 +828,20 @@ def GenTargetProject(program = None): | |
if GetOption('target') == 'iar': | ||
from targets.iar import IARProject, IARVersion | ||
print("IAR Version: " + IARVersion()) | ||
IARProject(Env, GetOption('project-name') + '.ewp', Projects) | ||
IARProject(Env, project_name + '.ewp', Projects) | ||
print("IAR project has generated successfully!") | ||
|
||
if GetOption('target') == 'vs': | ||
from targets.vs import VSProject | ||
VSProject(GetOption('project-name') + '.vcproj', Projects, program) | ||
VSProject(project_name + '.vcproj', Projects, program) | ||
|
||
if GetOption('target') == 'vs2012': | ||
from targets.vs2012 import VS2012Project | ||
VS2012Project(GetOption('project-name') + '.vcxproj', Projects, program) | ||
VS2012Project(project_name + '.vcxproj', Projects, program) | ||
|
||
if GetOption('target') == 'cb': | ||
from targets.codeblocks import CBProject | ||
CBProject(GetOption('project-name') + '.cbp', Projects, program) | ||
CBProject(project_name + '.cbp', Projects, program) | ||
|
||
if GetOption('target') == 'ua': | ||
from targets.ua import PrepareUA | ||
|
@@ -857,7 +860,7 @@ def GenTargetProject(program = None): | |
|
||
if GetOption('target') == 'cdk': | ||
from targets.cdk import CDKProject | ||
CDKProject(GetOption('project-name') + '.cdkproj', Projects) | ||
CDKProject(project_name + '.cdkproj', Projects) | ||
|
||
if GetOption('target') == 'ses': | ||
from targets.ses import SESProject | ||
|
@@ -869,15 +872,17 @@ def GenTargetProject(program = None): | |
|
||
if GetOption('target') == 'eclipse': | ||
from targets.eclipse import TargetEclipse | ||
TargetEclipse(Env, GetOption('reset-project-config'), GetOption('project-name')) | ||
from utils import ProjectInfo | ||
project = ProjectInfo(Env) | ||
TargetEclipse(Env, project, GetOption('reset-project-config'), project_name) | ||
|
||
if GetOption('target') == 'codelite': | ||
from targets.codelite import TargetCodelite | ||
TargetCodelite(Projects, program) | ||
|
||
if GetOption('target') == 'cmake' or GetOption('target') == 'cmake-armclang': | ||
from targets.cmake import CMakeProject | ||
CMakeProject(Env, Projects, GetOption('project-name')) | ||
CMakeProject(Env, Projects, project_name) | ||
|
||
if GetOption('target') == 'xmake': | ||
from targets.xmake import XMakeProject | ||
|
@@ -912,13 +917,20 @@ def EndBuilding(target, program = None): | |
Clean(target, 'rtua.pyc') | ||
Clean(target, '.sconsign.dblite') | ||
|
||
# Priority: 1. PROJECT_NAME in rtconfig.py -> | ||
# 2. --project-name command line option -> | ||
# 3. SCons default value ('project') | ||
project_name = GetOption('project-name') | ||
if hasattr(rtconfig, 'PROJECT_NAME') and rtconfig.PROJECT_NAME: | ||
project_name = rtconfig.PROJECT_NAME | ||
|
||
|
||
if GetOption('target'): | ||
Comment on lines
+924
to
928
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. English: There are unnecessary blank lines (lines 926-927) that should be reduced to a single blank line for better code formatting. Chinese: 有不必要的空行(第926-927行),应该减少为单个空行以获得更好的代码格式。 Copilot generated this review using guidance from repository custom instructions. Positive FeedbackNegative Feedback |
||
GenTargetProject(program) | ||
GenTargetProject(program, project_name) | ||
need_exit = True | ||
|
||
BSP_ROOT = Dir('#').abspath | ||
|
||
project_name = GetOption('project-name') | ||
project_path = GetOption('project-path') | ||
|
||
# 合并处理打包相关选项 | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
English: The comment describes priority logic that doesn't match the implementation. The code sets project_name from GetOption first, then overwrites it if rtconfig.PROJECT_NAME exists, which makes rtconfig.PROJECT_NAME higher priority, not GetOption. Chinese: 注释描述的优先级逻辑与实现不匹配。代码首先从GetOption设置project_name,然后如果rtconfig.PROJECT_NAME存在就覆盖它,这使得rtconfig.PROJECT_NAME具有更高的优先级,而不是GetOption。
Copilot generated this review using guidance from repository custom instructions.