From 6de8bb6b38b716605f0d275d998ca47e33520b7a Mon Sep 17 00:00:00 2001 From: vnugent Date: Tue, 1 Aug 2023 18:04:19 -0400 Subject: build configuration added --- .gitignore | 8 +-- Module.Taskfile.yaml | 68 ++++++++++++++++++++ Taskfile.yaml | 75 ++++++++++++++++++++++ .../src/Clustering/CacheClientConfiguration.cs | 2 + .../src/VnCacheClient.cs | 5 +- vnlib.data.caching.build.sln | 72 +++++++++++++++++++++ 6 files changed, 221 insertions(+), 9 deletions(-) create mode 100644 Module.Taskfile.yaml create mode 100644 Taskfile.yaml create mode 100644 vnlib.data.caching.build.sln diff --git a/.gitignore b/.gitignore index 36bfbff..ffdb1c0 100644 --- a/.gitignore +++ b/.gitignore @@ -364,10 +364,4 @@ FodyWeavers.xsd *.licenseheader -*.json -*.ps1 -*.sln -*.task/* - -*[Tt]askfile.* -**/.task/* +*.json \ No newline at end of file diff --git a/Module.Taskfile.yaml b/Module.Taskfile.yaml new file mode 100644 index 0000000..d729ea3 --- /dev/null +++ b/Module.Taskfile.yaml @@ -0,0 +1,68 @@ +# https://taskfile.dev + +#Called by the vnbuild system to produce builds for my website +#https://www.vaughnnugent.com/resources/software + +#This taskfile performs the build operations for a module, it handles +#git code updates, msbuild on solutions, and sleet NuGet feed pushes. + +#this file must be in the same directory as the solution file + +version: '3' + +vars: + INT_DIR: '{{.SCRATCH_DIR}}/obj/{{.MODULE_NAME}}/' + MS_ARGS: '/p:RunAnalyzersDuringBuild=false /p:IntermediateOutputPath="{{.INT_DIR}}" /p:UseCommonOutputDirectory=true /p:BuildInParallel=true /p:MultiProcessorCompilation=true' + PACK_OUT: '{{.OUTPUT_DIR}}/{{.HEAD_SHA}}/pkg' + +tasks: + +#called by build pipeline to sync repo + update: + cmds: + - git remote update + - git reset --hard + - git pull origin {{.BRANCH_NAME}} --verify-signatures + +#called by build pipeline to build module + build: + cmds: + - echo "building module {{.MODULE_NAME}}" + + #re-write semver after hard reset, before build + - dotnet-gitversion.exe /updateprojectfiles + + #build debug mode first + - task: build_debug + - task: build_release + + postbuild_success: + cmds: + #push packages to the sleet feed (feed path is vnbuild global) + - sleet push "{{.PACK_OUT}}/debug/" --source debug --config "{{.SLEET_CONFIG_PATH}}" --force + - sleet push "{{.PACK_OUT}}/release/" --source release --config "{{.SLEET_CONFIG_PATH}}" --force + + postbuild_failed: + cmds: + - echo "postbuild failed {{.MODULE_NAME}}" + +#called by build pipeline to clean module + clean: + cmds: + #clean solution + - dotnet clean /p:BuildInParallel=true /p:MultiProcessorCompilation=true + + +#Internal tasks + build_debug: + internal: true + cmds: + - dotnet publish -c debug {{.MS_ARGS}} + - dotnet pack -c debug {{.MS_ARGS}} -o "{{.PACK_OUT}}/debug/" + + build_release: + internal: true + cmds: + - dotnet publish -c release {{.MS_ARGS}} + - dotnet pack -c release {{.MS_ARGS}} -o "{{.PACK_OUT}}/release/" + \ No newline at end of file diff --git a/Taskfile.yaml b/Taskfile.yaml new file mode 100644 index 0000000..b16b082 --- /dev/null +++ b/Taskfile.yaml @@ -0,0 +1,75 @@ +# https://taskfile.dev + +#Called by the vnbuild system to produce builds for my website +#https://www.vaughnnugent.com/resources/software + +#This taskfile is called from the root of a project that is being built +#and the purpose of this taskfile is to package up the output of a build +#from the solution file, and package it up into a tgz files for distribution + +version: '3' + +vars: + TARGET: '{{.USER_WORKING_DIR}}/bin' + RELEASE_DIR: "./bin/release/{{.TARGET_FRAMEWORK}}/publish" + SOURCE_OUT: "{{.USER_WORKING_DIR}}/bin/source" + +tasks: + + #when build succeeds, archive the output into a tgz + postbuild_success: + dir: '{{.USER_WORKING_DIR}}' + cmds: + #pack up source code + - task: packsource + + #run post in debug mode + - task: postbuild + vars: { BUILD_MODE: debug } + + #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 } + + + postbuild_failed: + dir: '{{.USER_WORKING_DIR}}' + cmds: + - echo "postbuild failed {{.PROJECT_NAME}}" + + + postbuild: + dir: '{{.USER_WORKING_DIR}}' + internal: true + vars: + #the build output directory + BUILD_OUT: "{{.USER_WORKING_DIR}}/bin/{{.BUILD_MODE}}/{{.TARGET_FRAMEWORK}}/publish" + + cmds: + + #copy license and readme to target + - cd .. && powershell -Command "Copy-Item -Path ./LICENSE.txt -Destination '{{.BUILD_OUT}}/license.txt'" + - cd .. && powershell -Command "Copy-Item -Path ./build.readme.md -Destination '{{.BUILD_OUT}}/readme.md'" + + #tar outputs + - cd "{{.BUILD_OUT}}" && tar -czf "{{.TARGET}}/{{.BUILD_MODE}}.tgz" . + + packsource: + dir: '{{.USER_WORKING_DIR}}' + internal: true + cmds: + #copy source code to target + - powershell -Command "Get-ChildItem -Include *.cs,*.csproj -Recurse | Where { \$_.FullName -notlike '*\obj\*' -and \$_.FullName -notlike '*\bin\*' } | Resolve-Path -Relative | tar --files-from - -czf '{{.TARGET}}/src.tgz'" + + +#Remove the output dirs on clean + clean: + dir: '{{.USER_WORKING_DIR}}' + cmds: + - cmd: powershell Remove-Item -Recurse './bin' + ignore_error: true + - cmd: powershell Remove-Item -Recurse './obj' + ignore_error: true diff --git a/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheClientConfiguration.cs b/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheClientConfiguration.cs index 1c1997e..5a15d33 100644 --- a/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheClientConfiguration.cs +++ b/lib/VNLib.Data.Caching.Extensions/src/Clustering/CacheClientConfiguration.cs @@ -84,6 +84,8 @@ namespace VNLib.Data.Caching.Extensions.Clustering /// /// The collection of servers to discover peers from and connect to /// Chainable fluent object + /// + /// public CacheClientConfiguration WithInitialPeers(IEnumerable peers) { //Check null diff --git a/lib/VNLib.Plugins.Extensions.VNCache/src/VnCacheClient.cs b/lib/VNLib.Plugins.Extensions.VNCache/src/VnCacheClient.cs index d62c831..b10cef7 100644 --- a/lib/VNLib.Plugins.Extensions.VNCache/src/VnCacheClient.cs +++ b/lib/VNLib.Plugins.Extensions.VNCache/src/VnCacheClient.cs @@ -191,12 +191,13 @@ namespace VNLib.Plugins.Extensions.VNCache } catch (WebSocketException wse) { - pluginLog.Warn("Failed to connect to cache server {reason}", wse); + pluginLog.Warn("Failed to establish a websocket connection to cache server {reason}", wse.Message); continue; } + //SEs may be raised when the server is not available catch (HttpRequestException he) when (he.InnerException is SocketException) { - pluginLog.Debug("Failed to connect to random cache server server"); + pluginLog.Debug("Failed to connect to random cache server because a TCP connection could not be established"); //Continue next loop continue; } diff --git a/vnlib.data.caching.build.sln b/vnlib.data.caching.build.sln new file mode 100644 index 0000000..480cdf4 --- /dev/null +++ b/vnlib.data.caching.build.sln @@ -0,0 +1,72 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{39E35C2F-BFBB-4819-B66A-475057D389EB}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{FBF12BFF-51A7-43BD-A066-D2FFACF333AA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VNLib.Data.Caching", "lib\VNLib.Data.Caching\src\VNLib.Data.Caching.csproj", "{31DE8FD7-AF05-4075-A5EE-747E76B5D134}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VNLib.Data.Caching.Extensions", "lib\VNLib.Data.Caching.Extensions\src\VNLib.Data.Caching.Extensions.csproj", "{D02BAAFC-818A-4D2C-B46F-6BB5C7BB14DB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VNLib.Data.Caching.ObjectCache", "lib\VNLib.Data.Caching.ObjectCache\src\VNLib.Data.Caching.ObjectCache.csproj", "{FEDACFD5-2529-4E37-8D11-3E0143954368}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VNLib.Plugins.Extensions.VNCache", "lib\VNLib.Plugins.Extensions.VNCache\src\VNLib.Plugins.Extensions.VNCache.csproj", "{E21ED553-4B08-41A5-B329-4BAF7701A99F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ObjectCacheServer", "plugins\ObjectCacheServer\src\ObjectCacheServer.csproj", "{AAECEC05-2439-47B4-A50D-D46EDDFA420C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{26A1C649-73F9-4B26-847F-4E40578CA2D6}" + ProjectSection(SolutionItems) = preProject + .gitattributes = .gitattributes + .gitignore = .gitignore + .onedev-buildspec.yml = .onedev-buildspec.yml + GitVersion.yml = GitVersion.yml + LICENSE.txt = LICENSE.txt + Module.Taskfile.yaml = Module.Taskfile.yaml + README.md = README.md + Taskfile.yaml = Taskfile.yaml + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {31DE8FD7-AF05-4075-A5EE-747E76B5D134}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {31DE8FD7-AF05-4075-A5EE-747E76B5D134}.Debug|Any CPU.Build.0 = Debug|Any CPU + {31DE8FD7-AF05-4075-A5EE-747E76B5D134}.Release|Any CPU.ActiveCfg = Release|Any CPU + {31DE8FD7-AF05-4075-A5EE-747E76B5D134}.Release|Any CPU.Build.0 = Release|Any CPU + {D02BAAFC-818A-4D2C-B46F-6BB5C7BB14DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D02BAAFC-818A-4D2C-B46F-6BB5C7BB14DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D02BAAFC-818A-4D2C-B46F-6BB5C7BB14DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D02BAAFC-818A-4D2C-B46F-6BB5C7BB14DB}.Release|Any CPU.Build.0 = Release|Any CPU + {FEDACFD5-2529-4E37-8D11-3E0143954368}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FEDACFD5-2529-4E37-8D11-3E0143954368}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FEDACFD5-2529-4E37-8D11-3E0143954368}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FEDACFD5-2529-4E37-8D11-3E0143954368}.Release|Any CPU.Build.0 = Release|Any CPU + {E21ED553-4B08-41A5-B329-4BAF7701A99F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E21ED553-4B08-41A5-B329-4BAF7701A99F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E21ED553-4B08-41A5-B329-4BAF7701A99F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E21ED553-4B08-41A5-B329-4BAF7701A99F}.Release|Any CPU.Build.0 = Release|Any CPU + {AAECEC05-2439-47B4-A50D-D46EDDFA420C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AAECEC05-2439-47B4-A50D-D46EDDFA420C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AAECEC05-2439-47B4-A50D-D46EDDFA420C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AAECEC05-2439-47B4-A50D-D46EDDFA420C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {31DE8FD7-AF05-4075-A5EE-747E76B5D134} = {FBF12BFF-51A7-43BD-A066-D2FFACF333AA} + {D02BAAFC-818A-4D2C-B46F-6BB5C7BB14DB} = {FBF12BFF-51A7-43BD-A066-D2FFACF333AA} + {FEDACFD5-2529-4E37-8D11-3E0143954368} = {FBF12BFF-51A7-43BD-A066-D2FFACF333AA} + {E21ED553-4B08-41A5-B329-4BAF7701A99F} = {FBF12BFF-51A7-43BD-A066-D2FFACF333AA} + {AAECEC05-2439-47B4-A50D-D46EDDFA420C} = {39E35C2F-BFBB-4819-B66A-475057D389EB} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C1214A47-444A-432F-8CF8-FDF2B1FA1CEC} + EndGlobalSection +EndGlobal -- cgit