Browse Source

fix: 更换去重算法,保证工程输出一致性

便于 git管理
蒙蒙plus 1 tuần trước cách đây
mục cha
commit
d9c74834b0
2 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 2 2
      tools/building.py
  2. 3 2
      tools/targets/iar.py

+ 2 - 2
tools/building.py

@@ -579,8 +579,8 @@ def DefineGroup(name, src, depend, **parameters):
     group['name'] = name
     group['name'] = name
     group['path'] = group_path
     group['path'] = group_path
     if type(src) == type([]):
     if type(src) == type([]):
-        # remove duplicate elements from list
-        src = list(set(src))
+        # remove duplicate elements from list while preserving order
+        src = list(dict.fromkeys(src))
         group['src'] = File(src)
         group['src'] = File(src)
     else:
     else:
         group['src'] = src
         group['src'] = src

+ 3 - 2
tools/targets/iar.py

@@ -131,10 +131,11 @@ def IARProject(env, target, script):
                     print('not found LIB: ' + item)
                     print('not found LIB: ' + item)
 
 
     # make relative path
     # make relative path
-    paths = set()
+    paths = {}
     for path in CPPPATH:
     for path in CPPPATH:
         inc = _make_path_relative(project_path, os.path.normpath(path))
         inc = _make_path_relative(project_path, os.path.normpath(path))
-        paths.add(inc) #.replace('\\', '/')
+        paths[inc] = None  # 使用 dict 去重并保持插入顺序
+    paths = list(paths.keys())
 
 
     # setting options
     # setting options
     options = tree.findall('configuration/settings/data/option')
     options = tree.findall('configuration/settings/data/option')