Skip to content

Commit dacb23b

Browse files
committed
Makefile addition
1 parent e7edef8 commit dacb23b

2 files changed

Lines changed: 90 additions & 0 deletions

File tree

Makefile

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
.PHONY: update-version increment-major increment-minor increment-patch test build clean install check
2+
3+
# Version file location
4+
VERSION_FILE := VERSION
5+
BUILD_GRADLE_FILE := build.gradle.kts
6+
7+
# Gradle commands
8+
GRADLE := ./gradlew
9+
10+
update-version:
11+
@echo "$(VERSION)" > $(VERSION_FILE)
12+
@perl -pi -e 's|version = "[.\-\d\w]+"|version = "$(VERSION)"|' $(BUILD_GRADLE_FILE)
13+
@echo "Updated version to $(VERSION)"
14+
15+
increment-major:
16+
$(eval CURRENT := $(shell cat $(VERSION_FILE)))
17+
$(eval MAJOR := $(shell echo $(CURRENT) | cut -d. -f1))
18+
$(eval NEW_VERSION := $(shell echo $$(($(MAJOR) + 1)).0.0))
19+
@$(MAKE) update-version VERSION=$(NEW_VERSION)
20+
@echo "Version bumped from $(CURRENT) to $(NEW_VERSION)"
21+
22+
increment-minor:
23+
$(eval CURRENT := $(shell cat $(VERSION_FILE)))
24+
$(eval MAJOR := $(shell echo $(CURRENT) | cut -d. -f1))
25+
$(eval MINOR := $(shell echo $(CURRENT) | cut -d. -f2))
26+
$(eval NEW_VERSION := $(MAJOR).$(shell echo $$(($(MINOR) + 1))).0)
27+
@$(MAKE) update-version VERSION=$(NEW_VERSION)
28+
@echo "Version bumped from $(CURRENT) to $(NEW_VERSION)"
29+
30+
increment-patch:
31+
$(eval CURRENT := $(shell cat $(VERSION_FILE)))
32+
$(eval MAJOR := $(shell echo $(CURRENT) | cut -d. -f1))
33+
$(eval MINOR := $(shell echo $(CURRENT) | cut -d. -f2))
34+
$(eval PATCH := $(shell echo $(CURRENT) | cut -d. -f3))
35+
$(eval NEW_VERSION := $(MAJOR).$(MINOR).$(shell echo $$(($(PATCH) + 1))))
36+
@$(MAKE) update-version VERSION=$(NEW_VERSION)
37+
@echo "Version bumped from $(CURRENT) to $(NEW_VERSION)"
38+
39+
install:
40+
@echo "Installing dependencies..."
41+
@$(GRADLE) dependencies
42+
43+
test:
44+
@echo "Running tests..."
45+
@$(GRADLE) test
46+
47+
test-coverage:
48+
@echo "Running tests with coverage..."
49+
@$(GRADLE) test jacocoTestReport
50+
@echo "Coverage report generated in build/reports/jacoco/test/html/index.html"
51+
52+
security-check:
53+
@echo "Running OWASP dependency check..."
54+
@$(GRADLE) dependencyCheckAnalyze
55+
56+
check: test
57+
@echo "All checks passed!"
58+
59+
build: clean
60+
@echo "Building project..."
61+
@$(GRADLE) build
62+
63+
clean:
64+
@echo "Cleaning build artifacts..."
65+
@$(GRADLE) clean
66+
@rm -rf build/
67+
@rm -rf dist/
68+
@rm -rf target/
69+
@find . -type f -name '.DS_Store' -delete
70+
71+
javadoc:
72+
@echo "Generating Javadoc..."
73+
@$(GRADLE) javadoc
74+
75+
jar:
76+
@echo "Building JAR..."
77+
@$(GRADLE) jar
78+
79+
assemble:
80+
@echo "Assembling artifacts..."
81+
@$(GRADLE) assemble
82+
83+
update:
84+
@echo "Updating dependencies..."
85+
@$(GRADLE) dependencies --refresh-dependencies
86+
87+
outdated:
88+
@echo "Checking for outdated dependencies..."
89+
@$(GRADLE) dependencyUpdates

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.0.1

0 commit comments

Comments
 (0)