From 5d214a6358da75b5cbb3527b7c6f50fc72b943cb Mon Sep 17 00:00:00 2001 From: cb-alish Date: Fri, 23 Jan 2026 14:29:53 +0530 Subject: [PATCH 1/2] Makefile addition --- Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ VERSION | 1 + 2 files changed, 43 insertions(+) create mode 100644 Makefile create mode 100644 VERSION diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..e085a363 --- /dev/null +++ b/Makefile @@ -0,0 +1,42 @@ +.PHONY: update-version increment-major increment-minor increment-patch test build clean install + +update-version: + @echo "$(VERSION)" > VERSION + @perl -i -pe 'if (!$$done && /[.\-\d\w]+<\/version>/ && $$. < 20) { s|[.\-\d\w]+|$(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 + +install: + mvn clean install \ No newline at end of file diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..476cebe0 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +3.42.0 From 01d44ec0200c659583aaae699cd94961a5399df8 Mon Sep 17 00:00:00 2001 From: cb-alish Date: Mon, 2 Feb 2026 16:12:27 +0530 Subject: [PATCH 2/2] Added format command with Makefile. --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e085a363..df5dfd65 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: update-version increment-major increment-minor increment-patch test build clean install +.PHONY: update-version increment-major increment-minor increment-patch test build clean install format update-version: @echo "$(VERSION)" > VERSION @@ -38,5 +38,8 @@ build: clean: mvn clean +format: + @echo "Formatter not configured." + install: mvn clean install \ No newline at end of file