aboutsummaryrefslogtreecommitdiff
path: root/Module.Taskfile.yaml
blob: 46db9c3e67c1f4eecc40b7f483dc91bdc1199443 (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
# https://taskfile.dev

version: '3'

vars:
  INT_DIR: '{{.SCRATCH_DIR}}/obj/{{.MODULE_NAME}}/'
  TARGET: '{{.OUTPUT_DIR}}/{{.HEAD_SHA}}'
  MS_ARGS: '--self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishTrimmed=true /p:RunAnalyzersDuringBuild=false /p:IntermediateOutputPath="{{.INT_DIR}}" /p:UseCommonOutputDirectory=true /p:BuildInParallel=true /p:MultiProcessorCompilation=true'

tasks:
#called by build pipeline to sync repo
  update:
    dir: '{{.USER_WORKING_DIR}}'
    cmds:
     #force remove any local changes and overwite
     - git reset --hard  
     - git remote update
     - git pull origin {{.BRANCH_NAME}} --verify-signatures 
    #re-write semver after hard reset
     - dotnet-gitversion.exe /updateprojectfiles

#called by build pipeline to build module
  build:
    dir: '{{.USER_WORKING_DIR}}'
    cmds:
     - echo "building module {{.MODULE_NAME}}"

     #build debug mode first
     - task: build_debug
     - task: build_release
  
  postbuild_success:
    cmds:
     #git archive in the module directory
     - git archive --format {{.ARCHIVE_FILE_FORMAT}} --output {{.ARCHIVE_FILE_NAME}} HEAD


#called by build pipeline to clean module
  clean:
    dir: '{{.USER_WORKING_DIR}}'
    cmds:
     - echo "Cleanining {{.MODULE_NAME}}"
     #clean solution
     - dotnet clean /p:BuildInParallel=true /p:MultiProcessorCompilation=true


#Internal tasks
  build_debug:
    dir: '{{.USER_WORKING_DIR}}'
    internal: true
    cmds:
     - for: [win-x64, linux-x64, osx-x64, linux-arm, linux-arm64 ]
       cmd: dotnet publish -c debug -r {{.ITEM}} {{.BUILD_FLAGS}} {{.MS_ARGS}}

  build_release:
    dir: '{{.USER_WORKING_DIR}}'
    internal: true
    cmds:
     - for: [win-x64, linux-x64, osx-x64, linux-arm, linux-arm64 ]
       cmd: dotnet publish -c release -r {{.ITEM}} {{.BUILD_FLAGS}} {{.MS_ARGS}}