-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
32 lines (23 loc) · 951 Bytes
/
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
SHELL = /bin/bash
SRC = src/
# Settings
CONFIG ?= Release
NUGET_DIR ?= nuget
TEST_PROPERTIES ?= /p:CollectCoverage=true
# DLL metadata
GIT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
GIT_HASH = $(shell git rev-parse HEAD)
GIT_DATE = $(shell git log -1 --format='%at')
VERSION = $(shell date --utc -d @"$(GIT_DATE)" +'%-y.%-m.%-d.%-H%M')
PACKAGE_PROPERTIES = /p:Version="$(VERSION)" /p:RepositoryBranch="$(GIT_BRANCH)" /p:RepositoryCommit="$(GIT_HASH)"
.PHONY: build test clean
all: clean test $(NUGET_DIR)
$(NUGET_DIR): build
mkdir -p $@
dotnet pack --configuration $(CONFIG) $(PACKAGE_PROPERTIES) --no-build --output $@ $(SRC)
build:
dotnet build --configuration $(CONFIG) $(PACKAGE_PROPERTIES) $(SRC)
test: build
dotnet test --configuration $(CONFIG) $(TEST_PROPERTIES) --no-build $(SRC)
clean:
rm -rf $(NUGET_DIR)