Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ARCHITECTURE = x86_64

# Common build commands
COMPOSER_INSTALL = composer install --no-dev -o --no-interaction
COMPOSER_INSTALL_WITH_DEV = composer install -o --no-interaction --no-scripts && composer run-script post-install-cmd --no-interaction 2>/dev/null || true
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error suppression with 2>/dev/null || true hides all failures of the post-install-cmd script, making debugging difficult if the build silently fails. Consider allowing errors to propagate or at least logging them, especially since this is specifically for dev dependencies where build failures should be caught early.

Suggested change
COMPOSER_INSTALL_WITH_DEV = composer install -o --no-interaction --no-scripts && composer run-script post-install-cmd --no-interaction 2>/dev/null || true
COMPOSER_INSTALL_WITH_DEV = composer install -o --no-interaction --no-scripts && composer run-script post-install-cmd --no-interaction

Copilot uses AI. Check for mistakes.
NPM_INSTALL = npm ci --prefer-offline --no-audit
NPM_BUILD = npm run build

Expand Down Expand Up @@ -49,7 +50,10 @@ FULL_BUILD_APPS = \
twofactor_totp \
user_oidc \
viewer \
whiteboard \
whiteboard

# App directories that need full build WITH dev dependencies (composer with dev + npm + build)
FULL_BUILD_WITH_DEV_APPS = \
password_policy

# App directories that need only composer
Expand All @@ -65,6 +69,7 @@ REMOVE_UNWANTED_APPS = $(shell [ -f IONOS/removed-apps.txt ] && sed '/^#/d;/^$$/

# Generate build targets dynamically
FULL_BUILD_TARGETS = $(patsubst %,build_%_app,$(FULL_BUILD_APPS))
FULL_BUILD_WITH_DEV_TARGETS = $(patsubst %,build_%_app,$(FULL_BUILD_WITH_DEV_APPS))
COMPOSER_ONLY_TARGETS = $(patsubst %,build_%_app,$(COMPOSER_ONLY_APPS))
NOTHING_TO_BUILD_TARGETS = $(patsubst %,build_%_app,$(NOTHING_TO_BUILD_APPS))

Expand All @@ -73,7 +78,7 @@ NOTHING_TO_BUILD_TARGETS = $(patsubst %,build_%_app,$(NOTHING_TO_BUILD_APPS))
# Main Nextcloud build
.PHONY: build_ncw
# Applications - dynamically generated
.PHONY: build_all_external_apps build_notify_push_app build_notify_push_binary build_core_app_theming $(FULL_BUILD_TARGETS) $(COMPOSER_ONLY_TARGETS) $(NOTHING_TO_BUILD_TARGETS)
.PHONY: build_all_external_apps build_notify_push_app build_notify_push_binary build_core_app_theming $(FULL_BUILD_TARGETS) $(FULL_BUILD_WITH_DEV_TARGETS) $(COMPOSER_ONLY_TARGETS) $(NOTHING_TO_BUILD_TARGETS)
# Configuration and packaging
.PHONY: add_config_partials patch_shipped_json version.json zip_dependencies
# Pipeline targets for GitLab workflow
Expand All @@ -94,6 +99,8 @@ help: ## This help.
@echo "Individual app build targets:"
@echo " Full build apps (composer + npm + build):"
@for app in $(FULL_BUILD_APPS); do printf "\033[36m%-30s\033[0m Build $$app app (full build)\n" "build_$${app}_app"; done
@echo " Full build apps with dev dependencies (composer with dev + npm + build):"
@for app in $(FULL_BUILD_WITH_DEV_APPS); do printf "\033[36m%-30s\033[0m Build $$app app (full build with dev)\n" "build_$${app}_app"; done
@echo " Composer-only apps:"
@for app in $(COMPOSER_ONLY_APPS); do printf "\033[36m%-30s\033[0m Build $$app app (composer only)\n" "build_$${app}_app"; done
@echo " Nothing to build apps:"
Expand All @@ -119,6 +126,16 @@ define build_full_app
@echo "[✓] $(1) app built successfully"
endef

# Common function to build apps with full build + dev dependencies
define build_full_app_with_dev
@echo "[i] Building $(1) app (with dev dependencies)..."
@cd apps-external/$(1) && \
$(COMPOSER_INSTALL_WITH_DEV) && \
$(NPM_INSTALL) && \
$(NPM_BUILD)
@echo "[✓] $(1) app built successfully"
endef

# Common function to build apps with composer only
define build_composer_app
@echo "[i] Building $(1) app..."
Expand All @@ -143,6 +160,10 @@ build_ncw: build_core_app_theming ## Build Nextcloud Workspace
$(FULL_BUILD_TARGETS): build_%_app:
$(call build_full_app,$(patsubst build_%_app,%,$@))

# Dynamic rules for full build apps with dev dependencies
$(FULL_BUILD_WITH_DEV_TARGETS): build_%_app:
$(call build_full_app_with_dev,$(patsubst build_%_app,%,$@))

# Dynamic rules for composer-only apps
$(COMPOSER_ONLY_TARGETS): build_%_app:
$(call build_composer_app,$(patsubst build_%_app,%,$@))
Expand Down Expand Up @@ -247,7 +268,7 @@ zip_dependencies: patch_shipped_json version.json ## Zip relevant files
@echo "[i] Package $(TARGET_PACKAGE_NAME) created successfully"

# Parallel build targets
build_all_external_apps: $(FULL_BUILD_TARGETS) $(COMPOSER_ONLY_TARGETS) $(NOTHING_TO_BUILD_TARGETS) build_notify_push_app ## Build all external apps
build_all_external_apps: $(FULL_BUILD_TARGETS) $(FULL_BUILD_WITH_DEV_TARGETS) $(COMPOSER_ONLY_TARGETS) $(NOTHING_TO_BUILD_TARGETS) build_notify_push_app ## Build all external apps
@echo "[i] All external apps built successfully"

build_after_external_apps: build_ncw add_config_partials ## Build NCW and add configs after external apps are done
Expand Down