feat: after_build hook (#38518)

* feat: `after_build` hook

* feat: add option to skip running `after_build` hooks

* feat(boilerplate): add `after_build` hook

* revert: "feat: add option to skip running `after_build` hooks"

This reverts commit 6e9d2c6a2333d487fcf4d1908c366b496a8d80b1.
Removing the flag for now as other hooks (like after/before migrate) don't have a skip option either
This commit is contained in:
Rucha Mahabal 2026-04-13 12:15:38 +05:30 committed by GitHub
parent 620c44863c
commit cc74712304
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View file

@ -108,6 +108,19 @@ def build(
print("Compiling translations for", app)
compile_translations(app, force=force)
run_after_build_hook(apps)
def run_after_build_hook(apps):
from importlib import import_module
for app in apps:
for fn in frappe.get_hooks("after_build", app_name=app):
modulename = ".".join(fn.split(".")[:-1])
methodname = fn.split(".")[-1]
method = getattr(import_module(modulename), methodname)
method()
@click.command("watch")
@click.option("--apps", help="Watch assets for specific apps")

View file

@ -515,6 +515,12 @@ app_license = "{app_license}"
# before_app_uninstall = "{app_name}.utils.before_app_uninstall"
# after_app_uninstall = "{app_name}.utils.after_app_uninstall"
# Build
# ------------------
# To hook into the build process
# after_build = "{app_name}.build.after_build"
# Desk Notifications
# ------------------
# See frappe.core.notifications.get_notification_config