Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
.PHONY: update-version increment-major increment-minor increment-patch test build clean install format

update-version:
@echo "$(VERSION)" > VERSION
@perl -i -pe 'if (!$$done && /<version>[.\-\d\w]+<\/version>/ && $$. < 20) { s|<version>[.\-\d\w]+</version>|<version>$(VERSION)</version>|; $$done = 1; }' pom.xml
@perl -pi -e 's|LIBRARY_VERSION = "[.\-\d\w]+"|LIBRARY_VERSION = "$(VERSION)"|' src/main/java/com/chargebee/Environment.java

increment-major:
$(eval CURRENT := $(shell cat VERSION))
$(eval MAJOR := $(shell echo $(CURRENT) | cut -d. -f1))
$(eval NEW_VERSION := $(shell echo $$(($(MAJOR) + 1)).0.0))
@$(MAKE) update-version VERSION=$(NEW_VERSION)
@echo "Version bumped from $(CURRENT) to $(NEW_VERSION)"

increment-minor:
$(eval CURRENT := $(shell cat VERSION))
$(eval MAJOR := $(shell echo $(CURRENT) | cut -d. -f1))
$(eval MINOR := $(shell echo $(CURRENT) | cut -d. -f2))
$(eval NEW_VERSION := $(MAJOR).$(shell echo $$(($(MINOR) + 1))).0)
@$(MAKE) update-version VERSION=$(NEW_VERSION)
@echo "Version bumped from $(CURRENT) to $(NEW_VERSION)"

increment-patch:
$(eval CURRENT := $(shell cat VERSION))
$(eval MAJOR := $(shell echo $(CURRENT) | cut -d. -f1))
$(eval MINOR := $(shell echo $(CURRENT) | cut -d. -f2))
$(eval PATCH := $(shell echo $(CURRENT) | cut -d. -f3))
$(eval NEW_VERSION := $(MAJOR).$(MINOR).$(shell echo $$(($(PATCH) + 1))))
@$(MAKE) update-version VERSION=$(NEW_VERSION)
@echo "Version bumped from $(CURRENT) to $(NEW_VERSION)"

test:
mvn test

build:
mvn clean package

clean:
mvn clean

format:
@echo "Formatter not configured."

install:
mvn clean install
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.42.0