# 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 vnlib_monocypher project #that handles the MSBuild outside of the solution file version: '3' vars: MS_ARGS: '/p:Platform=x64 /p:RunAnalyzersDuringBuild=false /p:BuildInParallel=true /p:MultiProcessorCompilation=true' PROJECT_NAME: '{{ .PROJECT_NAME | default "vnlib_monocypher" }}' MODULE_NAME: '{{ .MODULE_NAME | default "vnlib.core" }}' BUILD_DIR: 'build/{{ OS }}' BUILD_TYPE: '{{ .BUILD_TYPE | default "Release" }}' BINARY_DIR: '{{ .BINARY_DIR | default "bin" }}' ARTIFACT_OUT_DIR: '{{ .USER_WORKING_DIR }}/{{ .BINARY_DIR }}' 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: desc: 'DO NOT USE! This function is used internally during automated builds.' 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 platforms: [ windows ] #debug builds only work on Windows - cmake --build {{ .BUILD_DIR }}/ --config Release postbuild_success: desc: 'DO NOT USE! This function is used internally during automated builds.' cmds: #make bin dir - cmd: powershell mkdir -Force '{{ .ARTIFACT_OUT_DIR }}' ignore_error: true - task: pack_parallel pack_parallel: internal: true vars: REL_TAR_FILES: license.txt readme.txt '{{ .PROJECT_NAME }}_static.lib' '{{ .PROJECT_NAME }}.dll' DEBUG_TAR_FILES: license.txt readme.txt '{{ .PROJECT_NAME }}_static.lib' '{{ .PROJECT_NAME }}.dll' '{{ .PROJECT_NAME }}.pdb' deps: - task: pack_source - task: pack-artifacats vars: { BUILD_MODE: 'debug', TAR_FILES: '{{ .DEBUG_TAR_FILES }}' } - task: pack-artifacats vars: { BUILD_MODE: 'release', TAR_FILES: '{{ .REL_TAR_FILES }}' } pack-artifacats: internal: true cmds: - task: licenses vars: { TARGET: './{{ .BUILD_DIR }}/{{ .BUILD_MODE }}' } - cmd: cd {{ .BUILD_DIR }}/{{ .BUILD_MODE }} && tar -czf '{{ .ARTIFACT_OUT_DIR }}/msvc-x64-{{ .BUILD_MODE }}-{{ .PROJECT_NAME }}.tgz' {{ .TAR_FILES }} licenses: internal: true cmds: #add monocypher license to binary output (wrong on purpose see source code) - cmd: powershell cp 'vendor/LICENCE.md' '{{ .TARGET }}/license.md' #add my license file - cmd: powershell cp 'license' '{{ .TARGET }}/license.txt' #add readme file - cmd: powershell cp 'build.readme.txt' '{{ .TARGET }}/readme.txt' pack_source: internal: true cmds: #pack monocypher source code and create the archive - powershell "tar --exclude build/* --exclude bin/* --exclude .git/* -czf '{{ .ARTIFACT_OUT_DIR }}/src.tgz' ." dev-init: desc: 'Configures the project for local development' cmds: - task: build vars: { BUILD_TYPE: Debug } - cmd: echo "dev init complete" silent: true clean: desc: 'Cleans any build artifacts and output directories' ignore_error: true cmds: - for: [ bin/, build/ ] cmd: '{{ if eq OS "windows" }}powershell rm -Recurse -Force{{ else }}rm -rf{{ end }} "{{ .ITEM }}"'