-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
74 lines (68 loc) · 1.91 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Detect OS
ifeq ($(OS),Windows_NT)
detected_OS := Windows
else
detected_OS := $(shell uname)
endif
# App and build directories
app_name := $(notdir $(CURDIR))
source_build_directory := $(CURDIR)/build/artifacts/source
build_dir := $(CURDIR)/build/artifacts
sign_dir := $(source_build_directory)/sign
EXCLUDES := --exclude="/.git" \
--exclude="/build" \
--exclude="Makefile" \
--exclude="/*.log" \
--exclude="composer.json" \
--exclude="composer.lock" \
--exclude="/vendor" \
--exclude="/node_modules" \
--exclude="/package-lock.json" \
--exclude="/package.json" \
--exclude="*.config.js" \
--exclude="psalm.xml" \
--exclude="/.*" \
--exclude="/js/.*"
all: build
.PHONY: build
build:
ifeq ($(detected_OS),Windows)
composer install
npm install
npm run build
else
composer install
npm install
npm run build
endif
.PHONY: clean
clean:
ifeq ($(detected_OS),Windows)
if exist "./build" rd /s /q "./build"
if exist "./vendor" rd /s /q "./vendor"
else
rm -rf ./build
rm -rf ./vendor
endif
.PHONY: appstore
appstore:
ifeq ($(detected_OS),Windows)
if exist "$(source_build_directory)" rd /s /q "$(source_build_directory)"
mkdir "$(sign_dir)" -p
xcopy "$(CURDIR)\\*" "$(sign_dir)\\$(app_name)" /E /H /C /I /Q /Y
cd "$(sign_dir)" && tar -czf "$(build_dir)\\$(app_name).tar.gz" "$(app_name)"
else
rm -rf "$(source_build_directory)"
mkdir -p "$(sign_dir)"
rsync -a $(EXCLUDES) $(CURDIR)/ $(sign_dir)/$(app_name)
tar -czf $(build_dir)/$(app_name).tar.gz -C $(sign_dir) $(app_name)
endif
publish:
@if [ -z "$(version)" ]; then \
echo "Please provide a version number: make publish version=X.X.X"; \
exit 1; \
fi
@echo "Updating version to $(version)"
@sed -i 's/<version>[0-9]*\.[0-9]*\.[0-9]*<\/version>/<version>$(version)<\/version>/' appinfo/info.xml
@sed -i 's/"version": "[0-9]*\.[0-9]*\.[0-9]*"/"version": "$(version)"/' package.json
@echo "Version updated to $(version)"