-
Notifications
You must be signed in to change notification settings - Fork 341
/
Makefile
91 lines (70 loc) · 2.52 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
.PHONY: all test format check-format dependencies serve clean clean-all
.FORCE:
FRAMEWORK_FILES = $(shell find framework -type f | sed 's/ /\\ /g')
LAB_FILES = $(shell find labs -type f | sed 's/ /\\ /g')
HANDOUT_FILES = $(shell find handout-files -type f | sed 's/ /\\ /g')
JAR_FILES = build/libs/framework.jar \
build/libs/grader.jar \
build/libs/framework-sources.jar \
build/libs/grader-sources.jar \
build/libs/framework-deps.jar \
build/libs/grader-deps.jar \
build/libs/framework-deps-sources.jar
LICENSE_NOTICE = build/reports/licenses/THIRD-PARTY-NOTICES.txt
OTHER_FILES = build/doc/ lombok.config
ifeq ($(shell uname -s),Darwin)
CP = gcp
TAR = gtar
SED = gsed
else
CP = cp
TAR = tar
SED = sed
endif
all: build/handout/
dependencies:
./gradlew copyDependencies
deps/formatter/google-java-format.jar:
$(eval GVF_VERSION := $(shell $(SED) -n -E "s/^.*name:\s*'google-java-format',\s*version:\s*'([^']+)'.*$$/\1/p" build.gradle))
@echo "Downloading Google Java Format version $(GVF_VERSION)..."
# Check to make sure we extracted the version number from build.gradle
test -n "$(GVF_VERSION)"
mkdir -p deps/formatter/
wget "https://github.com/google/google-java-format/releases/download/v$(GVF_VERSION)/google-java-format-$(GVF_VERSION)-all-deps.jar" -O $@
build/libs/: $(FRAMEWORK_FILES)
./gradlew assemble
touch $@
build/doc/: $(FRAMEWORK_FILES)
./gradlew javadoc
touch $@
$(LICENSE_NOTICE): build.gradle
./gradlew generateLicenseReport
touch $@
build/handout/: $(LAB_FILES) $(HANDOUT_FILES) $(OTHER_FILES) build/libs/ deps/formatter/google-java-format.jar $(LICENSE_NOTICE)
rm -rf $@
mkdir $@ build/handout/jars
$(CP) -r labs handout-files/. $(OTHER_FILES) $@
$(CP) $(JAR_FILES) build/handout/jars
$(CP) deps/formatter/google-java-format.jar build/handout/jars
# Strip out the date from the license report for a reproducible build
$(SED) -Ez -e 's/This report was generated at .*//' $(LICENSE_NOTICE) > build/handout/jars/THIRD-PARTY-NOTICES.txt
build/handout.tar.gz: build/handout/
$(TAR) -czf $@ --transform "s/^build\/handout/dslabs/" $^
test:
./gradlew test
check-format:
./gradlew spotlessCheck
format:
./gradlew spotlessApply
www/javadoc/: build/doc/
rsync -a --delete $< $@
build/www/: www/javadoc/ .FORCE
mkdir -p $@
cd ./www; bundle exec jekyll build -d ../$@
touch $@
serve: www/javadoc/
cd www; watchy -w _config.yml -- bundle exec jekyll serve --watch -d ../build/www/
clean:
rm -rf build www/javadoc www/.jekyll-cache
clean-all: clean
rm -rf deps .gradle traces