blob: dfb739ff38fe3259370ea0fbb4a1a4b5c2573fc5 (
plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#Builds c# libraries for produc
version: '3'
vars:
TARGET_FRAMEWORK: '{{ .TARGET_FRAMEWORK | default "net8.0" }}'
tasks:
#called by build pipeline to build module
build:
dir: '{{ .USER_WORKING_DIR }}'
vars:
PACK_OUT: '{{ .OUTPUT_DIR }}/{{ .HEAD_SHA }}/pkg'
MS_ARGS:
/p:RunAnalyzersDuringBuild=false
/p:UseCommonOutputDirectory=true
/p:BuildInParallel=true
/p:MultiProcessorCompilation=true
/p:ErrorOnDuplicatePublishOutputFiles=false
cmds:
- cmd: echo "building project {{ .PROJECT_NAME }}"
silent: true
#updates the project versions for all inlcuded .NET projects
- cmd: dotnet-gitversion.exe /updateprojectfiles
- cmd: dotnet publish -c debug {{ .MS_ARGS }}
- cmd: dotnet publish -c release {{ .MS_ARGS }}
#create nuget packages and write them directly to the output directory
- cmd: dotnet pack {{ .MS_ARGS }} -c debug -o "{{ .PACK_OUT }}/debug/"
- cmd: dotnet pack {{ .MS_ARGS }} -c release -o "{{ .PACK_OUT }}/release/"
postbuild_success:
deps:
- task: pack_source
- task: pack_artifacts
vars: { CONFIG: 'debug' }
- task: pack_artifacts
vars: { CONFIG: 'release' }
cmds:
- cmd: echo 'artifacts packaged'
silent: true
pack_artifacts:
dir: '{{ .USER_WORKING_DIR }}'
internal: true
vars:
SOURCE: 'bin/{{ .CONFIG }}/{{ .TARGET_FRAMEWORK }}/publish'
TARGET: '{{ .USER_WORKING_DIR }}/bin/{{ .CONFIG }}.tgz'
cmds:
- cmd: cd {{ .SOURCE }} && tar -czf '{{ lower .TARGET }}' .
pack_source:
dir: '{{ .USER_WORKING_DIR }}'
internal: true
vars:
TARGET: '{{ .USER_WORKING_DIR }}/bin'
INCLUDES:
src
tests
README.md
Taskfile.yaml
EXCLUDES:
--exclude='*obj/'
--exclude='*bin/'
cmds:
#copy source code to target
- cmd: cd .. && tar {{ .EXCLUDES }} -czf '{{ .TARGET }}/src.tgz' {{ .INCLUDES }}
#called by build pipeline to clean module
clean:
dir: '{{ .USER_WORKING_DIR }}'
cmds:
#clean solution
- dotnet clean /p:BuildInParallel=true /p:MultiProcessorCompilation=true
- for: [ obj/, bin/ ]
cmd: '{{ if eq OS "windows" }}powershell rm -Recurse -Force{{ else }}rm -rf{{ end }} "{{ .ITEM }}"'
|