-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (45 loc) · 1.99 KB
/
Copy pathMakefile
File metadata and controls
56 lines (45 loc) · 1.99 KB
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
.PHONY: update-version increment-major increment-minor increment-patch test build clean restore pack format
VERSION_FILE := VERSION
CSPROJ_FILE := ChargeBee/ChargeBee.csproj
APICONFIG_FILE := ChargeBee/Api/ApiConfig.cs
update-version:
@echo "$(VERSION)" > $(VERSION_FILE)
@perl -i -pe 'BEGIN{$$found=0;} if (!$$found && /<Version>[.\-\d\w]+<\/Version>/) { s|<Version>[.\-\d\w]+</Version>|<Version>$(VERSION)</Version>|; $$found=1; }' $(CSPROJ_FILE)
@perl -pi -e 's|public static string Version = "[.\-\d\w]+"|public static string Version = "$(VERSION)"|' $(APICONFIG_FILE)
@echo "Updated version to $(VERSION)"
increment-major:
$(eval CURRENT := $(shell cat $(VERSION_FILE)))
$(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_FILE)))
$(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_FILE)))
$(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)"
restore:
dotnet restore
test:
dotnet test
build:
dotnet build --configuration Release
clean:
dotnet clean
rm -rf ChargeBee/bin ChargeBee/obj
rm -rf Chargebee.Tests/bin Chargebee.Tests/obj
rm -rf nupkg/*.nupkg
prepack:
dotnet pack ChargeBee/ChargeBee.csproj --configuration Release --output nupkg
format:
@echo "Formatter not configured."