refactor: remove redundant make file commands

This commit is contained in:
2026-02-24 19:55:28 +00:00
parent 5523310914
commit cb5c44a0b1
2 changed files with 34 additions and 56 deletions
+29 -49
View File
@@ -16,15 +16,11 @@ help:
@echo "KDE Plasma 6 Widget Developer Tools" @echo "KDE Plasma 6 Widget Developer Tools"
@echo "" @echo ""
@echo "Usage:" @echo "Usage:"
@echo " make test Run widget in plasmoidviewer (default)" @echo " make dev Run widget in plasmoidviewer from local package (MODE=panel|desktop|hidpi)"
@echo " make test-local Run widget directly from local package path"
@echo " make test-panel Run in horizontal panel mode"
@echo " make test-desktop Run as a floating desktop widget"
@echo " make test-hidpi Run with 2x DPI scaling"
@echo " make watch Start Development Mode with Hot Reload" @echo " make watch Start Development Mode with Hot Reload"
@echo " make cpp-build Build the C++ QML bridge module" @echo " make cpp-build Build the C++ QML bridge module"
@echo " make cpp-clean Remove C++ bridge build artifacts" @echo " make cpp-clean Remove C++ bridge build artifacts"
@echo " make install Install/upgrade widget (converts dev symlink)" @echo " make install Install/upgrade widget in local Plasma package store"
@echo " make uninstall Remove widget from local system" @echo " make uninstall Remove widget from local system"
@echo " make package Build .plasmoid file for distribution" @echo " make package Build .plasmoid file for distribution"
@echo " make clean Remove build artifacts" @echo " make clean Remove build artifacts"
@@ -57,30 +53,24 @@ cpp-clean:
rm -rf $(CPP_BUILD_DIR) $(CPP_MODULE_DIR) rm -rf $(CPP_BUILD_DIR) $(CPP_MODULE_DIR)
# Testing Targets # Testing Targets
# Run plasmoidviewer using the installed widget ID from metadata. # Run plasmoidviewer from the local package directory.
.PHONY: test # Optional MODE values: panel, desktop, hidpi (omit MODE for default).
test: cpp-build .PHONY: dev
plasmoidviewer -a $(WIDGET_ID) dev: cpp-build
@mode="$(MODE)"; \
# Run plasmoidviewer directly from the local package directory. case "$$mode" in \
.PHONY: test-local ""|default) \
test-local: cpp-build plasmoidviewer -a $(PACKAGE_DIR) ;; \
plasmoidviewer -a $(PACKAGE_DIR) panel) \
plasmoidviewer -a $(PACKAGE_DIR) -l topedge -f horizontal ;; \
# Run widget in panel simulation (top edge, horizontal form factor). desktop) \
.PHONY: test-panel plasmoidviewer -a $(PACKAGE_DIR) -l floating -f planar ;; \
test-panel: cpp-build hidpi) \
plasmoidviewer -a $(WIDGET_ID) -l topedge -f horizontal QT_SCALE_FACTOR=2 plasmoidviewer -a $(PACKAGE_DIR) ;; \
*) \
# Run widget in desktop simulation (floating, planar form factor). echo "Invalid MODE='$$mode'. Allowed: panel, desktop, hidpi (or omit MODE)."; \
.PHONY: test-desktop exit 1 ;; \
test-desktop: cpp-build esac
plasmoidviewer -a $(WIDGET_ID) -l floating -f planar
# Run widget with HiDPI scaling enabled (2x scale factor).
.PHONY: test-hidpi
test-hidpi: cpp-build
QT_SCALE_FACTOR=2 plasmoidviewer -a $(WIDGET_ID)
# Development Tools # Development Tools
# Start file watcher for iterative development and reload workflow. # Start file watcher for iterative development and reload workflow.
@@ -154,15 +144,10 @@ lint-prettier:
lint: lint-qml-format lint-qml lint-cpp lint-prettier lint: lint-qml-format lint-qml lint-cpp lint-prettier
# Installation # Installation
# Install/upgrade widget in local Plasma package store and replace any dev symlink. # Install/upgrade widget in local Plasma package store.
.PHONY: install .PHONY: install
install: cpp-build install: cpp-build
@install_path="$(HOME)/.local/share/plasma/plasmoids/$(WIDGET_ID)"; \ @if kpackagetool6 --type Plasma/Applet --show $(WIDGET_ID) >/dev/null 2>&1; then \
if [ -L "$$install_path" ]; then \
echo "Replacing development symlink with installed package: $$install_path"; \
rm -f "$$install_path"; \
fi; \
if kpackagetool6 --type Plasma/Applet --show $(WIDGET_ID) >/dev/null 2>&1; then \
echo "Upgrading existing package: $(WIDGET_ID)"; \ echo "Upgrading existing package: $(WIDGET_ID)"; \
kpackagetool6 --type Plasma/Applet --upgrade $(PACKAGE_DIR); \ kpackagetool6 --type Plasma/Applet --upgrade $(PACKAGE_DIR); \
else \ else \
@@ -170,25 +155,20 @@ install: cpp-build
kpackagetool6 --type Plasma/Applet --install $(PACKAGE_DIR); \ kpackagetool6 --type Plasma/Applet --install $(PACKAGE_DIR); \
fi fi
# Symlink local package into Plasma directory for live development updates.
.PHONY: dev-install
dev-install: cpp-build
@echo "Creating symlink for development..."
mkdir -p $(HOME)/.local/share/plasma/plasmoids/
ln -sfn $(abspath $(PACKAGE_DIR)) $(HOME)/.local/share/plasma/plasmoids/$(WIDGET_ID)
@echo "Linked $(WIDGET_ID) -> $(PACKAGE_DIR)"
@echo "You can now use 'make test' or the Reload button in plasmoidviewer!"
# Upgrade an already installed widget package with local changes. # Upgrade an already installed widget package with local changes.
.PHONY: upgrade .PHONY: upgrade
upgrade: cpp-build upgrade: cpp-build
kpackagetool6 --type Plasma/Applet --upgrade $(PACKAGE_DIR) kpackagetool6 --type Plasma/Applet --upgrade $(PACKAGE_DIR)
# Remove both dev symlink and installed widget package from local system. # Remove installed widget package from local system.
.PHONY: uninstall .PHONY: uninstall
uninstall: uninstall:
rm -f $(HOME)/.local/share/plasma/plasmoids/$(WIDGET_ID) @if kpackagetool6 --type Plasma/Applet --show $(WIDGET_ID) >/dev/null 2>&1; then \
kpackagetool6 --type Plasma/Applet --remove $(WIDGET_ID) echo "Removing package registration: $(WIDGET_ID)"; \
kpackagetool6 --type Plasma/Applet --remove $(WIDGET_ID); \
else \
echo "Package not registered: $(WIDGET_ID)"; \
fi
# Packaging # Packaging
# Create distributable .plasmoid archive from current package contents. # Create distributable .plasmoid archive from current package contents.
+5 -7
View File
@@ -27,18 +27,16 @@ sudo pacman -S plasma-sdk inotify-tools kirigami2 qt6-base qt6-declarative
2. Run `make hooks-install` once to enable Git hooks from `.githooks/`. 2. Run `make hooks-install` once to enable Git hooks from `.githooks/`.
3. If you use VS Code, run `make cpp-build` once to build the C++ bridge and generate IDE metadata for autocomplete. Then install the official QML extension and reload the VS Code window. 3. If you use VS Code, run `make cpp-build` once to build the C++ bridge and generate IDE metadata for autocomplete. Then install the official QML extension and reload the VS Code window.
4. Start hot reload while editing with `make watch`. 4. Start hot reload while editing with `make watch`.
5. Install a symlinked development version with `make dev-install`. 5. For a local install into Plasma's package store, use `make install`.
6. For a normal local install (non-symlinked), use `make install`. 6. Check style/lint status with `make lint`.
7. Check style/lint status with `make lint`. 7. Format everything with `make format`.
8. Format everything with `make format`. 8. Test with `make dev` (default mode) or `make dev MODE=panel|desktop|hidpi`.
9. Test in different modes with `make test`, `make test-panel`, `make test-desktop`, or `make test-hidpi`. 9. Package for distribution with `make package` (creates `build/<widget-id>.plasmoid`, default: `build/org.kde.plasma.starter.plasmoid`). This is just a zip file with a different extension, so you can inspect it with any archive manager.
10. Package for distribution with `make package` (creates `build/<widget-id>.plasmoid`, default: `build/org.kde.plasma.starter.plasmoid`). This is just a zip file with a different extension, so you can inspect it with any archive manager.
## Editor Setup Notes ## Editor Setup Notes
- **QML IntelliSense (VS Code):** Workspace settings pin `qmlls` to `/usr/lib/qt6/bin/qmlls` and pass `-I/usr/lib/qt6/qml`, `-b${workspaceFolder}/build/cpp`, and `-d/usr/share/doc/qt6`. - **QML IntelliSense (VS Code):** Workspace settings pin `qmlls` to `/usr/lib/qt6/bin/qmlls` and pass `-I/usr/lib/qt6/qml`, `-b${workspaceFolder}/build/cpp`, and `-d/usr/share/doc/qt6`.
- **Important:** Run `make cpp-build` at least once so the `build/cpp` metadata used by `qmlls` exists. - **Important:** Run `make cpp-build` at least once so the `build/cpp` metadata used by `qmlls` exists.
- **Install modes:** `make dev-install` creates a symlink for development, while `make install` converts that symlink into a normal installed package.
- **Generated C++ QML module:** `package/contents/ui/cppbridge/` is created by the C++ build, so editors may warn about `import "cppbridge"` before first build. - **Generated C++ QML module:** `package/contents/ui/cppbridge/` is created by the C++ build, so editors may warn about `import "cppbridge"` before first build.
- **Known qmllint false-positive:** `plasmoid.configuration.*` is runtime-injected by Plasma; `main.qml` has a targeted `qmllint` suppression for that property lookup. - **Known qmllint false-positive:** `plasmoid.configuration.*` is runtime-injected by Plasma; `main.qml` has a targeted `qmllint` suppression for that property lookup.
- **C++ editor config:** `clangd` uses `build/cpp/compile_commands.json` (set in `.vscode/settings.json`), with project defaults in `.clangd` and `.clang-format`. - **C++ editor config:** `clangd` uses `build/cpp/compile_commands.json` (set in `.vscode/settings.json`), with project defaults in `.clangd` and `.clang-format`.