-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (64 loc) · 2.82 KB
/
Makefile
File metadata and controls
80 lines (64 loc) · 2.82 KB
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
75
76
77
78
79
80
PLUGIN_NAME = fylr-plugin-sequence
# config for Google CSV spreadsheet
L10N = l10n/fylr-plugin-sequence.csv
GKEY = 1xHXOhEdya6h2zX0Gw6Dm_J5UUWtsgLPCeeTkBui3IZ0
GID_LOCA = 0
GOOGLE_URL = https://docs.google.com/spreadsheets/u/1/d/$(GKEY)/export?format=csv&gid=
# config to build javascript
JS = src/webfrontend/fylr-plugin-sequence.js
COFFEE_FILES = src/webfrontend/SequencePluginBaseConfig.coffee \
src/webfrontend/SequencePluginPoolNode.coffee \
src/webfrontend/SequencePluginPool.coffee
BUILD_DIR = build
BUILD_INFO = build-info.json
ZIP_NAME ?= "${PLUGIN_NAME}.zip"
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
google-csv: ## get loca CSV from google
curl --silent -L -o - "$(GOOGLE_URL)$(GID_LOCA)" | tr -d "\r" > $(L10N)
all: build ## build all
build: clean code buildinfojson ## build all (creates build folder)
mkdir -p $(BUILD_DIR)/$(PLUGIN_NAME)
cp manifest.master.yml $(BUILD_DIR)/$(PLUGIN_NAME)/manifest.yml
cp -r src/server l10n $(BUILD_INFO) $(BUILD_DIR)/$(PLUGIN_NAME)
mkdir -p $(BUILD_DIR)/$(PLUGIN_NAME)/webfrontend
cp -r $(JS) $(BUILD_DIR)/$(PLUGIN_NAME)/webfrontend
code: $(JS) ## build Coffeescript code
clean: ## clean build files
rm -f src/server/*.pyc
rm -rf src/server/__pycache__/
rm -f src/server/fylr_lib_plugin_python3/*.pyc
rm -rf src/server/fylr_lib_plugin_python3/__pycache__/
rm -f src/webfrontend/*.coffee.js
rm -f $(JS)
rm -f $(BUILD_INFO)
rm -rf $(BUILD_DIR)
apitest-dep:
go install github.com/programmfabrik/apitest@latest
apitest: apitest-dep ## run apitest
# Use APITEST to configure the apitest binary to use for the apitests
# This defaults to "apitest" in your PATH
#
# Use APITEST_PARAMS to configure a different server connection
# export APITEST_PARAMS="--server http://root:admin@localhost:8080/api/v1"
echo "-d apitest" | xargs $(APITEST) $(APITEST_PARAMS)
zip: build ## build zip file for publishing
cd $(BUILD_DIR) && zip ${ZIP_NAME} -r $(PLUGIN_NAME) -x *.git*
${JS}: $(subst .coffee,.coffee.js,${COFFEE_FILES})
mkdir -p $(dir $@)
cat $^ > $@
%.coffee.js: %.coffee
coffee -b -p --compile "$^" > "$@" || ( rm -f "$@" ; false )
buildinfojson:
repo=`git remote get-url origin | sed -e 's/\.git$$//' -e 's#.*[/\\]##'` ;\
rev=`git show --no-patch --format=%H` ;\
lastchanged=`git show --no-patch --format=%ad --date=format:%Y-%m-%dT%T%z` ;\
builddate=`date +"%Y-%m-%dT%T%z"` ;\
release=$(if $(strip $(RELEASE_TAG)),'"$(RELEASE_TAG)"','null') ;\
echo '{' > $(BUILD_INFO) ;\
echo ' "repository": "'$$repo'",' >> $(BUILD_INFO) ;\
echo ' "rev": "'$$rev'",' >> $(BUILD_INFO) ;\
echo ' "release": '$$release',' >> $(BUILD_INFO) ;\
echo ' "lastchanged": "'$$lastchanged'",' >> $(BUILD_INFO) ;\
echo ' "builddate": "'$$builddate'"' >> $(BUILD_INFO) ;\
echo '}' >> $(BUILD_INFO)