Makefile 4.54 KB
Newer Older
Marc Egger's avatar
Marc Egger committed
1
2
SHELL := /bin/bash

3
PKG_VERSION = $(shell awk '/version/ { print $$3 }' extension/ext_emconf.php  | sed "s/'//g")
4

5
NIGHTLY_DATE = $(shell date '+%Y%m%d')
6
RELEASE_DATE = $(shell date '+%Y%m%d%H%M')
7

8
9
GIT_REVISION_SHORT = $(shell git rev-parse --short HEAD || true)
GIT_REVISION_LONG = $(shell git rev-parse HEAD || true)
10

11
EXTENSION_CONTENT = Classes Configuration Resources ext_emconf.php ext_localconf.php ext_tables.php ext_icon.png ext_conf_template.txt config-example.qfq.php RELEASE.txt vendor
12

Rafael Ostertag's avatar
Rafael Ostertag committed
13
DISTDIR=dist
14

15
16
17
# Use by jenkins to separate temp directories used by pip in order to allow concurrent builds
PIP_TMP ?= /tmp

Marc Egger's avatar
Marc Egger committed
18
all: archive
19

Rafael Ostertag's avatar
Rafael Ostertag committed
20
maintainer-clean:
bbaer's avatar
bbaer committed
21
22
	rm -f .doc_plantuml .npmpackages .phpdocinstall .plantuml_install .support .support_plantuml
	rm -rf doc/jsdoc doc/phpdoc doc/plantuml support node_modules .python_virtualenv build-dist
Rafael Ostertag's avatar
Rafael Ostertag committed
23

24
archive: clean qfq.zip
Rafael Ostertag's avatar
Rafael Ostertag committed
25

26
qfq.zip:
27
	cd extension/vendor; rm -rf phpoffice/phpspreadsheet/{C*,bin,c*,d*,m*,p*,sa*,.g*,.p*,.s*,.t*} doctrine myclabs phar-io phpdocumentor phpspec phpunit sebastian theseer webmozart
28
	cd extension; zip -r ../$@ $(EXTENSION_CONTENT)
29
	
Rafael Ostertag's avatar
Rafael Ostertag committed
30
clean:
31
	cd doc/diagram ; $(MAKE) $@
Rafael Ostertag's avatar
Rafael Ostertag committed
32

Rafael Ostertag's avatar
Rafael Ostertag committed
33
git-revision: make-dist-dir
Rafael Ostertag's avatar
Rafael Ostertag committed
34
	echo $(GIT_REVISION_LONG) > $(DISTDIR)/revision.git
35

Rafael Ostertag's avatar
Rafael Ostertag committed
36
make-dist-dir:
Rafael Ostertag's avatar
Rafael Ostertag committed
37
38
39
40
41
42
	rm -rf $(DISTDIR)/
	mkdir $(DISTDIR)

dist-copy-extension:
	cd extension ; cp -R $(EXTENSION_CONTENT) ../$(DISTDIR)/

Marc Egger's avatar
Marc Egger committed
43
build-dist: make-dist-dir dist-copy-extension git-revision
Rafael Ostertag's avatar
Rafael Ostertag committed
44
45
	echo "Distribution made in $(DIST)"

bbaer's avatar
bbaer committed
46
nightly: basic build-dist
47
	cd $(DISTDIR); zip -r ../qfq_$(VERSION)_$(RELEASE_DATE).zip  $(EXTENSION_CONTENT) revision.git -x config.ini
Rafael Ostertag's avatar
Rafael Ostertag committed
48

bbaer's avatar
bbaer committed
49
snapshot: basic build-dist
50
	cd $(DISTDIR) ; zip -r ../qfq_$(VERSION)_$(RELEASE_DATE).zip $(EXTENSION_CONTENT) revision.git -x config.ini
51

bbaer's avatar
bbaer committed
52
release: basic build-dist
Rafael Ostertag's avatar
Rafael Ostertag committed
53
	if [ -z "$(VERSION)" ] ; then  echo "Set VERSION make variable to the release version (fmt: maj.min.micro)" ; exit 1 ; fi
54
	cd $(DISTDIR) ; zip -r "../qfq_$(VERSION)_$(RELEASE_DATE).zip" $(EXTENSION_CONTENT) revision.git -x config.ini
55

56
57
plantuml:
	cd doc/diagram ; $(MAKE)
58

59
bootstrap: .npmpackages .plantuml_install .virtual_env
60
	npm update
61
	grunt default
62

63
	# take care that phpOffice is located under 'qfq/Resources/Private/vendor/phpoffice'
64
65
	# cd extension/Resources/Private; composer update
	cd extension; composer update
66

67
basic: .npmpackages .virtual_env
bbaer's avatar
bbaer committed
68
	grunt default
69
70
	# IMPORTANT: install composer with no-dev flag for deployment!
	cd extension; composer install --no-dev --optimize-autoloader; cd vendor/phpoffice/phpspreadsheet; rm -rf .github bin docs samples .g* .s* .t* C* c* m* p*
71

72
.plantuml_install: .support_plantuml
73
	wget --no-check-certificate -O support/plantuml/plantuml.jar 'https://downloads.sourceforge.net/project/plantuml/plantuml.jar'
74
75
	touch $@

Marc Egger's avatar
Marc Egger committed
76
.npmpackages:
Marc Egger's avatar
Marc Egger committed
77
78
	echo "CURRENT USER '${USER}'"
	npm --version
Marc Egger's avatar
Marc Egger committed
79
	which npm
Marc Egger's avatar
Marc Egger committed
80
	node --version
Marc Egger's avatar
Marc Egger committed
81
	which node
Marc Egger's avatar
Marc Egger committed
82
	echo "${PATH}"
83
	npm ls -g grunt-cli 2>/dev/null || { echo "Please install grunt-cli npm package using 'npm install -g grunt-cli'" 1>&2 ; exit 1; }
Marc Egger's avatar
Marc Egger committed
84
85
86
87
88
89
90

	# update npm at persistent location and copy node_modules (to speed up process)
	mkdir -p /var/tmp/qfq/npm
	/bin/cp package.json /var/tmp/qfq/npm/
	cd /var/tmp/qfq/npm; npm update
	/bin/cp -r /var/tmp/qfq/npm/node_modules ./

91
92
	touch $@

Rafael Ostertag's avatar
Rafael Ostertag committed
93
94
95
.support:
	mkdir -p support
	touch $@
96

Rafael Ostertag's avatar
Rafael Ostertag committed
97
98
99
.support_plantuml: .support
	mkdir -p support/plantuml
	touch $@
100

101
.virtual_env: pip-temp-directory
102
	virtualenv .python_virtualenv
103
	. .python_virtualenv/bin/activate ; TMPDIR="$(PIP_TMP)" pip install --upgrade sphinx==1.5.5
104
105
	touch $@

106
107
108
pip-temp-directory:
	test -d "$(PIP_TMP)" || mkdir -p "$(PIP_TMP)"

109
#.PHONY: nightly maintainer-clean snapshot release git-revision build-dist make-dist-dir dist-copy-extension pip-temp-directory plantuml sonar
110

Carsten  Rose's avatar
Carsten Rose committed
111
copyReleaseNotes:
Marc Egger's avatar
Marc Egger committed
112
113
	cp Documentation/Release.rst extension/RELEASE.txt
	cp Documentation/Release.rst CHANGELOG.md
114

115
116
117
118
119
120
121
122
phpunit:
	# update composer with dev to install phpunit package
	cd extension; composer update

	# mock typo3 directory structure
	mkdir -p  typo3conf/ext/qfq
	mv -v extension/* typo3conf/ext/qfq/

123
    # create new kind of config (qfq.json)
124
	cp -v typo3conf/ext/qfq/Tests/phpunit_qfq.json ../conf/qfq.json; sed -i "s/#PHPUNIT_PASSWORD#/$(PHPUNIT_MYSQL_PASSWORD)/" ../conf/qfq.json
Marc Egger's avatar
Marc Egger committed
125
	cp -v typo3conf/ext/qfq/Tests/phpunit_LocalConfiguration.php typo3conf/LocalConfiguration.php
126

127
	# run phpunit
Marc Egger's avatar
Marc Egger committed
128
	cd typo3conf/ext/qfq/; pwd; vendor/bin/phpunit --configuration phpunit.xml
129
130
131
132

phpunit_snapshot: snapshot phpunit

phpunit_release: release phpunit
Marc Egger's avatar
Marc Egger committed
133
134

doc-local:
135
136
	cd Documentation && make docker-html
	xdg-open "Documentation/_build/html/index.html"
Carsten  Rose's avatar
Carsten Rose committed
137
138

doc-qfqio:
139
	rsync -av "Documentation/_build/html/" root@w16.math.uzh.ch:/var/www/html/qfq/doc/
140

141