-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile
59 lines (43 loc) · 1.43 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
NAME = $(shell npm pkg get name | tr -d '"')
VERSION = $(shell npm pkg get version | tr -d '"')
PKGFILE = $(NAME).kwinscript
PKGDIR = pkg
.NOTPARALLEL: all
all: build install cleanall
build: res src
zip -r $(PKGFILE) $(PKGDIR)
$(PKGFILE): build
install: $(PKGFILE)
kpackagetool6 -t KWin/Script -s $(NAME) \
&& kpackagetool6 -t KWin/Script -u $(PKGFILE) \
|| kpackagetool6 -t KWin/Script -i $(PKGFILE)
clean: $(PKGDIR)
rm -r $(PKGDIR)
cleanpkg: $(PKGFILE)
rm $(PKGFILE)
cleanall: clean cleanpkg
start: stop
dbus-send --session --dest=org.kde.KWin /Scripting org.kde.kwin.Scripting.loadScript string:'' string:'$(NAME)'
stop:
dbus-send --session --dest=org.kde.KWin /Scripting org.kde.kwin.Scripting.unloadScript string:'$(NAME)'
lint:
npx eslint "src/**"
./scripts/sonarqube.sh
res: $(PKGDIR)
cp -f res/metadata.json $(PKGDIR)/
cp -f res/main.xml $(PKGDIR)/contents/config/
cp -f res/config.ui $(PKGDIR)/contents/ui/
cp -f res/main.js $(PKGDIR)/contents/code/
sed -i "s/%VERSION%/$(VERSION)/" $(PKGDIR)/metadata.json
sed -i "s/%NAME%/$(NAME)/" $(PKGDIR)/metadata.json
src: polonium.mjs $(PKGDIR)
mv -f polonium.mjs $(PKGDIR)/contents/code/main.mjs
cp -f src/qml/* $(PKGDIR)/contents/ui/
polonium.mjs:
npm install
npx esbuild --bundle src/index.ts --outfile=polonium.mjs --format=esm --platform=neutral
$(PKGDIR):
mkdir -p $(PKGDIR)
mkdir -p $(PKGDIR)/contents/code
mkdir $(PKGDIR)/contents/config
mkdir $(PKGDIR)/contents/ui