-
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
base: master
Are you sure you want to change the base?
Conversation
- Priority: 1. PROJECT_NAME in rtconfig.py -> 2. --project-name command line option -> 3. SCons default value ('project')
- Add project-name support for Eclipse target, allowing users to specify custom project names via the --project-name option - Enhance .project file update mechanism to properly handle PROJECT_SOURCE_FOLDERS defined in rtconfig.py - Support linking external folders located at different physical locations - Improve path handling with Eclipse standard path variables (PARENT-* and PROJECT_LOC) for better project portability
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.
Pull Request Overview
This PR enhances the Eclipse project generation functionality by adding support for custom project names and linked source folders through configuration in rtconfig.py. The enhancement aims to better support project structures where multiple projects share common source directories outside the BSP root.
Key changes:
- Adds PROJECT_NAME configuration option for custom project naming
- Implements PROJECT_SOURCE_FOLDERS for linking external directories
- Enhances Eclipse target processing to handle complex project structures
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
tools/targets/rt_studio.py | Modifies gen_project_file to accept project_name parameter for template replacement |
tools/targets/eclipse.py | Major rewrite of UpdateProjectStructure function and adds UpdateProjectName function for enhanced Eclipse project generation |
tools/building.py | Updates GenTargetProject and EndBuilding functions to support project_name parameter and priority handling |
# Count how many levels up | ||
levels_up = relative_link_path.count('../') | ||
clean_path = relative_link_path.replace('../', '') | ||
location_uri = f'PARENT-{levels_up}-PROJECT_LOC/{clean_path}' |
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 indentation is inconsistent. Line 413 has extra spaces before the comment, while line 415 has proper indentation. Chinese: 缩进不一致。第413行注释前有额外的空格,而第415行有正确的缩进。
Copilot generated this review using guidance from repository custom instructions.
xml_indent(root) | ||
with open('.project', 'w', encoding='utf-8') as f: | ||
f.write('<?xml version="1.0" encoding="UTF-8"?>\n') | ||
f.write(etree.tostring(root, encoding='utf-8').decode('utf-8')) |
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: Line 562 has extra spaces before the f.write call, creating inconsistent indentation within the with block. Chinese: 第562行在f.write调用前有额外的空格,在with块内创建了不一致的缩进。
Copilot generated this review using guidance from repository custom instructions.
# Priority: 1. PROJECT_NAME in rtconfig.py -> | ||
# 2. --project-name command line option -> | ||
# 3. SCons default value ('project') |
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.
if hasattr(rtconfig, 'PROJECT_NAME') and rtconfig.PROJECT_NAME: | ||
project_name = rtconfig.PROJECT_NAME | ||
|
||
|
||
if GetOption('target'): |
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: 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.
- Add pre-build and post-build steps in the cproject file - Support custom pre-build and post-build steps
基于你提出的两个优化项: 1.这个自动生成链接,我看你硬编码成了PARENT-{levels_up}-PROJECT_LOC,但是这个应该只适用于你自己设定的目录名称吧,通用性没做好,实际查找路径会存在问题(这个功能我觉得自己如果有这方面需求,写个脚本自动转一下就好了,不建议提交到主线上,studio里提供两个导入选项,一个是导入bsp,也就是针对主线上的bsp,这个是支持一键导入的,只不过需要确保.settings下的配置正确;还有是导入studio项目,这个是专门为了rtt的sdk项目做的,两个功能不都是正常的嘛) 2.建议你的这个导入studio后名称修改为实际名称,这里可以用环境变量获取实际的项目名称,而不是让用户手动在源码里加入PROJECT_NAME此项 |
|
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
scons --target=eclipse
不大满足通用需求scons --target=eclipse
命令生成的.project项目名,总是会被改成project.你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0
代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up