mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2026-02-27 14:26:36 +00:00
Bump project version to 2.2.3 and fix release.py (#1771)
* chore: Bump project version to 2.2.3 and refactor board configuration parsing in release script - Updated PROJECT_VER in CMakeLists.txt from 2.2.2 to 2.2.3. - Refactored the board configuration parsing logic in release.py to improve clarity and efficiency by eliminating the mapping function and directly searching for the board type in the CMakeLists.txt file. * refactor: Remove unused system_info.h include and delete obsolete source root file - Removed the inclusion of system_info.h in main.cc as it was no longer needed. - Deleted the _codeql_detected_source_root file, which was obsolete. * feat: Add lcd_init_cmds.h include for display initialization in esp32-p4-nano board - Included the lcd_init_cmds.h header file in esp32-p4-nano.cc to support display initialization commands, enhancing the board's functionality. * chore: Update build workflow and board configuration files - Changed the build job name in the GitHub Actions workflow to use the full name of the matrix variant for better clarity. - Refactored CMakeLists.txt to improve the formatting of the BOARD_SOURCES file globbing. - Added manufacturer information to the config.json files for the eda-robot-pro, eda-super-bear, and eda-tv-pro boards to ensure consistency in configuration.
This commit is contained in:
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -83,7 +83,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build ${{ matrix.name }}
|
name: Build ${{ matrix.full_name }}
|
||||||
needs: prepare
|
needs: prepare
|
||||||
if: ${{ needs.prepare.outputs.variants != '[]' }}
|
if: ${{ needs.prepare.outputs.variants != '[]' }}
|
||||||
strategy:
|
strategy:
|
||||||
@@ -106,6 +106,6 @@ jobs:
|
|||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: xiaozhi_${{ matrix.name }}_${{ github.sha }}.bin
|
name: xiaozhi_${{ matrix.full_name }}_${{ github.sha }}
|
||||||
path: build/merged-binary.bin
|
path: build/merged-binary.bin
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
|||||||
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
|
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
|
||||||
idf_build_set_property(MINIMAL_BUILD ON)
|
idf_build_set_property(MINIMAL_BUILD ON)
|
||||||
|
|
||||||
set(PROJECT_VER "2.2.2")
|
set(PROJECT_VER "2.2.3")
|
||||||
project(xiaozhi)
|
project(xiaozhi)
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
.
|
|
||||||
@@ -705,17 +705,17 @@ elseif(CONFIG_BOARD_TYPE_HU_087)
|
|||||||
set(BUILTIN_ICON_FONT font_awesome_14_1)
|
set(BUILTIN_ICON_FONT font_awesome_14_1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB BOARD_SOURCES
|
|
||||||
if(MANUFACTURER)
|
if(MANUFACTURER)
|
||||||
|
file(GLOB BOARD_SOURCES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/${MANUFACTURER}/${BOARD_TYPE}/*.cc
|
${CMAKE_CURRENT_SOURCE_DIR}/boards/${MANUFACTURER}/${BOARD_TYPE}/*.cc
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/${MANUFACTURER}/${BOARD_TYPE}/*.c
|
${CMAKE_CURRENT_SOURCE_DIR}/boards/${MANUFACTURER}/${BOARD_TYPE}/*.c
|
||||||
else
|
)
|
||||||
|
else()
|
||||||
|
file(GLOB BOARD_SOURCES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc
|
${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.c
|
${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.c
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
list(APPEND SOURCES ${BOARD_SOURCES})
|
list(APPEND SOURCES ${BOARD_SOURCES})
|
||||||
|
|
||||||
# Select audio processor according to Kconfig
|
# Select audio processor according to Kconfig
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"manufacturer": "lceda-course-examples",
|
||||||
"target": "esp32s3",
|
"target": "esp32s3",
|
||||||
"builds": [
|
"builds": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"manufacturer": "lceda-course-examples",
|
||||||
"target": "esp32s3",
|
"target": "esp32s3",
|
||||||
"builds": [
|
"builds": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"manufacturer": "lceda-course-examples",
|
||||||
"target": "esp32s3",
|
"target": "esp32s3",
|
||||||
"builds": [
|
"builds": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "esp_lcd_mipi_dsi.h"
|
#include "esp_lcd_mipi_dsi.h"
|
||||||
#include "esp_lcd_jd9365.h"
|
#include "esp_lcd_jd9365.h"
|
||||||
|
#include "lcd_init_cmds.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include <freertos/task.h>
|
#include <freertos/task.h>
|
||||||
|
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "system_info.h"
|
|
||||||
|
|
||||||
#define TAG "main"
|
#define TAG "main"
|
||||||
|
|
||||||
|
|||||||
@@ -126,12 +126,15 @@ def rename_artifact(original_name: str, version: str) -> str:
|
|||||||
- Remove "xiaozhi_" prefix
|
- Remove "xiaozhi_" prefix
|
||||||
- Remove hash suffix (underscore followed by hex string)
|
- Remove hash suffix (underscore followed by hex string)
|
||||||
- Add version prefix (e.g., "v2.0.4_")
|
- Add version prefix (e.g., "v2.0.4_")
|
||||||
- Change extension to .zip
|
- Add .zip extension
|
||||||
|
|
||||||
Example:
|
Examples:
|
||||||
xiaozhi_atk-dnesp32s3-box0_43ef2f4e7f0957dc62ec7d628ac2819d226127b8.bin
|
xiaozhi_atk-dnesp32s3-box0_43ef2f4e7f0957dc62ec7d628ac2819d226127b8
|
||||||
-> v2.0.4_atk-dnesp32s3-box0.zip
|
-> v2.0.4_atk-dnesp32s3-box0.zip
|
||||||
|
|
||||||
|
xiaozhi_waveshare-esp32-p4-nano-10.1-a_43ef2f4e7f0957dc62ec7d628ac2819d226127b8
|
||||||
|
-> v2.0.4_waveshare-esp32-p4-nano-10.1-a.zip
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
original_name: Original artifact name
|
original_name: Original artifact name
|
||||||
version: Version string (e.g., "2.0.4")
|
version: Version string (e.g., "2.0.4")
|
||||||
|
|||||||
@@ -74,9 +74,12 @@ def _collect_variants(config_filename: str = "config.json") -> list[dict[str, st
|
|||||||
"""Traverse all boards under main/boards, collect variant information.
|
"""Traverse all boards under main/boards, collect variant information.
|
||||||
|
|
||||||
Return example:
|
Return example:
|
||||||
[{"board": "bread-compact-ml307", "name": "bread-compact-ml307"}, ...]
|
[{"board": "bread-compact-ml307", "name": "bread-compact-ml307", "full_name": "bread-compact-ml307"}, ...]
|
||||||
|
[{"board": "waveshare/esp32-p4-nano", "name": "esp32-p4-nano-10.1-a", "full_name": "waveshare-esp32-p4-nano-10.1-a"}, ...]
|
||||||
"""
|
"""
|
||||||
variants: list[dict[str, str]] = []
|
variants: list[dict[str, str]] = []
|
||||||
|
errors: list[str] = []
|
||||||
|
|
||||||
for cfg_path in _BOARDS_DIR.rglob(config_filename):
|
for cfg_path in _BOARDS_DIR.rglob(config_filename):
|
||||||
board_dir = cfg_path.parent
|
board_dir = cfg_path.parent
|
||||||
if board_dir.name == "common":
|
if board_dir.name == "common":
|
||||||
@@ -87,41 +90,74 @@ def _collect_variants(config_filename: str = "config.json") -> list[dict[str, st
|
|||||||
with cfg_path.open() as f:
|
with cfg_path.open() as f:
|
||||||
cfg = json.load(f)
|
cfg = json.load(f)
|
||||||
|
|
||||||
|
manufacturer = _get_manufacturer(cfg)
|
||||||
|
|
||||||
|
# Check manufacturer consistency with directory structure
|
||||||
|
if "/" in board:
|
||||||
|
# Board is in a subdirectory (e.g., waveshare/esp32-p4-nano)
|
||||||
|
expected_manufacturer = board.split("/")[0]
|
||||||
|
if not manufacturer:
|
||||||
|
errors.append(
|
||||||
|
f"{cfg_path}: Board is in '{expected_manufacturer}/' subdirectory, "
|
||||||
|
f"but config.json is missing \"manufacturer\": \"{expected_manufacturer}\""
|
||||||
|
)
|
||||||
|
elif manufacturer != expected_manufacturer:
|
||||||
|
errors.append(
|
||||||
|
f"{cfg_path}: manufacturer mismatch, "
|
||||||
|
f"directory is '{expected_manufacturer}/' but config.json has \"{manufacturer}\""
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# Board is directly under boards/ directory
|
||||||
|
if manufacturer:
|
||||||
|
errors.append(
|
||||||
|
f"{cfg_path}: Board is not in a manufacturer subdirectory, "
|
||||||
|
f"but config.json defines manufacturer \"{manufacturer}\", "
|
||||||
|
f"please move board to main/boards/{manufacturer}/{board}/"
|
||||||
|
)
|
||||||
|
|
||||||
for build in cfg.get("builds", []):
|
for build in cfg.get("builds", []):
|
||||||
name = build["name"]
|
name = build["name"]
|
||||||
|
full_name = f"{manufacturer}-{name}" if manufacturer else name
|
||||||
variants.append({
|
variants.append({
|
||||||
"board": board,
|
"board": board,
|
||||||
"name": name
|
"name": name,
|
||||||
|
"full_name": full_name
|
||||||
})
|
})
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[ERROR] 解析 {cfg_path} 失败: {e}", file=sys.stderr)
|
print(f"[ERROR] Failed to parse {cfg_path}: {e}", file=sys.stderr)
|
||||||
|
|
||||||
|
# Report all errors at once
|
||||||
|
if errors:
|
||||||
|
print("\n[ERROR] Found manufacturer configuration issues:", file=sys.stderr)
|
||||||
|
for err in errors:
|
||||||
|
print(f" - {err}", file=sys.stderr)
|
||||||
|
print(file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
return variants
|
return variants
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _parse_board_config_map() -> dict[str, str]:
|
|
||||||
"""Build the mapping of CONFIG_BOARD_TYPE_xxx and board_type from main/CMakeLists.txt"""
|
|
||||||
cmake_file = Path("main/CMakeLists.txt")
|
|
||||||
mapping: dict[str, str] = {}
|
|
||||||
lines = cmake_file.read_text(encoding="utf-8").splitlines()
|
|
||||||
for idx, line in enumerate(lines):
|
|
||||||
if "if(CONFIG_BOARD_TYPE_" in line:
|
|
||||||
config_name = line.strip().split("if(")[1].split(")")[0]
|
|
||||||
if idx + 1 < len(lines):
|
|
||||||
next_line = lines[idx + 1].strip()
|
|
||||||
if next_line.startswith("set(BOARD_TYPE"):
|
|
||||||
board_type = next_line.split('"')[1]
|
|
||||||
mapping[config_name] = board_type
|
|
||||||
return mapping
|
|
||||||
|
|
||||||
|
|
||||||
def _find_board_config(board_type: str) -> Optional[str]:
|
def _find_board_config(board_type: str) -> Optional[str]:
|
||||||
"""Find the corresponding CONFIG_BOARD_TYPE_xxx for the given board_type"""
|
"""Find the corresponding CONFIG_BOARD_TYPE_xxx for the given board_type
|
||||||
for config, b_type in _parse_board_config_map().items():
|
|
||||||
if b_type == board_type:
|
Search backwards from 'set(BOARD_TYPE "xxx")' to find the nearest if(CONFIG_BOARD_TYPE_).
|
||||||
return config
|
"""
|
||||||
|
board_leaf = board_type.split("/")[-1]
|
||||||
|
pattern = f'set(BOARD_TYPE "{board_leaf}")'
|
||||||
|
|
||||||
|
cmake_file = Path("main/CMakeLists.txt")
|
||||||
|
lines = cmake_file.read_text(encoding="utf-8").splitlines()
|
||||||
|
|
||||||
|
for idx, line in enumerate(lines):
|
||||||
|
if pattern in line:
|
||||||
|
# Found the BOARD_TYPE line, search backwards for the config
|
||||||
|
for back_idx in range(idx - 1, -1, -1):
|
||||||
|
back_line = lines[back_idx]
|
||||||
|
if "if(CONFIG_BOARD_TYPE_" in back_line:
|
||||||
|
return back_line.strip().split("if(")[1].split(")")[0]
|
||||||
|
break
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@@ -190,7 +226,7 @@ def release(board_type: str, config_filename: str = "config.json", *, filter_nam
|
|||||||
"""
|
"""
|
||||||
cfg_path = _BOARDS_DIR / Path(board_type) / config_filename
|
cfg_path = _BOARDS_DIR / Path(board_type) / config_filename
|
||||||
if not cfg_path.exists():
|
if not cfg_path.exists():
|
||||||
print(f"[WARN] {cfg_path} 不存在,跳过 {board_type}")
|
print(f"[WARN] {cfg_path} does not exist, skipping {board_type}")
|
||||||
return
|
return
|
||||||
|
|
||||||
project_version = get_project_version()
|
project_version = get_project_version()
|
||||||
@@ -205,7 +241,7 @@ def release(board_type: str, config_filename: str = "config.json", *, filter_nam
|
|||||||
if filter_name:
|
if filter_name:
|
||||||
builds = [b for b in builds if b["name"] == filter_name]
|
builds = [b for b in builds if b["name"] == filter_name]
|
||||||
if not builds:
|
if not builds:
|
||||||
print(f"[ERROR] 未在 {board_type} 的 {config_filename} 中找到变体 {filter_name}", file=sys.stderr)
|
print(f"[ERROR] Variant {filter_name} not found in {board_type}'s {config_filename}", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
for build in builds:
|
for build in builds:
|
||||||
@@ -213,12 +249,12 @@ def release(board_type: str, config_filename: str = "config.json", *, filter_nam
|
|||||||
board_leaf = board_type.split("/")[-1]
|
board_leaf = board_type.split("/")[-1]
|
||||||
|
|
||||||
if board_leaf not in name:
|
if board_leaf not in name:
|
||||||
raise ValueError(f"build.name {name} 必须包含 {board_leaf}")
|
raise ValueError(f"build.name {name} must contain {board_leaf}")
|
||||||
|
|
||||||
final_name = f"{manufacturer}-{name}" if manufacturer else name
|
final_name = f"{manufacturer}-{name}" if manufacturer else name
|
||||||
output_path = Path("releases") / f"v{project_version}_{final_name}.zip"
|
output_path = Path("releases") / f"v{project_version}_{final_name}.zip"
|
||||||
if output_path.exists():
|
if output_path.exists():
|
||||||
print(f"跳过 {final_name} 因为 {output_path} 已存在")
|
print(f"Skipping {final_name} because {output_path} already exists")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Process sdkconfig_append
|
# Process sdkconfig_append
|
||||||
@@ -265,11 +301,11 @@ def release(board_type: str, config_filename: str = "config.json", *, filter_nam
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("board", nargs="?", default=None, help="板子类型或 all")
|
parser.add_argument("board", nargs="?", default=None, help="Board type or 'all'")
|
||||||
parser.add_argument("-c", "--config", default="config.json", help="指定 config 文件名,默认 config.json")
|
parser.add_argument("-c", "--config", default="config.json", help="Config filename (default: config.json)")
|
||||||
parser.add_argument("--list-boards", action="store_true", help="列出所有支持的 board 及变体列表")
|
parser.add_argument("--list-boards", action="store_true", help="List all supported boards and variants")
|
||||||
parser.add_argument("--json", action="store_true", help="配合 --list-boards,JSON 格式输出")
|
parser.add_argument("--json", action="store_true", help="Output in JSON format (use with --list-boards)")
|
||||||
parser.add_argument("--name", help="指定变体名称,仅编译匹配的变体(使用原始name,不带厂商前缀)")
|
parser.add_argument("--name", help="Variant name to compile (original name without manufacturer prefix)")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@@ -288,7 +324,7 @@ if __name__ == "__main__":
|
|||||||
merge_bin()
|
merge_bin()
|
||||||
curr_board_type = get_board_type_from_compile_commands()
|
curr_board_type = get_board_type_from_compile_commands()
|
||||||
if curr_board_type is None:
|
if curr_board_type is None:
|
||||||
print("未能从 compile_commands.json 解析 board_type", file=sys.stderr)
|
print("Failed to parse board_type from compile_commands.json", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
project_ver = get_project_version()
|
project_ver = get_project_version()
|
||||||
zip_bin(curr_board_type, project_ver)
|
zip_bin(curr_board_type, project_ver)
|
||||||
@@ -300,7 +336,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# Check board_type in CMakeLists
|
# Check board_type in CMakeLists
|
||||||
if board_type_input != "all" and not _board_type_exists(board_type_input):
|
if board_type_input != "all" and not _board_type_exists(board_type_input):
|
||||||
print(f"[ERROR] main/CMakeLists.txt 中未找到 board_type {board_type_input}", file=sys.stderr)
|
print(f"[ERROR] board_type {board_type_input} not found in main/CMakeLists.txt", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
variants_all = _collect_variants(config_filename=args.config)
|
variants_all = _collect_variants(config_filename=args.config)
|
||||||
@@ -314,10 +350,10 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
for bt in sorted(target_board_types):
|
for bt in sorted(target_board_types):
|
||||||
if not _board_type_exists(bt):
|
if not _board_type_exists(bt):
|
||||||
print(f"[ERROR] main/CMakeLists.txt 中未找到 board_type {bt}", file=sys.stderr)
|
print(f"[ERROR] board_type {bt} not found in main/CMakeLists.txt", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
cfg_path = _BOARDS_DIR / bt / args.config
|
cfg_path = _BOARDS_DIR / bt / args.config
|
||||||
if bt == board_type_input and not cfg_path.exists():
|
if bt == board_type_input and not cfg_path.exists():
|
||||||
print(f"开发板 {bt} 未定义 {args.config} 配置文件,跳过")
|
print(f"Board {bt} has no {args.config} config file, skipping")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
release(bt, config_filename=args.config, filter_name=name_filter if bt == board_type_input else None)
|
release(bt, config_filename=args.config, filter_name=name_filter if bt == board_type_input else None)
|
||||||
|
|||||||
Reference in New Issue
Block a user