platformio/platformio-core

Hook after Clean

Open

#4,456 opened on Nov 11, 2022

View on GitHub
 (8 comments) (0 reactions) (0 assignees)Python (791 forks)batch import
build systemhelp wanted

Repository metrics

Stars
 (7,329 stars)
PR merge metrics
 (Avg merge 109d 16h) (5 merged PRs in 30d)

Description

I use BUILD_DIR to compile boot2_stage boot loader of Raspberry Pi Pico but Clean clear only board folder...

I didn't find a solution for hook Clean (after) and I can offer you a small patch:

PlatformBase / base.py

    def on_clean(self, dir):            # <---
        pass

builder / tools / piotarget.py

    print("Done cleaning")
    return build_dir                    # <---

builder / main.py

if env.GetOption("clean") or is_clean_all:
    dir = env.PioClean(is_clean_all)    # <---
    env.PioPlatform().on_clean(dir)     # <---
    env.Exit(0)

platform.py

class MyPlatform(PlatformBase):
    def on_clean(self, dir):
        print('ON_CLEAN', dir) 
# RESULT: 
#   ON_CLEAN .....\.pio\build\test-board

Contributor guide