aboutsummaryrefslogtreecommitdiff
path: root/lib/WinRpMalloc/Taskfile.yaml
blob: 356db70d19a1b51bd7153b65f3e4fa81f3b948b2 (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
# https://taskfile.dev

#Called by the vnbuild system to produce builds for my website
#https://www.vaughnnugent.com/resources/software

#This taskfile is called in this directory and is specific to the WinRpMalloc project
#that handles the MSBuild outside of the solution file

version: '3'

vars:
  RPMALLOC_LICENSE: 'https://raw.githubusercontent.com/mjansson/rpmalloc/develop/LICENSE'
  INT_DIR: '{{.SCRATCH_DIR}}/obj/{{.MODULE_NAME}}/'
  MS_ARGS: '/p:Platform=x64 /p:RunAnalyzersDuringBuild=false /p:IntermediateOutputPath="{{.INT_DIR}}" /p:UseCommonOutputDirectory=true /p:BuildInParallel=true /p:MultiProcessorCompilation=true'

tasks:
  
  build:
    #build from the src directory  
    dir: '{{.USER_WORKING_DIR}}'  
    cmds:
     #build in debug mode
     - msbuild /p:Configuration=debug {{.BUILD_FLAGS}} {{.MS_ARGS}} 
     #build in release
     - msbuild /p:Configuration=release {{.BUILD_FLAGS}} {{.MS_ARGS}} 

  postbuild_success:
    vars:
      TARGET: '{{.USER_WORKING_DIR}}/bin'

    cmds:
    #create the target directory
     - powershell -Command "New-Item -Type Directory -Force -Path '{{.TARGET}}'" 

     #remove uncessary files from outputs
     - powershell -Command "Get-ChildItem -Recurse './src/x64/*' -Include *.log,*.recipe,*.CopyComplete,*.json,*.FileListAbsolute.txt | Remove-Item"
     - powershell -Command "Get-ChildItem '*.tlog' -Recurse * | Remove-Item"

     #run debug and release post
     - task: postbuild
       vars: { BUILD_MODE: debug }

     - task: postbuild
       vars: { BUILD_MODE: release }

     #tar input and output
     - cd ./src/x64/debug && tar -czf "{{.TARGET}}/debug.tgz" .
   
    #capture only dll, license, + readme files on release
     - cd ./src/x64/release && tar  --include='*.dll' --include='license.txt' --include='readme.md' --include='rpmalloc_license.txt' -czf "{{.TARGET}}/release.tgz" *


  postbuild:
    vars:
     TARGET: './src/x64/{{.BUILD_MODE}}'

    cmds:
     #add rpmalloc license to binary output
     - powershell -Command "Invoke-WebRequest '{{.RPMALLOC_LICENSE}}' -Outfile '{{.TARGET}}/rpmalloc_license.txt'" 

     #add my license file
     - powershell -Command "Copy-Item -Path ./LICENSE.txt -Destination '{{.TARGET}}/license.txt'"

     #add readme file
     - powershell -Command "Copy-Item -Path ./build.readme.md -Destination '{{.TARGET}}/readme.md'"


  clean:
    cmds: 
     - cmd: powershell -Command "Remove-Item -Recurse './src/x64' -ErrorAction SilentlyContinue"
       ignore_error: true
     - cmd: powershell -Command "Remove-Item -Recurse './src/bin' -ErrorAction SilentlyContinue"
       ignore_error: true