-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmakefile
160 lines (135 loc) · 4.13 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
define helpdoc
# +----------------------------------------------------------------------------+
# | |
# | ----==| 1 C O N F I G |==---- |
# | |
# +----------------------------------------------------------------------------+
#
# It requires GNU make 3.82+
#
# Install with:
# brew install make
# echo "alias make=gmake" >> ~/.profile
#
# Run with:
# $ make <target> ... <target>
#
# Examples:
# $ make all
# $ make clean build test package
#
# Available targets:
#
# - clean: removes compilation outputs
# - build: compiles and run unit tests for each modules
# - test: runs integration tests for cli
# - package: creates the distribution packages
# - deploy: uploads the library into clojars
# - all: same as `make clean build test`
# - release: same as `clean update-version build test package`
#
endef
#
# Recipe prefix requires GNU make 3.82+
#
.RECIPEPREFIX := -
#
# AWS profile name to use to run the end-2-end integration tests
#
AWS_PROFILE=testaccount
#
# Help
#
.PHONY: help
export helpdoc
help:
- echo "$$helpdoc"
#
# Preparing all
#
all: clean build test package
#
# Preparing a release
#
release: clean update-version build test package
#
# Build
#
build: build-core build-cli build-ui
- @printf "#\n# Building 1config Completed!\n#\n"
#
# Build Core
#
core_src = $(shell find 1config-core/src 1config-core/resources 1config-shared/src -type f)
build-core: 1config-core/target/oneconfig*.jar
1config-core/target/oneconfig*.jar: $(core_src)
- @printf "#\n# Building 1config-core\n#\n"
- (cd 1config-core; lein do check, midje, install)
#
# Build CLI
#
cli_src = $(shell find 1config-cli/src 1config-cli/resources 1config-shared/src -type f)
build-cli: build-core 1config-cli/target/1cfg
1config-cli/target/1cfg: $(cli_src)
- @printf "#\n# Building 1config-cli\n#\n"
- (cd 1config-cli; lein do check, bin)
#
# Build UI
#
ui_src = $(shell find 1config-ui/src 1config-ui/resources 1config-shared/src -type f)
build-ui: build-core 1config-ui/target/1cfg-ui-beta
1config-ui/target/1cfg-ui-beta: $(ui_src)
- @printf "#\n# Building 1config-ui\n#\n"
- (cd 1config-ui; lein do check, bin)
#
# run the end-2-end integration test
#
test: build-core
- AWS_PROFILE=${AWS_PROFILE} ./test/bin/end-2-end-test.sh uberjar
#
# Package artifacts for homebrew and git release
#
PACKAGE := 1cfg
PKDIR := /tmp/$(PACKAGE)
.PHONY: package
package:
- rm -fr $(PKDIR)
- mkdir -p $(PKDIR)/hb/bin
- @printf "\n(-) preparing copying artifact\n"
- cp 1config-cli/target/1cfg $(PKDIR)/1cfg-Darwin
- cp 1config-cli/target/1cfg-Linux $(PKDIR)/1cfg-Linux
- cp 1config-cli/target/1cfgx $(PKDIR)
- cp 1config-ui/target/1cfg-ui-beta $(PKDIR)
- @printf "\n(-) preparing Homebrew package for Linux\n"
- cp 1config-cli/bin/1cfg $(PKDIR)/hb/bin
- cp 1config-cli/target/1cfg $(PKDIR)/hb/bin/1cfg.jar
- cp 1config-ui/bin/1cfg-ui-beta $(PKDIR)/hb/bin
- cp 1config-ui/target/1cfg-ui-beta $(PKDIR)/hb/bin/1cfg-ui-beta.jar
- tar -zcvf $(PKDIR)/$(PACKAGE)-homebrew.tar.gz -C /tmp/$(PACKAGE)/hb .
- rm -fr $(PKDIR)/hb
- @printf "\n(-) writing checksums\n"
- shasum -a 256 $(PKDIR)/* > $(PKDIR)/$(PACKAGE).sha
- @printf "\n(-) packages ready in /tmp/$(PACKAGE)\n"
- @printf "#------------------------------------------------------------------#\n"
- ls -halp $(PKDIR)
- @printf "#------------------------------------------------------------------#\n"
- cat $(PKDIR)/1cfg.sha
- @printf "#------------------------------------------------------------------#\n"
#
# Update version in doc
#
.PHONY: update-version
update-version:
- LAST=$$(curl -s https://api.github.com/repos/BrunoBonacci/1config/releases | jq -r '.[0].tag_name') ; \
CURR=$$(cat ver/1config.version) ; \
echo Updating $${LAST} to $${CURR} ; \
find . -name \*.md | grep -v CHANGELOG.md | xargs -I{} grep -l "$$LAST" {} | xargs -I{} sed -i '' s/$$LAST/$$CURR/g {}
#
# Clean target directories
#
.PHONY: clean
clean:
- @printf "#\n# Cleaning \n#\n"
- (cd 1config-core; rm -fr target)
- (cd 1config-cli; rm -fr target)
- (cd 1config-ui; rm -fr target)