aboutsummaryrefslogtreecommitdiff
path: root/lib/Utils.Cryptography/argon2/Taskfile.yaml
blob: 72f543dd70b5abe6e76dcf7e9fb836a217a4e84c (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# 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 phc-winner-argon2 project
#that handles the MSBuild outside of the solution file

version: '3'

vars:
  PROJECT_NAME: 'Argon2'
  MODULE_NAME: 'vnlib.core'
  BUILD_DIR: 'build/{{ OS }}'
  BUILD_TYPE: '{{ .BUILD_TYPE | default "Release" }}'

tasks:

  default:
    desc: "Builds the entire project from source code without using the VNBuild build system for target machines"
    cmds:
      #build with defaults
      - task: build
      - cmd: echo "Your {{ .PROJECT_NAME }} dll file can be found in '{{ .USER_WORKING_DIR }}/{{ .BUILD_DIR }}'"
        silent: true
  
  build:
    cmds:
     - cmd: echo Building {{ .PROJECT_NAME }} in {{ .BUILD_TYPE }} mode
       silent: true

     - cmake {{ .CLI_ARGS }}
       -B./{{ .BUILD_DIR }} 
       -DCMAKE_BUILD_TYPE={{ .BUILD_TYPE }}       

     #compile     
     - cmd: cmake --build {{ .BUILD_DIR }}/ --config Debug
     - cmd: cmake --build {{ .BUILD_DIR }}/ --config Release 

 
  postbuild_success:
    cmds:
      #make bin dir
    - cmd: powershell mkdir -Force 'bin/'
      ignore_error: true
    
    - task: parallel_postbuild
  
  parallel_postbuild:
    internal: true
    vars:
      #required files to include in tar
      BIN_FILES: 
        license.txt 
        readme.txt 
        argon2.h 
        '{{ .PROJECT_NAME }}.dll'

    deps:
     - task: pack_source
  
     - task: pack_artifacts
       vars: { BUILD_MODE: 'debug', TAR_FILES: '{{ .BIN_FILES }} {{ .PROJECT_NAME }}.pdb' }  
     - task: pack_artifacts
       vars: { BUILD_MODE: 'release', TAR_FILES: '{{ .BIN_FILES }}' }

  #packs up the binary artifacts for distribution
  pack_artifacts:
    internal: true
    deps:
      - task: embed
        vars: { TARGET: './{{ .BUILD_DIR }}/{{ .BUILD_MODE }}' }
    cmds:
      - cmd: cd {{ .BUILD_DIR }}/{{ .BUILD_MODE }} && tar -czf '../../bin/msvc-x64-{{ .BUILD_MODE }}-{{ .PROJECT_NAME }}.tgz' {{ .TAR_FILES }}

  #add embeded resources to the binary output for distribution
  embed:
    internal: true
    cmds:
     - powershell cp LICENSE '{{.TARGET}}/license.txt'
     - powershell cp build.readme.txt '{{.TARGET}}/readme.txt'
     - powershell cp include/argon2.h '{{.TARGET}}/argon2.h'
  
  #packages source code for distribution
  pack_source:
    internal: true
    vars:
      EXCLUDES:
        
      INCLUDES:
        src/*
        include/*
        CHANGELOG.md
        CMakeLists.txt
        README.md
        LICENSE
        Argon2.sln
        libargon2.pc.in
        Makefile
        Taskfile.yaml

    cmds:
     #just pack up current directory, excluding build, bin, and git directories
     - tar {{ .EXCLUDES }} -czf 'bin/src.tgz' {{ .INCLUDES }}

  dev-init:
    desc: 'Configures the project for local development'
    cmds:
     - task: build
       vars: { BUILD_TYPE: Debug }

     - cmd: echo "dev init complete"
       silent: true

  clean:
    ignore_error: true
    cmds:
     - for: [ bin/, build/ ]
       cmd: powershell rm -Recurse -Force '{{ .ITEM }}'