This repository was archived by the owner on Sep 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
153 lines (118 loc) · 4.77 KB
/
Copy pathMakefile
File metadata and controls
153 lines (118 loc) · 4.77 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
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
.PHONY: \
build build-scala-2.10 build-scala-2.11 build-scala-2.12 \
test unit-test-all unit-test-scala-2.10 unit-test-scala-2.11 \
unit-test-scala-2.12 it-test-all it-test-scala-2.10 it-test-scala-2.11 \
it-test-scala-2.12 assembly assembly-scala-2.10 assembly-scala-2.11 \
assembly-scala-2.12 build-docker push-docker docs serve-docs push-docs \
stats stats-split
# =============================================================================
# = CONFIG SECTION
# =============================================================================
# Binaries
JAVA=$(shell which java 2> /dev/null)
SBT=$(shell which sbt 2> /dev/null)
CLOC=$(shell which cloc 2> /dev/null)
FIND=$(shell which find 2> /dev/null)
DOCKER=$(shell which docker 2> /dev/null)
# Scala config
SCALA_2.10_VERSION=2.10.6
SCALA_2.11_VERSION=2.11.8
SCALA_2.12_VERSION=2.12.1
SCALA_COMPILE=compile
SCALA_ASSEMBLY=assembly
SCALA_UNIT_TEST=test
SCALA_IT_TEST=it:test
SCALA_ASSEMBLY_PROJECTS=scalaDebuggerTool
# Cloc config
CLOC_IGNORE_FILE=.clocignore
# Docker config
DOCKER_IMAGE="chipsenkbeil/scala-debugger:latest"
# Call F_HEADER with text argument
DIVIDER=$(strip ================================================================================)
F_HEADER=\
$(info $(DIVIDER))\
$(info = $(1))\
$(info $(DIVIDER))
# =============================================================================
# = DEFAULT ENTRY
# =============================================================================
all: build
# =============================================================================
# = COMPILE SECTION
# =============================================================================
build: build-scala-2.10 build-scala-2.11 build-scala-2.12
build-scala-2.10:
@$(SBT) '+++ $(SCALA_2.10_VERSION) $(SCALA_COMPILE)'
build-scala-2.11:
@$(SBT) '+++ $(SCALA_2.11_VERSION) $(SCALA_COMPILE)'
build-scala-2.12:
@$(SBT) '+++ $(SCALA_2.12_VERSION) $(SCALA_COMPILE)'
# =============================================================================
# = TEST SECTION
# =============================================================================
test: unit-test-all it-test-all
unit-test-all: unit-test-scala-2.10 unit-test-scala-2.11 unit-test-scala-2.12
unit-test-scala-2.10:
@$(SBT) '+++$(SCALA_2.10_VERSION) $(SCALA_UNIT_TEST)'
unit-test-scala-2.11:
@$(SBT) '+++$(SCALA_2.11_VERSION) $(SCALA_UNIT_TEST)'
unit-test-scala-2.12:
@$(SBT) '+++$(SCALA_2.12_VERSION) $(SCALA_UNIT_TEST)'
it-test-all: it-test-scala-2.10 it-test-scala-2.11 it-test-scala-2.12
it-test-scala-2.10:
@$(SBT) '+++$(SCALA_2.10_VERSION) $(SCALA_IT_TEST)'
it-test-scala-2.11:
@$(SBT) '+++$(SCALA_2.11_VERSION) $(SCALA_IT_TEST)'
it-test-scala-2.12:
@$(SBT) '+++$(SCALA_2.12_VERSION) $(SCALA_IT_TEST)'
# =============================================================================
# = ASSEMBLY SECTION
# =============================================================================
assembly: assembly-scala-2.10 assembly-scala-2.11 assembly-scala-2.12
assembly-scala-2.10:
@$(foreach p,$(SCALA_ASSEMBLY_PROJECTS),$(SBT) '+++ $(SCALA_2.10_VERSION) $(p)/$(SCALA_ASSEMBLY)')
assembly-scala-2.11:
@$(foreach p,$(SCALA_ASSEMBLY_PROJECTS),$(SBT) '+++ $(SCALA_2.11_VERSION) $(p)/$(SCALA_ASSEMBLY)')
assembly-scala-2.12:
@$(foreach p,$(SCALA_ASSEMBLY_PROJECTS),$(SBT) '+++ $(SCALA_2.12_VERSION) $(p)/$(SCALA_ASSEMBLY)')
# =============================================================================
# = DOCKER SECTION
# =============================================================================
build-docker:
@$(DOCKER) build -t $(DOCKER_IMAGE) .
push-docker:
@$(DOCKER) login
@$(DOCKER) push $(DOCKER_IMAGE)
# =============================================================================
# = DOCS SECTION
# =============================================================================
docs:
@$(SBT) generateSite
serve-docs:
@$(SBT) serveSite
push-docs: docs
@$(SBT) publishSite
# =============================================================================
# = STATISTICS SECTION
# =============================================================================
stats:
@$(info All Code)
@$(CLOC) \
--exclude-dir=$(shell tr '\n' ',' < $(CLOC_IGNORE_FILE)) \
.
stats-split: stats-main stats-unit-test stats-it-test
stats-main:
@$(call F_HEADER,Main Code)
@$(CLOC) \
--exclude-dir=$(shell tr '\n' ',' < $(CLOC_IGNORE_FILE)) \
$(shell $(FIND) . -path "*/src/main" -type d -not -path "*/target/*")
stats-unit-test:
@$(call F_HEADER,Unit Test Code)
@$(CLOC) \
--exclude-dir=$(shell tr '\n' ',' < $(CLOC_IGNORE_FILE)) \
$(shell $(FIND) . -path "*/src/test" -type d -not -path "*/target/*")
stats-it-test:
@$(call F_HEADER,Integration Test Code)
@$(CLOC) \
--exclude-dir=$(shell tr '\n' ',' < $(CLOC_IGNORE_FILE)) \
$(shell $(FIND) . -path "*/src/it" -type d -not -path "*/target/*")