forked from cakephp/cakephp-api-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
114 lines (98 loc) · 3.35 KB
/
Makefile
File metadata and controls
114 lines (98 loc) · 3.35 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
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
SOURCE_DIR='../cakephp'
BUILD_DIR='./build/api'
.PHONY: clean
.PHONY: build-all
# Versions that can be built.
VERSIONS = 1.2 1.3 2.0 2.1 2.2 2.3 2.4 2.5 3.0
clean:
rm -rf $(BUILD_DIR)
# Make a macro to save re-typing recipies multiple times
define build3x
build-$(VERSION):
cd $(SOURCE_DIR) && git checkout $(TAG)
# Update the config file, Remove sed crap
sed -i.bak "s/activeVersion: '[0-9]\.[0-9]'/activeVersion: '$(VERSION)'/" templates/cakephp/config.neon
rm templates/cakephp/config.neon.bak
# Make the build output dir
[ ! -d $(BUILD_DIR) ] && mkdir $(BUILD_DIR) || true
# Run Apigen
php apigen.php --source $(SOURCE_DIR)/src \
--config ./apigen.neon \
--exclude $(SOURCE_DIR)/src/Console/Templates \
--destination $(BUILD_DIR)/$(VERSION) \
--template-config ./templates/cakephp/config.neon
# Fix rewrites file to have a opening php tag at the start
sed -i.bak '1i<?php' $(BUILD_DIR)/$(VERSION)/rewrite.php && rm $(BUILD_DIR)/$(VERSION)/rewrite.php.bak
endef
define build2x
build-$(VERSION):
cd $(SOURCE_DIR) && git checkout $(TAG)
# Update the config file, Remove sed crap
sed -i.bak "s/activeVersion: '[0-9]\.[0-9]'/activeVersion: '$(VERSION)'/" templates/cakephp/config.neon
rm templates/cakephp/config.neon.bak
# Make the build output dir
[ ! -d $(BUILD_DIR) ] && mkdir $(BUILD_DIR) || true
# Run Apigen
php apigen.php --source $(SOURCE_DIR)/lib \
--source $(SOURCE_DIR)/app \
--config ./apigen.neon \
--exclude $(SOURCE_DIR)/app/Config \
--exclude $(SOURCE_DIR)/lib/Cake/Console/Command/AppShell.php \
--exclude $(SOURCE_DIR)/lib/Cake/Test \
--exclude $(SOURCE_DIR)/lib/Cake/Console/Templates \
--destination $(BUILD_DIR)/$(VERSION) \
--template-config ./templates/cakephp/config.neon
# Fix rewrites file to have a opening php tag at the start
sed -i.bak '1i<?php' $(BUILD_DIR)/$(VERSION)/rewrite.php && rm $(BUILD_DIR)/$(VERSION)/rewrite.php.bak
endef
define build1x
build-$(VERSION):
cd $(SOURCE_DIR) && git checkout -f $(TAG)
# Update the config file, Remove sed crap
sed -i.bak "s/activeVersion: '[0-9]\.[0-9]'/activeVersion: '$(VERSION)'/" templates/cakephp/config.neon
rm templates/cakephp/config.neon.bak
# Make the build output dir
[ ! -d $(BUILD_DIR) ] && mkdir $(BUILD_DIR) || true
# Run Apigen
php apigen.php --source $(SOURCE_DIR)/cake/libs \
--source $(SOURCE_DIR)/cake/console/libs \
--config ./apigen.neon \
--exclude $(SOURCE_DIR)/cake/tests \
--exclude $(SOURCE_DIR)/cake/libs/overloadable_php4.php \
--exclude $(SOURCE_DIR)/cake/console/templates \
--destination $(BUILD_DIR)/$(VERSION) \
--template-config ./templates/cakephp/config.neon
# Fix rewrites file to have a opening php tag at the start
sed -i.bak '1i<?php' $(BUILD_DIR)/$(VERSION)/rewrite.php && rm $(BUILD_DIR)/$(VERSION)/rewrite.php.bak
endef
# Build all the versions in a loop.
build-all: $(foreach version, $(VERSIONS), build-$(version))
# Generate build targets for various 2.x versions.
TAG:=2.0.6
VERSION:=2.0
$(eval $(build2x))
TAG:=2.1.5
VERSION:=2.1
$(eval $(build2x))
TAG:=2.2.9
VERSION:=2.2
$(eval $(build2x))
TAG:=2.3.10
VERSION:=2.3
$(eval $(build2x))
TAG:=origin/master
VERSION:=2.4
$(eval $(build2x))
TAG:=origin/2.5
VERSION:=2.5
$(eval $(build2x))
TAG:=origin/3.0
VERSION:=3.0
$(eval $(build3x))
# Generate build targets for various 1.x versions
TAG:=origin/1.3
VERSION:=1.3
$(eval $(build1x))
TAG:=1.2.11
VERSION:=1.2
$(eval $(build1x))