aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.onedev-buildspec.yml62
-rw-r--r--Module.Taskfile.yaml53
-rw-r--r--lib/Hashing.Portable/tests/.runsettings1
-rw-r--r--lib/Hashing.Portable/tests/Argon2/VnArgon2Tests.cs9
-rw-r--r--lib/Net.Compression/VNLib.Net.CompressionTests/CompressorManagerTests.cs8
-rw-r--r--lib/Net.Compression/vnlib_compress/CMakeLists.txt8
-rw-r--r--lib/Net.Compression/vnlib_compress/Taskfile.yaml62
-rw-r--r--lib/Net.Compression/vnlib_compress/src/util.h2
-rw-r--r--lib/Utils.Cryptography/argon2/Taskfile.yaml35
-rw-r--r--lib/Utils.Cryptography/monocypher/CMakeLists.txt2
-rw-r--r--lib/Utils.Cryptography/monocypher/Taskfile.yaml47
-rw-r--r--lib/Utils.Memory/vnlib_mimalloc/Taskfile.yaml41
-rw-r--r--lib/Utils.Memory/vnlib_rpmalloc/Taskfile.yaml41
-rw-r--r--lib/Utils/tests/.runsettings4
14 files changed, 267 insertions, 108 deletions
diff --git a/.onedev-buildspec.yml b/.onedev-buildspec.yml
index bfccb25..24035dc 100644
--- a/.onedev-buildspec.yml
+++ b/.onedev-buildspec.yml
@@ -1,9 +1,9 @@
-version: 33
+version: 35
jobs:
- name: Repo Sync Push
steps:
- !PushRepository
- name: Github sync push
+ name: Github push sync
remoteUrl: https://github.com/VnUgE/VNLib.Core.git
userName: VnUgE
passwordSecret: git-access-token
@@ -25,3 +25,61 @@ jobs:
maxRetries: 3
retryDelay: 30
timeout: 3600
+- name: Staging Tests
+ steps:
+ - !CheckoutStep
+ name: banch checkout
+ cloneCredential: !DefaultCredential {}
+ withLfs: false
+ withSubmodules: false
+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
+ - !CommandStep
+ name: Initalize dependencies
+ runInContainer: false
+ interpreter: !DefaultInterpreter
+ commands: |
+ task -t .\Module.Taskfile.yaml dev-init
+ useTTY: true
+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
+ - !CommandStep
+ name: Run unit tests
+ runInContainer: false
+ interpreter: !DefaultInterpreter
+ commands: |
+ task -t .\Module.Taskfile.yaml test
+ useTTY: true
+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
+ triggers:
+ - !BranchUpdateTrigger
+ branches: '** -master'
+ retryCondition: never
+ maxRetries: 3
+ retryDelay: 30
+ timeout: 3600
+- name: Test build
+ steps:
+ - !CheckoutStep
+ name: clone
+ cloneCredential: !DefaultCredential {}
+ withLfs: false
+ withSubmodules: false
+ checkoutPath: '@project_name@/'
+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
+ - !CommandStep
+ name: VNBuild Build
+ runInContainer: false
+ interpreter: !DefaultInterpreter
+ commands: |
+ vnbuild build -S
+ useTTY: true
+ condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
+ triggers:
+ - !BranchUpdateTrigger
+ branches: develop
+ jobDependencies:
+ - jobName: Staging Tests
+ requireSuccessful: true
+ retryCondition: never
+ maxRetries: 3
+ retryDelay: 30
+ timeout: 3600
diff --git a/Module.Taskfile.yaml b/Module.Taskfile.yaml
index 99ea9b2..85bd7ef 100644
--- a/Module.Taskfile.yaml
+++ b/Module.Taskfile.yaml
@@ -14,6 +14,15 @@ vars:
MS_ARGS: '/p:RunAnalyzersDuringBuild=false /p:UseCommonOutputDirectory=true /p:BuildInParallel=true /p:MultiProcessorCompilation=true /p:ErrorOnDuplicatePublishOutputFiles=false'
PACK_OUT: '{{ .OUTPUT_DIR }}/{{ .HEAD_SHA }}/pkg'
+ # the directories where native projects exist and need to be built
+ # (compress must come after rpmalloc because it's a dep)
+ NATIVE_LIB_DIRS: '
+ lib/Utils.Memory/vnlib_rpmalloc
+ lib/Utils.Memory/vnlib_mimalloc
+ lib/Utils.Cryptography/monocypher
+ lib/Utils.Cryptography/argon2
+ lib/Net.Compression/vnlib_compress'
+
tasks:
default:
@@ -59,22 +68,32 @@ tasks:
test:
desc: "Runs managed tests against the entire solution and all loaded test projects"
vars:
- RPMALLOC_LIB_PATH: '{{ .USER_WORKING_DIR }}/lib/Utils.Memory/vnlib_rpmalloc/build/Debug/vnlib_rpmalloc'
- MIMALLOC_LIB_PATH: '{{ .USER_WORKING_DIR }}/lib/Utils.Memory/vnlib_mimalloc/build/Debug/vnlib_mimalloc'
+ NATIVE_BUILD_PATH: 'build/{{ OS }}/{{ if eq OS "windows"}}Debug/{{end}}'
+ LIB_PREFIX: '{{ if eq OS "windows"}}vnlib{{else}}libvn{{end}}'
+ #these are native library paths produced when the child modules are built
+ RPMALLOC_LIB_PATH: '{{ .USER_WORKING_DIR }}/lib/Utils.Memory/vnlib_rpmalloc/{{ .NATIVE_BUILD_PATH }}{{ .LIB_PREFIX }}_rpmalloc'
+ MIMALLOC_LIB_PATH: '{{ .USER_WORKING_DIR }}/lib/Utils.Memory/vnlib_mimalloc/{{ .NATIVE_BUILD_PATH}}{{ .LIB_PREFIX }}_mimalloc'
+ VNCOMPRESS_LIB_PATH: '{{ .USER_WORKING_DIR }}/lib/Net.Compression/vnlib_compress/{{ .NATIVE_BUILD_PATH }}{{ .LIB_PREFIX }}_compress'
+ MONOCYPHER_LIB_PATH: '{{ .USER_WORKING_DIR }}/lib/Utils.Cryptography/monocypher/{{ .NATIVE_BUILD_PATH }}{{ .LIB_PREFIX }}_monocypher'
+ ARGON2_LIB_PATH: '{{ .USER_WORKING_DIR }}/lib/Utils.Cryptography/argon2/{{ .NATIVE_BUILD_PATH }}argon2'
cmds:
- cmd: echo "Ensure you have run 'task dev-init' before running tests to build native libraries"
silent: true
- cmd: dotnet test
{{ .CLI_ARGS }}
+ --configuration debug
--verbosity normal
- --framework {{ .FRAMEWORK | default "net8.0" }}
+ --framework {{ .FRAMEWORK | default "net8.0" }}
--environment VNLIB_SHARED_HEAP_DIAGNOSTICS="1"
--environment TEST_RPMALLOC_LIB_PATH="{{ .RPMALLOC_LIB_PATH }}"
--environment TEST_MIMALLOC_LIB_PATH="{{ .MIMALLOC_LIB_PATH }}"
-
+ --environment TEST_COMPRESS_LIB_PATH="{{ .VNCOMPRESS_LIB_PATH }}"
+ --environment VNLIB_MONOCYPHER_DLL_PATH="{{ .MONOCYPHER_LIB_PATH }}"
+ --environment VNLIB_ARGON2_DLL_PATH="{{ .ARGON2_LIB_PATH }}"
#called by build pipeline to clean module
clean:
+ desc: "Used by vnbuild to clean the entire module"
ignore_error: true
cmds:
#clean solution
@@ -84,15 +103,25 @@ tasks:
dev-init:
desc: 'Configures the module for local development'
cmds:
- #build native libs for development
- - cd lib/Utils.Memory/vnlib_rpmalloc && task dev-init
- - cd lib/Utils.Memory/vnlib_mimalloc && task dev-init
- - cd lib/Utils.Cryptography/monocypher && task build
- - cd lib/Utils.Cryptography/argon2 && task build
- - cd lib/Net.Compression/vnlib_compress && task build
- - cmd: echo "dev init complete"
+ #build native libs for development
+ - for: { var: NATIVE_LIB_DIRS }
+ cmd: cd '{{ .ITEM }}' && task dev-init
+
+ - cmd: dotnet restore
+
+ - cmd: echo "Module developer initialization complete"
silent: true
-
+
+ run-dev-init:
+ internal: true
+ cmds:
+ - cmd: cd '{{ .ITEM }}' && task dev-init
+
+ clean-native:
+ desc: 'Cleans the native libraries for the module'
+ cmds:
+ - for: { var: NATIVE_LIB_DIRS }
+ cmd: cd {{ .ITEM }} && task clean
#Internal tasks
build_debug:
diff --git a/lib/Hashing.Portable/tests/.runsettings b/lib/Hashing.Portable/tests/.runsettings
index 0b2d635..b995827 100644
--- a/lib/Hashing.Portable/tests/.runsettings
+++ b/lib/Hashing.Portable/tests/.runsettings
@@ -2,7 +2,6 @@
<RunSettings>
<RunConfiguration>
<EnvironmentVariables>
- <VNLIB_MONOCYPHER_DLL_PATH>../../../../../Utils.Cryptography/monocypher/build/Debug/vnlib_monocypher.dll</VNLIB_MONOCYPHER_DLL_PATH>
</EnvironmentVariables>
</RunConfiguration>
</RunSettings> \ No newline at end of file
diff --git a/lib/Hashing.Portable/tests/Argon2/VnArgon2Tests.cs b/lib/Hashing.Portable/tests/Argon2/VnArgon2Tests.cs
index dcf6900..03c26fc 100644
--- a/lib/Hashing.Portable/tests/Argon2/VnArgon2Tests.cs
+++ b/lib/Hashing.Portable/tests/Argon2/VnArgon2Tests.cs
@@ -5,14 +5,7 @@ namespace VNLib.Hashing.Tests
[TestClass()]
public class VnArgon2Tests
{
- private static string LocalArgon2Lib = "../../../../../Utils.Cryptography/argon2/build/Debug/Argon2";
-
- [TestInitialize]
- public void InitDefaultLibPath()
- {
- Environment.SetEnvironmentVariable(VnArgon2.ARGON2_LIB_ENVIRONMENT_VAR_NAME, LocalArgon2Lib);
- }
-
+
[TestMethod]
public void LoadLibraryTest()
{
diff --git a/lib/Net.Compression/VNLib.Net.CompressionTests/CompressorManagerTests.cs b/lib/Net.Compression/VNLib.Net.CompressionTests/CompressorManagerTests.cs
index 236d39c..5e6b27f 100644
--- a/lib/Net.Compression/VNLib.Net.CompressionTests/CompressorManagerTests.cs
+++ b/lib/Net.Compression/VNLib.Net.CompressionTests/CompressorManagerTests.cs
@@ -20,13 +20,13 @@ namespace VNLib.Net.Compression.Tests
[TestClass()]
public class CompressorManagerTests
{
- const string LIB_PATH = @"../../../../vnlib_compress/build/Debug/vnlib_compress.dll";
+ private static string? NativeCompressPath => Environment.GetEnvironmentVariable("TEST_COMPRESS_LIB_PATH");
[TestMethod]
public void NativeLibApiTest()
{
//Load library
- using NativeCompressionLib lib = NativeCompressionLib.LoadLibrary(LIB_PATH, DllImportSearchPath.SafeDirectories);
+ using NativeCompressionLib lib = NativeCompressionLib.LoadLibrary(NativeCompressPath, DllImportSearchPath.SafeDirectories);
LibTestComp cp = new(lib, CompressionLevel.Fastest);
@@ -71,7 +71,7 @@ namespace VNLib.Net.Compression.Tests
PrintSystemInformation();
//Load native library
- using NativeCompressionLib lib = NativeCompressionLib.LoadLibrary(LIB_PATH, DllImportSearchPath.SafeDirectories);
+ using NativeCompressionLib lib = NativeCompressionLib.LoadLibrary(NativeCompressPath, DllImportSearchPath.SafeDirectories);
//Huge array of random data to compress
byte[] testData = RandomNumberGenerator.GetBytes(10 * 1024 * 1024);
@@ -188,7 +188,7 @@ namespace VNLib.Net.Compression.Tests
writer.WriteStartObject("vnlib.net.compression");
writer.WriteNumber("level", 1);
- writer.WriteString("lib_path", LIB_PATH);
+ writer.WriteString("lib_path", NativeCompressPath);
writer.WriteEndObject();
writer.WriteEndObject();
diff --git a/lib/Net.Compression/vnlib_compress/CMakeLists.txt b/lib/Net.Compression/vnlib_compress/CMakeLists.txt
index da27882..d20593c 100644
--- a/lib/Net.Compression/vnlib_compress/CMakeLists.txt
+++ b/lib/Net.Compression/vnlib_compress/CMakeLists.txt
@@ -198,8 +198,14 @@ if(NATIVE_HEAP_NAME)
${NATIVE_HEAP_NAME}
HINTS
+ ${NATIVE_HEAP_BIN}
+ ${NATIVE_HEAP_BIN}/${CMAKE_BUILD_TYPE}
+ ${NATIVE_HEAP_BIN}/build
+ ${NATIVE_HEAP_BIN}/build/${CMAKE_BUILD_TYPE}
+
${NATIVE_HEAP_SRC}
- ${NATIVE_HEAP_SRC}/build
+ ${NATIVE_HEAP_SRC}/${CMAKE_BUILD_TYPE}
+ ${NATIVE_HEAP_SRC}/build
${NATIVE_HEAP_SRC}/build/${CMAKE_BUILD_TYPE}
NO_CACHE
diff --git a/lib/Net.Compression/vnlib_compress/Taskfile.yaml b/lib/Net.Compression/vnlib_compress/Taskfile.yaml
index fec32d5..45fe865 100644
--- a/lib/Net.Compression/vnlib_compress/Taskfile.yaml
+++ b/lib/Net.Compression/vnlib_compress/Taskfile.yaml
@@ -12,6 +12,7 @@ vars:
PROJECT_NAME: 'vnlib_compress'
RPMALLOC_SRC_DIR: '../../Utils.Memory/vnlib_rpmalloc'
BUILD_TYPE: '{{ .BUILD_TYPE | default "Release" }}'
+ BUILD_DIR: 'build/{{ OS }}'
tasks:
@@ -21,35 +22,45 @@ tasks:
- cmd: echo "Building {{ .PROJECT_NAME }}"
silent: true
- - cmake -Bbuild/ {{ .CLI_ARGS }}
- '-DCMAKE_BUILD_TYPE={{ .BUILD_TYPE }}'
+ - cmd: cmake {{ .CLI_ARGS }}
+ -B{{ .BUILD_DIR }}/
+ -DCMAKE_BUILD_TYPE={{ .BUILD_TYPE }}
- - cmake --build build/ --config Release
+ - cmake --build {{ .BUILD_DIR }}/ --config Release
#called by ci pipline to build the winx64 project
build:
- desc: 'DO NOT USE. This is an internal task'
- platforms: [ windows ]
+ desc: 'DO NOT USE. This is an internal task'
cmds:
#the CI pipline may have issues reading modules if the third-party dir is not cleaned every time a build runs, only an issue after build
- defer: { task: clean-third-party }
-
+
#build the local rpmalloc library for linking
- task: build_rpmalloc
vars: { RPMALLOC_ARGS: '-DCMAKE_BUILD_TYPE={{ .BUILD_TYPE }}' }
- #configure the build with rpmalloc since we know the source must be local during CI
- - cmake -B./build {{ .CLI_ARGS }}
- '-DCMAKE_BUILD_TYPE={{ .BUILD_TYPE }}'
- '-DCI_PRECOMPILE=ON'
- '-DNATIVE_HEAP_NAME=vnlib_rpmalloc_static'
- '-DNATIVE_HEAP_SRC={{ .RPMALLOC_SRC_DIR }}'
- '-DNATIVE_HEAP_INCLUDES={{ .RPMALLOC_SRC_DIR }}'
+ #build the project
+ - task: build-internal
+ vars: { CLI_ARGS: '{{ .CLI_ARGS }}' }
+
+ build-internal:
+ internal: true
+ cmds:
+
+ #configure the build with vnlib_rpmalloc since we know the source must be local during CI
+ - cmake {{ .CLI_ARGS }}
+ -B{{ .BUILD_DIR }}
+ -DCMAKE_BUILD_TYPE={{ .BUILD_TYPE }}
+ -DCI_PRECOMPILE=ON
+ -DNATIVE_HEAP_NAME={{ if eq OS "windows" }}vnlib_rpmalloc{{else}}libvn_rpmalloc.a{{end}}
+ -DNATIVE_HEAP_SRC={{ .RPMALLOC_SRC_DIR }}
+ -DNATIVE_HEAP_BIN={{ .RPMALLOC_SRC_DIR }}/{{ .BUILD_DIR }}
+ -DNATIVE_HEAP_INCLUDES={{ .RPMALLOC_SRC_DIR }}
#build for platform, since Windows, build in both modes
- - cmake --build build/ --config debug
- - cmake --build build/ --config release
+ - cmd: cmake --build {{ .BUILD_DIR }}/ --config debug
+ - cmd: cmake --build {{ .BUILD_DIR }}/ --config release
#when build succeeds, archive the output into a tgz
postbuild_success:
@@ -93,9 +104,9 @@ tasks:
internal: true
deps:
- task: embed
- vars: { TARGET: './build/{{ .BUILD_MODE }}' }
+ vars: { TARGET: './{{ .BUILD_DIR }}/{{ .BUILD_MODE }}' }
cmds:
- - cmd: cd build/{{ .BUILD_MODE }} && tar -czf '../../bin/msvc-x64-{{ .BUILD_MODE }}-{{ .PROJECT_NAME }}.tgz' {{ .TAR_FILES }}
+ - 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:
@@ -126,20 +137,29 @@ tasks:
- cmd: powershell rm LICENSE
+ dev-init:
+ desc: 'Configures the project for local development'
+ cmds:
+ - task: build-internal
+ vars: { BUILD_TYPE: Debug }
+
+ - cmd: echo "dev init complete"
+ silent: true
+
#Remove the output dirs on clean
clean:
- desc: 'Cleans any build artifcats and output directories'
+ desc: 'Cleans any build artifacts and output directories'
ignore_error: true
cmds:
- for: [ bin/, build/ ]
- cmd: powershell rm -Recurse '{{ .ITEM }}' -Force
+ cmd: powershell rm -Recurse -Force '{{ .ITEM }}'
clean-third-party:
internal: true
ignore_error: true
cmds:
- - cmd: powershell rm -Recurse -Force 'build/_deps/'
+ - cmd: powershell rm -Recurse -Force '{{ .BUILD_DIR }}/_deps/'
platforms: [ windows ]
- - cmd: rm -rf 'build/_deps/'
+ - cmd: rm -rf '{{ .BUILD_DIR }}/_deps/'
platforms: [ linux, darwin ]
\ No newline at end of file
diff --git a/lib/Net.Compression/vnlib_compress/src/util.h b/lib/Net.Compression/vnlib_compress/src/util.h
index d1a1ddd..f37d63d 100644
--- a/lib/Net.Compression/vnlib_compress/src/util.h
+++ b/lib/Net.Compression/vnlib_compress/src/util.h
@@ -67,7 +67,7 @@
ERRNO result = heapFree(heapGetSharedHeapHandle(), ptr);
/* track failed free results */
- DEBUG_ASSERT(result > 0);
+ DEBUG_ASSERT(result != 0);
}
#else
diff --git a/lib/Utils.Cryptography/argon2/Taskfile.yaml b/lib/Utils.Cryptography/argon2/Taskfile.yaml
index d08d3b6..72f543d 100644
--- a/lib/Utils.Cryptography/argon2/Taskfile.yaml
+++ b/lib/Utils.Cryptography/argon2/Taskfile.yaml
@@ -11,6 +11,8 @@ version: '3'
vars:
PROJECT_NAME: 'Argon2'
MODULE_NAME: 'vnlib.core'
+ BUILD_DIR: 'build/{{ OS }}'
+ BUILD_TYPE: '{{ .BUILD_TYPE | default "Release" }}'
tasks:
@@ -19,15 +21,21 @@ tasks:
cmds:
#build with defaults
- task: build
- - cmd: echo "Your Argon2 library file can be found in '{{ .USER_WORKING_DIR }}/build'"
+ - cmd: echo "Your {{ .PROJECT_NAME }} dll file can be found in '{{ .USER_WORKING_DIR }}/{{ .BUILD_DIR }}'"
silent: true
build:
cmds:
- #init cmake build with greedy enabled
- - cmake -B./build
- - cmake --build build/ --config debug
- - cmake --build build/ --config release
+ - 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:
@@ -61,9 +69,9 @@ tasks:
internal: true
deps:
- task: embed
- vars: { TARGET: './build/{{ .BUILD_MODE }}' }
+ vars: { TARGET: './{{ .BUILD_DIR }}/{{ .BUILD_MODE }}' }
cmds:
- - cmd: cd build/{{ .BUILD_MODE }} && tar -czf '../../bin/msvc-x64-{{ .BUILD_MODE }}-{{ .PROJECT_NAME }}.tgz' {{ .TAR_FILES }}
+ - 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:
@@ -95,8 +103,17 @@ tasks:
#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:
+ cmds:
- for: [ bin/, build/ ]
- cmd: powershell -Command "Remove-Item -Recurse '{{ .ITEM }}'"
+ cmd: powershell rm -Recurse -Force '{{ .ITEM }}'
diff --git a/lib/Utils.Cryptography/monocypher/CMakeLists.txt b/lib/Utils.Cryptography/monocypher/CMakeLists.txt
index 8cec60b..73e5368 100644
--- a/lib/Utils.Cryptography/monocypher/CMakeLists.txt
+++ b/lib/Utils.Cryptography/monocypher/CMakeLists.txt
@@ -25,7 +25,7 @@ add_library(${CMAKE_PROJECT_NAME}_static STATIC ${VNLIB_MONOCYPHER_SOURCES} ${HE
#if on unix lib will be appended, so we can adjust
if(UNIX)
- set_target_properties(${CMAKE_PROJECT_NAME} ${CMAKE_PROJECT_NAME}_static PROPERTIES OUTPUT_NAME _vnmonocypher)
+ set_target_properties(${CMAKE_PROJECT_NAME} ${CMAKE_PROJECT_NAME}_static PROPERTIES OUTPUT_NAME vn_monocypher)
endif()
#Setup the compiler options
diff --git a/lib/Utils.Cryptography/monocypher/Taskfile.yaml b/lib/Utils.Cryptography/monocypher/Taskfile.yaml
index e736312..6eabe54 100644
--- a/lib/Utils.Cryptography/monocypher/Taskfile.yaml
+++ b/lib/Utils.Cryptography/monocypher/Taskfile.yaml
@@ -12,6 +12,8 @@ vars:
MS_ARGS: '/p:Platform=x64 /p:RunAnalyzersDuringBuild=false /p:BuildInParallel=true /p:MultiProcessorCompilation=true'
PROJECT_NAME: 'vnlib_monocypher'
MODULE_NAME: 'vnlib.core'
+ BUILD_DIR: 'build/{{ OS }}'
+ BUILD_TYPE: '{{ .BUILD_TYPE | default "Release" }}'
tasks:
@@ -20,15 +22,23 @@ tasks:
cmds:
#build with defaults
- task: build
- - cmd: echo "Your vnlib_monocypher dll file can be found in '{{.USER_WORKING_DIR}}/build'"
+ - cmd: echo "Your {{ .PROJECT_NAME }} dll file can be found in '{{ .USER_WORKING_DIR }}/{{ .BUILD_DIR }}'"
silent: true
build:
cmds:
- #init cmake build
- - cmake -B./build
- - cmake --build build/ --config Debug
- - cmake --build build/ --config Release
+ - 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:
vars:
@@ -43,22 +53,22 @@ tasks:
#get licenses for debug
- task: licenses
vars:
- TARGET: './build/Debug'
+ TARGET: '{{ .BUILD_DIR }}/Debug'
- task: licenses
vars:
- TARGET: './build/Release'
+ TARGET: './{{ .BUILD_DIR }}/Release'
#static debug lib
- - cd build/Debug && tar -czf '../../bin/msvc-x64-debug-{{.PROJECT_NAME}}-static.tgz' {{.PROJECT_NAME}}_static.lib {{.TAR_FILES}} {{.PROJECT_NAME}}_static.pdb
+ - cd {{ .BUILD_DIR }}/Debug && tar -czf '../../bin/msvc-x64-debug-{{.PROJECT_NAME}}-static.tgz' {{.PROJECT_NAME}}_static.lib {{.TAR_FILES}} {{.PROJECT_NAME}}_static.pdb
#dynamic debug lib
- - cd build/Debug && tar -czf '../../bin/msvc-x64-debug-{{.PROJECT_NAME}}.tgz' {{.PROJECT_NAME}}.dll {{.TAR_FILES}} {{.PROJECT_NAME}}.pdb
+ - cd {{ .BUILD_DIR }}/Debug && tar -czf '../../bin/msvc-x64-debug-{{.PROJECT_NAME}}.tgz' {{.PROJECT_NAME}}.dll {{.TAR_FILES}} {{.PROJECT_NAME}}.pdb
#release static lib
- - cd build/Release && tar -czf '../../bin/msvc-x64-release-{{.PROJECT_NAME}}-static.tgz' {{.PROJECT_NAME}}_static.lib {{.TAR_FILES}}
+ - cd {{ .BUILD_DIR }}/Release && tar -czf '../../bin/msvc-x64-release-{{.PROJECT_NAME}}-static.tgz' {{.PROJECT_NAME}}_static.lib {{.TAR_FILES}}
#release dll
- - cd build/Release && tar -czf '../../bin/msvc-x64-release-{{.PROJECT_NAME}}.tgz' {{.PROJECT_NAME}}.dll {{.TAR_FILES}}
+ - cd {{ .BUILD_DIR }}/Release && tar -czf '../../bin/msvc-x64-release-{{.PROJECT_NAME}}.tgz' {{.PROJECT_NAME}}.dll {{.TAR_FILES}}
#source code
- task: pack_source
@@ -78,8 +88,17 @@ tasks:
#pack monocypher source code and create the archive
- powershell -Command "tar --exclude build/* --exclude bin/* --exclude .git/* -czf 'bin/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:
ignore_error: true
- cmds:
- - cmd: powershell -Command "Remove-Item -Recurse './bin'"
- - cmd: powershell -Command "Remove-Item -Recurse './build'" \ No newline at end of file
+ cmds:
+ - for: [ bin/, build/ ]
+ cmd: powershell rm -Recurse -Force '{{ .ITEM }}' \ No newline at end of file
diff --git a/lib/Utils.Memory/vnlib_mimalloc/Taskfile.yaml b/lib/Utils.Memory/vnlib_mimalloc/Taskfile.yaml
index c1ded6d..0493b24 100644
--- a/lib/Utils.Memory/vnlib_mimalloc/Taskfile.yaml
+++ b/lib/Utils.Memory/vnlib_mimalloc/Taskfile.yaml
@@ -10,8 +10,11 @@ version: '3'
vars:
DEP_NAME: 'mimalloc'
- PROJECT_NAME: 'vnlib_{{ .DEP_NAME }}'
+ PROJECT_NAME: '{{ .PROJECT_NAME | default "vnlib_{{ .DEP_NAME }}" }}'
+ BUILD_DIR: 'build/{{ OS }}'
ARTIFACTS_OUT: '{{ .PROJECT_DIR }}/{{ .BINARY_DIR }}'
+ BUILD_TYPE: '{{ .BUILD_TYPE | default "Release" }}'
+ ENABLE_GREEDY: '{{ .ENABLE_GREEDY | default "1" }}' #default to greedy allocator build
tasks:
@@ -20,11 +23,9 @@ tasks:
cmds:
#init cmake build with greedy enabled
- task: build-internal
- vars:
- BUILD_TYPE: "Release"
- CLI_ARGS: "-DENABLE_GREEDY=1 {{ .CLI_ARGS }}"
-
- - cmd: echo "Your {{ .PROJECT_NAME }} library file can be found in '{{ .USER_WORKING_DIR }}/build'"
+ vars: { CLI_ARGS: "-DENABLE_GREEDY={{ .ENABLE_GREEDY }} {{ .CLI_ARGS }}" }
+
+ - cmd: echo "Your {{ .PROJECT_NAME }} library file can be found in '{{ .USER_WORKING_DIR }}/{{ .BUILD_DIR }}'"
silent: true
debug:
@@ -32,23 +33,29 @@ tasks:
- task: build-internal
vars:
BUILD_TYPE: "debug"
- CLI_ARGS: "-DENABLE_GREEDY=1 {{ .CLI_ARGS }}"
+ CLI_ARGS: "-DENABLE_GREEDY={{ .ENABLE_GREEDY }} {{ .CLI_ARGS }}"
build:
desc: 'DO NOT USE! This function is used internally during releases.'
cmds:
#init cmake build with greedy enabled
- - cmake -B./build -DENABLE_GREEDY=1 {{ .CLI_ARGS }}
- - cmake --build build/ --config debug
- - cmake --build build/ --config release
+ - cmake -B{{ .BUILD_DIR }} -DENABLE_GREEDY={{ .ENABLE_GREEDY }} {{ .CLI_ARGS }}
+
+ - cmake --build {{ .BUILD_DIR }}/ --config debug
+ - cmake --build {{ .BUILD_DIR }}/ --config release
build-internal:
internal: true
cmds:
#build with defaults
#init cmake build with greedy enabled
- - cmake -Bbuild/ -DCMAKE_BUILD_TYPE={{ .BUILD_TYPE }} {{ .CLI_ARGS }}
- - cmake --build build/ --config {{ .BUILD_TYPE }}
+ - cmake {{ .CLI_ARGS }}
+ -B{{ .BUILD_DIR }}/
+ -DCMAKE_BUILD_TYPE={{ .BUILD_TYPE }}
+
+ - cmake
+ --build {{ .BUILD_DIR }}/
+ --config {{ .BUILD_TYPE }}
postbuild_success:
cmds:
@@ -73,10 +80,11 @@ tasks:
internal: true
deps:
- task: pack_resources
- vars: { TARGET: './build/{{ .BUILD_TYPE }}' }
+ vars: { TARGET: './{{ .BUILD_DIR }}/{{ .BUILD_TYPE }}' }
cmds:
- - cmd: cd build/{{ .BUILD_TYPE }} && tar -czf '{{ .ARTIFACTS_OUT }}/msvc-x64-{{ .BUILD_TYPE }}-{{ .PROJECT_NAME }}.tgz' .
-
+ - cmd: "cd {{ .BUILD_DIR }}/{{ .BUILD_TYPE }}
+ && tar -czf '{{ .ARTIFACTS_OUT }}/msvc-x64-{{ .BUILD_TYPE }}-{{ .PROJECT_NAME }}.tgz' ."
+
pack_resources:
internal: true
cmds:
@@ -103,10 +111,11 @@ tasks:
- tar -czf '{{ .TARGET_SOURCE }}' {{ .SOURCE_FILES | join " " }}
clean:
+ desc: 'Cleans any build artifacts and output directories'
ignore_error: true
cmds:
- for: [ bin/, build/ ]
- cmd: powershell rm -Recurse -Force '{{.ITEM}}'
+ cmd: powershell rm -Recurse -Force '{{ .ITEM }}'
#called by module for initializing the project, it's not internal but hidden
dev-init:
diff --git a/lib/Utils.Memory/vnlib_rpmalloc/Taskfile.yaml b/lib/Utils.Memory/vnlib_rpmalloc/Taskfile.yaml
index f1c74a0..8268fe5 100644
--- a/lib/Utils.Memory/vnlib_rpmalloc/Taskfile.yaml
+++ b/lib/Utils.Memory/vnlib_rpmalloc/Taskfile.yaml
@@ -10,8 +10,11 @@ version: '3'
vars:
DEP_NAME: 'rpmalloc'
- PROJECT_NAME: 'vnlib_{{ .DEP_NAME }}'
+ PROJECT_NAME: '{{ .PROJECT_NAME | default "vnlib_{{ .DEP_NAME }}" }}'
+ BUILD_DIR: 'build/{{ OS }}'
ARTIFACTS_OUT: '{{ .PROJECT_DIR }}/{{ .BINARY_DIR }}'
+ BUILD_TYPE: '{{ .BUILD_TYPE | default "Release" }}'
+ ENABLE_GREEDY: '{{ .ENABLE_GREEDY | default "1" }}' #default to greedy allocator build
tasks:
@@ -20,11 +23,9 @@ tasks:
cmds:
#init cmake build with greedy enabled
- task: build-internal
- vars:
- BUILD_TYPE: "Release"
- CLI_ARGS: "-DENABLE_GREEDY=1 {{ .CLI_ARGS }}"
-
- - cmd: echo "Your {{ .PROJECT_NAME }} library file can be found in '{{ .USER_WORKING_DIR }}/build'"
+ vars: { CLI_ARGS: "-DENABLE_GREEDY={{ .ENABLE_GREEDY }} {{ .CLI_ARGS }}" }
+
+ - cmd: echo "Your {{ .PROJECT_NAME }} library file can be found in '{{ .USER_WORKING_DIR }}/{{ .BUILD_DIR }}'"
silent: true
debug:
@@ -32,23 +33,29 @@ tasks:
- task: build-internal
vars:
BUILD_TYPE: "debug"
- CLI_ARGS: "-DENABLE_GREEDY=1 {{ .CLI_ARGS }}"
+ CLI_ARGS: "-DENABLE_GREEDY={{ .ENABLE_GREEDY }} {{ .CLI_ARGS }}"
build:
desc: 'DO NOT USE! This function is used internally during releases.'
cmds:
#init cmake build with greedy enabled
- - cmake -B./build -DENABLE_GREEDY=1 {{ .CLI_ARGS }}
- - cmake --build build/ --config debug
- - cmake --build build/ --config release
+ - cmake -B{{ .BUILD_DIR }} -DENABLE_GREEDY={{ .ENABLE_GREEDY }} {{ .CLI_ARGS }}
+
+ - cmake --build {{ .BUILD_DIR }}/ --config debug
+ - cmake --build {{ .BUILD_DIR }}/ --config release
build-internal:
internal: true
cmds:
#build with defaults
#init cmake build with greedy enabled
- - cmake -Bbuild/ -DCMAKE_BUILD_TYPE={{ .BUILD_TYPE }} {{ .CLI_ARGS }}
- - cmake --build build/ --config {{ .BUILD_TYPE }}
+ - cmake {{ .CLI_ARGS }}
+ -B{{ .BUILD_DIR }}/
+ -DCMAKE_BUILD_TYPE={{ .BUILD_TYPE }}
+
+ - cmake
+ --build {{ .BUILD_DIR }}/
+ --config {{ .BUILD_TYPE }}
postbuild_success:
cmds:
@@ -73,10 +80,11 @@ tasks:
internal: true
deps:
- task: pack_resources
- vars: { TARGET: './build/{{ .BUILD_TYPE }}' }
+ vars: { TARGET: './{{ .BUILD_DIR }}/{{ .BUILD_TYPE }}' }
cmds:
- - cmd: cd build/{{ .BUILD_TYPE }} && tar -czf '{{ .ARTIFACTS_OUT }}/msvc-x64-{{ .BUILD_TYPE }}-{{ .PROJECT_NAME }}.tgz' .
-
+ - cmd: "cd {{ .BUILD_DIR }}/{{ .BUILD_TYPE }}
+ && tar -czf '{{ .ARTIFACTS_OUT }}/msvc-x64-{{ .BUILD_TYPE }}-{{ .PROJECT_NAME }}.tgz' ."
+
pack_resources:
internal: true
cmds:
@@ -103,10 +111,11 @@ tasks:
- tar -czf '{{ .TARGET_SOURCE }}' {{ .SOURCE_FILES | join " " }}
clean:
+ desc: 'Cleans any build artifacts and output directories'
ignore_error: true
cmds:
- for: [ bin/, build/ ]
- cmd: powershell rm -Recurse -Force '{{.ITEM}}'
+ cmd: powershell rm -Recurse -Force '{{ .ITEM }}'
#called by module for initializing the project, it's not internal but hidden
dev-init:
diff --git a/lib/Utils/tests/.runsettings b/lib/Utils/tests/.runsettings
index b13ddb7..52dde69 100644
--- a/lib/Utils/tests/.runsettings
+++ b/lib/Utils/tests/.runsettings
@@ -3,8 +3,8 @@
<RunConfiguration>
<EnvironmentVariables>
<VNLIB_SHARED_HEAP_DIAGNOSTICS>1</VNLIB_SHARED_HEAP_DIAGNOSTICS>
- <TEST_RPMALLOC_LIB_PATH>../../../../../Utils.Memory/vnlib_rpmalloc/build/Debug/vnlib_rpmalloc.dll</TEST_RPMALLOC_LIB_PATH>
- <TEST_MIMALLOC_LIB_PATH>../../../../../Utils.Memory/vnlib_mimalloc/build/Debug/vnlib_mimalloc.dll</TEST_MIMALLOC_LIB_PATH>
+ <TEST_RPMALLOC_LIB_PATH>../../../../../Utils.Memory/vnlib_rpmalloc/build/Windows/Debug/vnlib_rpmalloc.dll</TEST_RPMALLOC_LIB_PATH>
+ <TEST_MIMALLOC_LIB_PATH>../../../../../Utils.Memory/vnlib_mimalloc/build/Windows/Debug/vnlib_mimalloc.dll</TEST_MIMALLOC_LIB_PATH>
</EnvironmentVariables>
</RunConfiguration>