Skip to content

Commit

Permalink
add command of clean_microros
Browse files Browse the repository at this point in the history
  • Loading branch information
sotarokashiuchi committed Jun 26, 2024
1 parent d08157b commit e1b512e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion extra_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ def clean_microros_callback(*args, **kwargs):
if "clean_microros" not in global_env.get("__PIO_TARGETS", {}):
global_env.AddCustomTarget("clean_microros", None, clean_microros_callback, title="Clean Micro-ROS", description="Clean Micro-ROS build environment")

def clean_libmicroros_callback(*args, **kwargs):
library_path = main_path + '/libmicroros'

# Delete libmicroros folder
shutil.rmtree(library_path, ignore_errors=True)

print("libmicroros cleaned")
os._exit(0)

if "clean_libmicroros" not in global_env.get("__PIO_TARGETS", {}):
global_env.AddCustomTarget("clean_libmicroros", None, clean_libmicroros_callback, title="Clean libmicroros", description="Clean libmicroros")


def build_microros(*args, **kwargs):
##############################
#### Install dependencies ####
Expand Down Expand Up @@ -154,7 +167,7 @@ def update_env():
from SCons.Script import COMMAND_LINE_TARGETS

# Do not build library on clean_microros target or when IDE fetches C/C++ project metadata
if set(["clean_microros", "_idedata", "idedata"]).isdisjoint(set(COMMAND_LINE_TARGETS)):
if set(["clean_microros", "clean_libmicroros", "_idedata", "idedata"]).isdisjoint(set(COMMAND_LINE_TARGETS)):
build_microros()

update_env()

0 comments on commit e1b512e

Please sign in to comment.