aboutsummaryrefslogtreecommitdiff
path: root/cmnext-cli/Taskfile.yaml
blob: c184bf80244a4c06988fd603e7c343929252821a (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# https://taskfile.dev

version: '3'

vars:
  INT_DIR: '{{.SCRATCH_DIR}}/obj/{{.MODULE_NAME}}/'
  TARGET: '{{.USER_WORKING_DIR}}/bin'  
  RELEASE_DIR: "./bin/release/{{.TARGET_FRAMEWORK}}"

tasks:
  
  #when build succeeds, archive the output into a tgz 
  postbuild_success:
    dir: '{{.USER_WORKING_DIR}}'

    cmds:

     #run post in debug mode
     - task: postbuild
       vars: 
         BUILD_MODE: debug 
         TARGET_OS: linux-x64

     - task: postbuild
       vars: 
         BUILD_MODE: debug 
         TARGET_OS: win-x64
    
     - task: postbuild
       vars: 
         BUILD_MODE: debug 
         TARGET_OS: osx-x64

     - task: postbuild
       vars: 
         BUILD_MODE: debug 
         TARGET_OS: linux-arm

     - task: postbuild
       vars: 
         BUILD_MODE: debug 
         TARGET_OS: linux-arm64
   

     #remove uncessary files from the release dir
     - powershell -Command "Get-ChildItem -Recurse '{{.RELEASE_DIR}}/' -Include *.pdb,*.xml | Remove-Item"

     #run post in release mode
     - task: postbuild
       vars: 
         BUILD_MODE: release 
         TARGET_OS: linux-x64

     - task: postbuild
       vars: 
         BUILD_MODE: release 
         TARGET_OS: win-x64
    
     - task: postbuild
       vars: 
         BUILD_MODE: release 
         TARGET_OS: osx-x64
    
     - task: postbuild
       vars: 
         BUILD_MODE: release 
         TARGET_OS: linux-arm

     - task: postbuild
       vars: 
         BUILD_MODE: release 
         TARGET_OS: linux-arm64

     #pack up source code and put in output
     - powershell -Command "Get-ChildItem -Include *.cs,*.csproj -Recurse | Where { \$_.FullName -notlike '*\obj\*' } | Resolve-Path -Relative | tar --files-from - -czf '{{.TARGET}}/src.tgz'"


  postbuild_failed:
    dir: '{{.USER_WORKING_DIR}}'
    cmds:
     - echo "postbuild failed {{.PROJECT_NAME}}"


  postbuild:
    dir: '{{.USER_WORKING_DIR}}'
    vars:
      BUILD_DIR: "{{.USER_WORKING_DIR}}/bin/{{.BUILD_MODE}}/{{.TARGET_FRAMEWORK}}/{{.TARGET_OS}}/publish"
    internal: true
    cmds:     
     #copy license and readme to target
     - cd .. && powershell -Command "Copy-Item -Path ./build.readme.txt -Destination '{{.BUILD_DIR}}/readme.txt'"

     #tar outputs
     - cd "{{.BUILD_DIR}}" && tar -czf "{{.TARGET}}/{{.TARGET_OS}}-{{.BUILD_MODE}}.tgz" .


#Remove the output dirs on clean
  clean:
    dir: '{{.USER_WORKING_DIR}}'
    ignore_error: true
    cmds:
     - cmd: powershell Remove-Item -Recurse './bin'
     - cmd: powershell Remove-Item -Recurse './obj'