-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
136 lines (103 loc) · 4 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
MFLAGS = -s
MAKEFLAGS = ${MFLAGS}
MODULE = bolt
VERSION = local
PROJECTS = \
base \
loader \
kernel \
bolt \
test \
inline \
karma \
boltc \
ide/sublime
TESTS = \
test/scenarios/*/run-test
PROJECTS_DIR = projects
GEN = gen
DIST = ${GEN}/dist
DIST_ARTIFACTS = \
projects/inline/gen/dist/* \
projects/boltc/gen/dist/boltc.js \
projects/test/gen/dist/test.js \
projects/karma/gen/dist/bolt-karma.js \
projects/bolt/gen/dist/bolt.js
TAR = ${DIST}/${MODULE}-${VERSION}.tar.gz
TAR_IMAGE = ${GEN}/image
SUBLIME_PACKAGE = projects/ide/sublime/gen/dist/Bolt.sublime-package
SUBLIME_DIST = ${DIST}/${MODULE}-${VERSION}.sublime-package
STATIC_ARTIFACTS = LICENSE LICENSE.ephox CONTRIBUTORS COPYING README.md
RELEASE_DIR = ${TAR_IMAGE}/${MODULE}-${VERSION}
RELEASE_NPM = ${RELEASE_DIR}/package.json
RELEASE_VERSION = ${RELEASE_DIR}/bin/version
CONFIG_NPM = config/npm/package.json
CONFIG_SUBLIME = config/sublime/packages.json
CONFIG_VERSION = config/release/version
CONFIG_BUILD = config/release/build
PUBLISH_REPO_URL = git@github.com:boltjs/dist.boltjs.io.git
PUBLISH_REPO = ${GEN}/dist.boltjs.io
PUBLISH_DIR = ${PUBLISH_REPO}/${VERSION}
PUBLISH_GIT = git --work-tree ${PUBLISH_REPO} --git-dir ${PUBLISH_REPO}/.git
PUBLISH_ARTIFACTS = ${TAR} ${SUBLIME_DIST} ${RELEASE_DIR}/lib/bolt.js ${RELEASE_DIR}/lib/bolt-karma.js ${RELEASE_DIR}/lib/test.js
RELEASE_SUBLIME = ${PUBLISH_REPO}/packages.json
DIRECTORIES = ${GEN} ${DIST} ${TAR_IMAGE} ${RELEASE_DIR} ${RELEASE_DIR}/bin ${RELEASE_DIR}/lib ${RELEASE_DIR}/command
.PHONY: clean dist artifacts publish npm-register verify release ${PROJECTS} ${RELEASE_DIR} ${PUBLISH_DIR} ${PUBLISH_REPO}
default: clean artifacts
clean:
rm -rf ./${GEN}
for x in ${PROJECTS}; do \
(cd projects/$$x; ${MAKE} ${MFLAGS} clean); \
done
for x in test/scenarios/*; do \
rm -rf ./$$x/gen; \
done
dist: ${TAR} ${SUBLIME_DIST}
artifacts: clean ${PROJECTS} ${RELEASE_NPM} ${RELEASE_VERSION} ${STATIC_ARTIFACTS} ${RELEASE_DIR}/bin ${RELEASE_DIR}/lib ${RELEASE_DIR}/command
cp ${STATIC_ARTIFACTS} ${RELEASE_DIR}/.
cp ${DIST_ARTIFACTS} ${RELEASE_DIR}/lib/.
cp ${PROJECTS_DIR}/script/bin/* ${RELEASE_DIR}/bin/.
cp ${PROJECTS_DIR}/script/command/* ${RELEASE_DIR}/command/.
cp ${PROJECTS_DIR}/script/lib/* ${RELEASE_DIR}/lib/.
verify: artifacts
for x in ${TESTS}; do \
(cd `dirname $$x`; export RELEASE_DIR="../../../${RELEASE_DIR}"; PATH="../../../${RELEASE_DIR}/bin:$$PATH" ./run-test) || exit 1; \
done
release: clean
expr `cat ${CONFIG_BUILD}` + 1 > ${CONFIG_BUILD}
git commit -m "[release] Bump build number [`cat ${CONFIG_VERSION}`-`cat ${CONFIG_BUILD}`]." ${CONFIG_BUILD}
git push origin master
${MAKE} ${MFLAGS} publish VERSION=`cat ${CONFIG_VERSION}`-`cat ${CONFIG_BUILD}`
publish: npm-register artifacts verify ${TAR} ${RELEASE_DIR} ${PUBLISH_REPO} ${PUBLISH_DIR} ${RELEASE_SUBLIME}
cp ${PUBLISH_ARTIFACTS} ${PUBLISH_DIR}
${PUBLISH_GIT} add .
${PUBLISH_GIT} commit -m "[release] ${VERSION}"
${PUBLISH_GIT} push origin master
${PUBLISH_GIT} push -f origin master:gh-pages
npm publish ${RELEASE_DIR}
npm-register:
if [ "`npm whoami`" != "boltjs" ]; then \
echo 'Register machine for release. Please use - User: "boltjs", Email: "dev@boltjs.io"' ; \
npm adduser ; \
fi
${PROJECTS}:
cd ${PROJECTS_DIR}/$@ && ${MAKE} ${MFLAGS} test
${RELEASE_NPM}: ${RELEASE_DIR}
sed 's/__VERSION__/${VERSION}/g' ${CONFIG_NPM} > $@
${RELEASE_VERSION}: ${RELEASE_DIR}/bin
echo ${VERSION} > $@
${RELEASE_SUBLIME}: ${PUBLISH_REPO}
DATE=`date -u "+%Y-%m-%d %H:%M:%S"` && \
CHANNEL_VERSION=`cat ${CONFIG_VERSION}``cat ${CONFIG_BUILD} | xargs printf "%03d\n"` && \
sed -e 's/__VERSION__/${VERSION}/g' -e "s/__DATE__/$$DATE/g" -e "s/__CHANNEL_VERSION__/$$CHANNEL_VERSION/g" ${CONFIG_SUBLIME} > $@
${TAR}: artifacts ${DIST}
tar cfz ${TAR} -C ${TAR_IMAGE} ${MODULE}-${VERSION}
${SUBLIME_DIST}: ${DIST}
cp ${SUBLIME_PACKAGE} $@
${DIRECTORIES}:
mkdir -p $@
${PUBLISH_REPO}:
[ ! -d ${PUBLISH_REPO} ] || rm -rf ${PUBLISH_REPO}
git clone ${PUBLISH_REPO_URL} ${PUBLISH_REPO}
${PUBLISH_DIR}: ${PUBLISH_REPO}
mkdir -p $@