forked from getsentry/sentry-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (58 loc) · 2.34 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
# Temporary: Required for macOS release
# export GPG_TTY=`tty`
# eval $(gpg-agent --daemon)
# the test suite currently only works with 1.7.0_80
# https://github.com/getsentry/sentry-java/issues/478
.PHONY: checkstyle compile test install clean prepare prepareDocs prepareMvn prepareChanges perform verify
# TODO: Fix to work between macOS and Linux
MVN=mvn -e
ECHO=echo
SED=sed
all: checkstyle test install
compile:
$(MVN) compile
checkstyle:
$(MVN) checkstyle:check
verify:
$(MVN) verify
test: verify
install:
$(MVN) source:jar install -Dcheckstyle.skip=true -DskipTests
clean:
$(MVN) clean
prepareDocs:
# Store previously released version
$(eval PREVIOUS_RELEASE=$(shell grep -E "^Version" CHANGES | head -2 | tail -1 | $(SED) -e 's/Version //'))
@echo Previous release: $(PREVIOUS_RELEASE)
# Store release project version
$(eval RELEASE_VERSION=$(shell mvn help:evaluate -Dexpression=project.version | grep -Ev '^\[' | $(SED) -e 's/-SNAPSHOT//'))
@echo This release: $(RELEASE_VERSION)
# Fix released version in documentation
@echo Fixing documentation versions
$(eval PREVIOUS_ESCAPED=$(shell echo $(PREVIOUS_RELEASE) | $(SED) -e 's/\./\\\./g'))
find . \( -name '*.md' -or -name '*.rst' \) -exec $(SED) -i -e 's/$(PREVIOUS_ESCAPED)/$(RELEASE_VERSION)/g' {} \;
# Commit documentation changes
@echo Committing documentation version changes
git commit -a -m 'Bump docs to $(RELEASE_VERSION)'
prepareMvn:
# Prepare release (interactive)
$(MVN) release:prepare
prepareChanges:
# Store new project version
$(eval DEV_VERSION=$(shell mvn help:evaluate -Dexpression=project.version | grep -Ev '^\[' | $(SED) -e 's/-SNAPSHOT//'))
@echo Development version: $(DEV_VERSION)
# Store enough dashes to go under "Version X.Y.Z", accounting for changes in the $VERSION length
$(eval DASHES=$(shell python -c 'print("-" * (8 + len("$(DEV_VERSION)")))'))
# Add new Version section to the top of the CHANGES file
@echo Updating CHANGES file
$(ECHO) -e "Version $(DEV_VERSION)\n$(DASHES)\n\n-\n" > CHANGES.new && cat CHANGES >> CHANGES.new && mv CHANGES.new CHANGES
git add CHANGES
git commit -m "Bump CHANGES to $(DEV_VERSION)"
change-version:
$(MVN) release:update-versions
# Prepare is broken into stages because otherwise `make` will run things out of order
prepare: prepareDocs prepareMvn prepareChanges
perform:
$(MVN) release:perform
rollback:
$(MVN) release:rollback