Skip to content

Commit 2fe29b0

Browse files
committed
fix(build): un-nest modern headers cleanly and ignore test fixtures in dev environment
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
1 parent f0ae7be commit 2fe29b0

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

‎extra_script.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,11 @@ def update_env():
132132
# Add required defines
133133
global_env.Append(CPPDEFINES=[("CLOCK_MONOTONIC", 1)])
134134

135-
import glob
136-
include_dirs = [main_path + "/libmicroros/include"] + [d for d in glob.glob(main_path + "/libmicroros/include/*") if os.path.isdir(d)]
137-
138135
# Add micro-ROS include path
139-
global_env.Append(CPPPATH=include_dirs)
136+
global_env.Append(CPPPATH=[main_path + "/libmicroros/include"])
140137

141138
# Add micro-ROS include path to library include path
142-
env.Append(CPPPATH=include_dirs)
139+
env.Append(CPPPATH=[main_path + "/libmicroros/include"])
143140

144141
# Add platformio library general include path
145142
global_env.Append(CPPPATH=[

‎microros_utils/library_builder.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ def download_dev_environment(self):
9393

9494
def build_dev_environment(self):
9595
print("Building micro-ROS dev dependencies")
96-
if self.distro in ("lyrical", "rolling"):
97-
self.patch_dev_sources()
96+
self.patch_dev_sources()
9897

9998
colcon_command = '. {} && colcon build --merge-install --packages-ignore-regex=.*_cpp --cmake-args -DPython3_EXECUTABLE=`which python` -DBUILD_TESTING=OFF'.format(self.python_env)
10099
command = "cd {} && {}".format(self.dev_folder, colcon_command)
@@ -242,6 +241,15 @@ def package_mcu_library(self):
242241
with open(timer_h, "w") as f_t:
243242
f_t.write(ct)
244243

244+
# Fix include paths for repeated nested folders
245+
include_folders = os.listdir(self.includes)
246+
for folder in include_folders:
247+
folder_path = self.includes + "/{}".format(folder)
248+
repeated_path = folder_path + "/{}".format(folder)
249+
if os.path.exists(repeated_path):
250+
shutil.copytree(repeated_path, folder_path, copy_function=shutil.move, dirs_exist_ok=True)
251+
shutil.rmtree(repeated_path)
252+
245253
def resolve_binutils_path(self):
246254
if sys.platform == "darwin":
247255
homebrew_binutils_path = "/opt/homebrew/opt/binutils/bin/"

0 commit comments

Comments
 (0)