Skip to content

Commit 908e0c2

Browse files
committed
add build info to Makefile
1 parent bba04d6 commit 908e0c2

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build-info.json
2+
build
3+
node_modules

Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ help:
1212

1313
all: build ## build all
1414

15-
build: clean ## clean, compile, copy files to build folder
15+
build: clean buildinfojson ## clean, compile, copy files to build folder
1616

1717
npm install --save node-fetch # install needed node-module
1818

@@ -22,6 +22,8 @@ build: clean ## clean, compile, copy files to build folder
2222
mkdir -p build/$(PLUGIN_NAME)/updater
2323
mkdir -p build/$(PLUGIN_NAME)/l10n
2424

25+
cp build-info.json build/$(PLUGIN_NAME)/build-info.json # build-info
26+
2527
mkdir -p src/tmp # build code from coffee
2628
cp easydb-library/src/commons.coffee src/tmp
2729
cp src/webfrontend/*.coffee src/tmp
@@ -53,4 +55,16 @@ clean: ## clean
5355
rm -rf build
5456

5557
zip: build ## build zip file
56-
cd build && zip ${ZIP_NAME} -r $(PLUGIN_NAME)/
58+
cd build && zip ${ZIP_NAME} -r $(PLUGIN_NAME)/
59+
60+
buildinfojson:
61+
repo=`git remote get-url origin | sed -e 's/\.git$$//' -e 's#.*[/\\]##'` ;\
62+
rev=`git show --no-patch --format=%H` ;\
63+
lastchanged=`git show --no-patch --format=%ad --date=format:%Y-%m-%dT%T%z` ;\
64+
builddate=`date +"%Y-%m-%dT%T%z"` ;\
65+
echo '{' > build-info.json ;\
66+
echo ' "repository": "'$$repo'",' >> build-info.json ;\
67+
echo ' "rev": "'$$rev'",' >> build-info.json ;\
68+
echo ' "lastchanged": "'$$lastchanged'",' >> build-info.json ;\
69+
echo ' "builddate": "'$$builddate'"' >> build-info.json ;\
70+
echo '}' >> build-info.json

0 commit comments

Comments
 (0)