diff --git a/.bonsai/Bonsai.config b/.bonsai/Bonsai.config new file mode 100644 index 0000000..ac40c8a --- /dev/null +++ b/.bonsai/Bonsai.config @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.bonsai/NuGet.config b/.bonsai/NuGet.config new file mode 100644 index 0000000..aa5beec --- /dev/null +++ b/.bonsai/NuGet.config @@ -0,0 +1,5 @@ + + + + + diff --git a/.bonsai/Setup.cmd b/.bonsai/Setup.cmd new file mode 100644 index 0000000..92d983d --- /dev/null +++ b/.bonsai/Setup.cmd @@ -0,0 +1,4 @@ +@echo off +pushd %~dp0 +powershell -ExecutionPolicy Bypass -File ./Setup.ps1 +popd \ No newline at end of file diff --git a/.bonsai/Setup.ps1 b/.bonsai/Setup.ps1 new file mode 100644 index 0000000..01cfba6 --- /dev/null +++ b/.bonsai/Setup.ps1 @@ -0,0 +1,21 @@ +Push-Location $PSScriptRoot +if (!(Test-Path "./Bonsai.exe")) { + $release = "https://github.com/bonsai-rx/bonsai/releases/latest/download/Bonsai.zip" + $configPath = "./Bonsai.config" + if (Test-Path $configPath) { + [xml]$config = Get-Content $configPath + $bootstrapper = $config.PackageConfiguration.Packages.Package.where{$_.id -eq 'Bonsai'} + if ($bootstrapper) { + $version = $bootstrapper.version + $release = "https://github.com/bonsai-rx/bonsai/releases/download/$version/Bonsai.zip" + } + } + Invoke-WebRequest $release -OutFile "temp.zip" + Move-Item -Path "NuGet.config" "temp.config" -ErrorAction SilentlyContinue + Expand-Archive "temp.zip" -DestinationPath "." -Force + Move-Item -Path "temp.config" "NuGet.config" -Force -ErrorAction SilentlyContinue + Remove-Item -Path "temp.zip" + Remove-Item -Path "Bonsai32.exe" +} +& .\Bonsai.exe --no-editor +Pop-Location \ No newline at end of file diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..d32441d --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "docfx": { + "version": "2.78.3", + "commands": [ + "docfx" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c9a9d0d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,46 @@ +root = true + +[*] +indent_style = space + +#-------------------------------------------------------------------------------------------------- +# XML, JSON, and web files +#-------------------------------------------------------------------------------------------------- +[*.{xml,csproj,vcxproj,vcxproj.filters,shproj,props,targets,config,nuspec,resx,vsixmanifest,wxs,vstemplate,slnx}] +indent_size = 2 + +[*.json] +indent_size = 2 + +[*.{html,css}] +indent_size = 2 + +#-------------------------------------------------------------------------------------------------- +# C++ +#-------------------------------------------------------------------------------------------------- +[*.{c,cpp,h,hpp,ixx}] +indent_size = 4 +charset = utf-8-bom +trim_trailing_whitespace = true +insert_final_newline = true + +#-------------------------------------------------------------------------------------------------- +# C# +#-------------------------------------------------------------------------------------------------- +[*.{cs,csx}] +indent_size = 4 +charset = utf-8-bom +trim_trailing_whitespace = true +insert_final_newline = true + +# Language keyword vs full type name +# Predefined for members, etc does not create a message because the explicitly sized types are conveient in interop scenarios where the bit size matters. +dotnet_style_predefined_type_for_locals_parameters_members = true:none +dotnet_style_predefined_type_for_member_access = true:suggestion + +# Instantiate argument exceptions correctly +dotnet_diagnostic.CA2208.severity = warning + +# Don't complain about not using modern collection syntax +dotnet_style_prefer_collection_expression = never +csharp_style_prefer_range_operator = false diff --git a/.gitattributes b/.gitattributes index 2125666..601a4e2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,43 @@ -* text=auto \ No newline at end of file +# Auto detect text files and normalize line endings +* text=auto + +# Scripts +*.cmd text eol=crlf +*.ps1 text + +# Config +*.gitignore text +*.gitattributes text +*.gitmodules text eol=lf +*.editorconfig text +*.git-blame-ignore-revs text +*.sln text +*.proj text +*.props text +*.targets text +*.csproj text +*.wixproj text +*.config text +*.json text +*.xml text +*.yml text + +# Code +*.manifest text +*.vsixmanifest text +*.vstemplate text +*.resx text +*.cs text +*.bonsai text +*.wxs text + +# Documents +LICENSE text +*.md text diff=markdown +*.rtf diff=astextplain + +# Graphics +*.png binary +*.ico binary +*.gif binary +*.svg text diff --git a/.github/workflows/Bonsai.Vimba.yml b/.github/workflows/Bonsai.Vimba.yml new file mode 100644 index 0000000..25b09c3 --- /dev/null +++ b/.github/workflows/Bonsai.Vimba.yml @@ -0,0 +1,344 @@ +# ======================================================================================================================================================================= +# Bonsai.Vimba CI/CD +# ======================================================================================================================================================================= +# Index: +# * Build, test, and package .NET +# * Build documentation +# * Render workflow images +# * Publish packages to GitHub +# * Publish packages to NuGet.org +# * Publish documentation +# ======================================================================================================================================================================= +# Note that this is a generic workflow meant for all Bonsai packages. Minor local modifications are fine, see https://github.com/bonsai-rx/prefect for more information. +# ======================================================================================================================================================================= +name: Bonsai.Vimba +on: + push: + # This prevents tag pushes from triggering this workflow + branches: ['*'] + pull_request: + release: + types: [published] + workflow_dispatch: +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_GENERATE_ASPNET_CERTIFICATE: false + ContinuousIntegrationBuild: true +jobs: + # ===================================================================================================================================================================== + # Build, test, and package .NET + # ___ _ _ _ _ _ _ _ _ _ ___ _____ + # | _ )_ _(_) |__| | | |_ ___ __| |_ __ _ _ _ __| | _ __ __ _ __| |____ _ __ _ ___ | \| | __|_ _| + # | _ \ || | | / _` |_ | _/ -_|_-< _|_ / _` | ' \/ _` | | '_ \/ _` / _| / / _` / _` / -_) _| .` | _| | | + # |___/\_,_|_|_\__,_( ) \__\___/__/\__( ) \__,_|_||_\__,_| | .__/\__,_\__|_\_\__,_\__, \___| (_)_|\_|___| |_| + # |/ |/ |_| |___/ + # ===================================================================================================================================================================== + build: + strategy: + fail-fast: false + matrix: + platform: + - name: Windows x64 + os: windows-latest + rid: win-x64 + - name: Linux x64 + os: ubuntu-22.04 + rid: linux-x64 + configuration: ['debug', 'release'] + include: + - platform: + rid: win-x64 + configuration: release + collect-packages: true + name: ${{matrix.platform.name}} ${{matrix.configuration}} + runs-on: ${{matrix.platform.os}} + outputs: + need-workflow-image-render: ${{steps.configure-build.outputs.need-workflow-image-render}} + steps: + # ----------------------------------------------------------------------- Checkout + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + # ----------------------------------------------------------------------- Set up tools + - name: Set up .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + # ----------------------------------------------------------------------- Configure build + - name: Configure build + id: configure-build + uses: bonsai-rx/configure-build@v1 + + # ----------------------------------------------------------------------- Build + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build --no-restore --configuration ${{matrix.configuration}} + + # ----------------------------------------------------------------------- Pack + - name: Pack + id: pack + run: dotnet pack --no-restore --no-build --configuration ${{matrix.configuration}} + + # ----------------------------------------------------------------------- Test + - name: Test .NET Framework 4.7.2 + run: dotnet test --no-restore --no-build --configuration ${{matrix.configuration}} --verbosity normal --framework net472 + - name: Test .NET 8 + run: dotnet test --no-restore --no-build --configuration ${{matrix.configuration}} --verbosity normal --framework net8.0 + - name: Test .NET 8 Windows + if: matrix.platform.rid == 'win-x64' + run: dotnet test --no-restore --no-build --configuration ${{matrix.configuration}} --verbosity normal --framework net8.0-windows + + # ----------------------------------------------------------------------- Collect artifacts + - name: Collect NuGet packages + uses: actions/upload-artifact@v4 + if: matrix.collect-packages && steps.pack.outcome == 'success' && always() + with: + name: Packages + if-no-files-found: error + path: artifacts/package/${{matrix.configuration}}/** + + # ===================================================================================================================================================================== + # Build documentation + # ___ _ _ _ _ _ _ _ + # | _ )_ _(_) |__| | __| |___ __ _ _ _ __ ___ _ _| |_ __ _| |_(_)___ _ _ + # | _ \ || | | / _` | / _` / _ \/ _| || | ' \/ -_) ' \ _/ _` | _| / _ \ ' \ + # |___/\_,_|_|_\__,_| \__,_\___/\__|\_,_|_|_|_\___|_||_\__\__,_|\__|_\___/_||_| + # ===================================================================================================================================================================== + build-documentation: + name: Build documentation + runs-on: ubuntu-latest + steps: + # ----------------------------------------------------------------------- Checkout + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + # ----------------------------------------------------------------------- Set up tools + - name: Set up .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + - name: Set up .NET tools + run: dotnet tool restore + + # ----------------------------------------------------------------------- Restore + - name: Restore + run: dotnet restore + + # ----------------------------------------------------------------------- Build metadata + - name: Build metadata + id: build-metadata + run: dotnet docfx metadata docs/docfx.json --noRestore + + # ----------------------------------------------------------------------- Build documentation + - name: Build documentation + id: build-documentation + run: dotnet docfx build docs/docfx.json + + # ----------------------------------------------------------------------- Collect artifacts + - name: Collect documentation metadata + uses: actions/upload-artifact@v4 + if: steps.build-metadata.outcome == 'success' && always() + with: + name: DocumentationMetadata + if-no-files-found: error + path: artifacts/docs/api/ + + - name: Collect documentation artifact + uses: actions/upload-artifact@v4 + if: steps.build-documentation.outcome == 'success' && always() + with: + name: DocumentationWebsite + if-no-files-found: error + path: artifacts/docs/site/ + + # ===================================================================================================================================================================== + # Render workflow images + # ___ _ _ __ _ _ + # | _ \___ _ _ __| |___ _ _ __ __ _____ _ _| |__/ _| |_____ __ __ (_)_ __ __ _ __ _ ___ ___ + # | / -_) ' \/ _` / -_) '_| \ V V / _ \ '_| / / _| / _ \ V V / | | ' \/ _` / _` / -_|_-< + # |_|_\___|_||_\__,_\___|_| \_/\_/\___/_| |_\_\_| |_\___/\_/\_/ |_|_|_|_\__,_\__, \___/__/ + # |___/ + # ===================================================================================================================================================================== + workflow-images: + name: Render workflow images + runs-on: windows-latest + needs: build + if: needs.build.outputs.need-workflow-image-render == 'true' + steps: + # ----------------------------------------------------------------------- Checkout + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + # ----------------------------------------------------------------------- Download built packages + - name: Download packages for rendering + uses: actions/download-artifact@v4 + with: + name: Packages + path: artifacts/packages/ + + # ----------------------------------------------------------------------- Set up Bonsai environments + - name: Set up Bonsai environments + uses: bonsai-rx/setup-bonsai@v1 + with: + environment-paths: '**/.bonsai/' + inject-packages: artifacts/packages/*.nupkg + + # ----------------------------------------------------------------------- Render + - name: Render images + id: render + run: pwsh ./docs/export-images.ps1 -OutputFolder artifacts/docs/site/ -Verbose + + # ----------------------------------------------------------------------- Collect artifacts + - name: Collect images + uses: actions/upload-artifact@v4 + if: steps.render.outcome == 'success' && always() + with: + name: DocumentationWorkflowImages + if-no-files-found: error + path: artifacts/docs/site/ + + # ===================================================================================================================================================================== + # Publish packages to GitHub + # ___ _ _ _ _ _ _ ___ _ _ _ _ _ + # | _ \_ _| |__| (_)__| |_ _ __ __ _ __| |____ _ __ _ ___ ___ | |_ ___ / __(_) |_| || |_ _| |__ + # | _/ || | '_ \ | (_-< ' \ | '_ \/ _` / _| / / _` / _` / -_|_-< | _/ _ \ | (_ | | _| __ | || | '_ \ + # |_| \_,_|_.__/_|_/__/_||_| | .__/\__,_\__|_\_\__,_\__, \___/__/ \__\___/ \___|_|\__|_||_|\_,_|_.__/ + # |_| |___/ + # ===================================================================================================================================================================== + publish-github: + name: Publish packages to GitHub + runs-on: ubuntu-latest + needs: build + permissions: + # Needed to attach files to releases + contents: write + # Needed to upload to GitHub Packages + packages: write + if: github.event_name == 'push' || github.event_name == 'release' + steps: + # ----------------------------------------------------------------------- Set up .NET + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + # ----------------------------------------------------------------------- Download built packages + - name: Download built packages + uses: actions/download-artifact@v4 + with: + name: Packages + path: artifacts/packages/ + + # ----------------------------------------------------------------------- Upload release assets + - name: Upload release assets + if: github.event_name == 'release' + run: gh release upload --repo ${{github.repository}} ${{github.event.release.tag_name}} artifacts/packages/* --clobber + env: + GH_TOKEN: ${{github.token}} + + # ----------------------------------------------------------------------- Push to GitHub Packages + - name: Push to GitHub Packages + run: dotnet nuget push "artifacts/packages/*.nupkg" --skip-duplicate --no-symbols --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/${{github.repository_owner}} + env: + # This is a workaround for https://github.com/NuGet/Home/issues/9775 + DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0 + + # ===================================================================================================================================================================== + # Publish packages to NuGet.org + # ___ _ _ _ _ _ _ _ _ ___ _ + # | _ \_ _| |__| (_)__| |_ _ __ __ _ __| |____ _ __ _ ___ ___ | |_ ___ | \| |_ _ / __|___| |_ ___ _ _ __ _ + # | _/ || | '_ \ | (_-< ' \ | '_ \/ _` / _| / / _` / _` / -_|_-< | _/ _ \ | .` | || | (_ / -_) _|_/ _ \ '_/ _` | + # |_| \_,_|_.__/_|_/__/_||_| | .__/\__,_\__|_\_\__,_\__, \___/__/ \__\___/ |_|\_|\_,_|\___\___|\__(_)___/_| \__, | + # |_| |___/ |___/ + # ===================================================================================================================================================================== + publish-packages-nuget-org: + name: Publish packages to NuGet.org + runs-on: ubuntu-latest + environment: public-release + needs: build + if: github.event_name == 'release' + steps: + # ----------------------------------------------------------------------- Set up .NET + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + + # ----------------------------------------------------------------------- Download built packages + - name: Download built packages + uses: actions/download-artifact@v4 + with: + name: Packages + path: artifacts/packages/ + + # ----------------------------------------------------------------------- Push to NuGet.org + - name: Push to NuGet.org + run: dotnet nuget push "artifacts/packages/*.nupkg" --api-key ${{secrets.NUGET_API_KEY}} --source ${{vars.NUGET_API_URL}} + env: + # This is a workaround for https://github.com/NuGet/Home/issues/9775 + DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0 + + + # ===================================================================================================================================================================== + # Publish documentation + # ___ _ _ _ _ _ _ _ _ + # | _ \_ _| |__| (_)__| |_ __| |___ __ _ _ _ __ ___ _ _| |_ __ _| |_(_)___ _ _ + # | _/ || | '_ \ | (_-< ' \ / _` / _ \/ _| || | ' \/ -_) ' \ _/ _` | _| / _ \ ' \ + # |_| \_,_|_.__/_|_/__/_||_| \__,_\___/\__|\_,_|_|_|_\___|_||_\__\__,_|\__|_\___/_||_| + # ===================================================================================================================================================================== + publish-documentation: + name: Publish documentation + runs-on: ubuntu-latest + # Publishing is not strictly necessary here, but if we're going to do a public release we want to wait to publish the docs until it goes out + needs: [build-documentation, workflow-images, publish-packages-nuget-org] + permissions: + # Both required by actions/deploy-pages + pages: write + id-token: write + environment: + # Intentionally not using the "default" github-pages environment as it's not compatible with this workflow + name: documentation-website + url: ${{steps.publish.outputs.page_url}} + # Only run if the workflow isn't dying and build-documentation was successful and either A) we're releasing or B) we have continuous deployment enabled + if: | + !cancelled() && !failure() && needs.build-documentation.result == 'success' + && (github.event_name == 'release' + || (vars.CONTINUOUS_DOCUMENTATION && github.event_name != 'pull_request') + ) + steps: + # ----------------------------------------------------------------------- Download documentation website components + # It is intentional that we use two independent download steps here as it ensures that workflow images are permitted + # to overwrite any conflicts in the docfx output but not the other way around. + - name: Download documentation website + uses: actions/download-artifact@v4 + with: + name: DocumentationWebsite + + - name: Download workflow images + if: ${{needs.workflow-images.result == 'success'}} + uses: actions/download-artifact@v4 + with: + name: DocumentationWorkflowImages + + # ----------------------------------------------------------------------- Collect artifacts + - name: Upload final documentation website artifact + uses: actions/upload-pages-artifact@v3 + with: + path: '.' + + # ----------------------------------------------------------------------- Publish to GitHub Pages (for forks) + - name: Publish to GitHub Pages (forks) + id: publish + if: github.event_name == 'release' || github.event.repository.fork + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index 35b90d0..07e498f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ -.vs -bin -obj -*.dll -*.xml \ No newline at end of file +.bonsai/Bonsai.exe* +.bonsai/Packages/ +.bonsai/Settings/ +.vs/ +/artifacts/ +*.xml diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..acf6d39 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "docs/bonsai-docfx"] + path = docs/bonsai-docfx + url = https://github.com/bonsai-rx/docfx-tools.git diff --git a/Bonsai.Vimba.sln b/Bonsai.Vimba.sln index 1467b0c..55b4a70 100644 --- a/Bonsai.Vimba.sln +++ b/Bonsai.Vimba.sln @@ -3,7 +3,17 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31911.196 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Vimba", "Bonsai.Vimba\Bonsai.Vimba.csproj", "{CF3AC6E3-5B8E-43C3-AC1D-2AB5F1461145}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Vimba", "src\Bonsai.Vimba\Bonsai.Vimba.csproj", "{CF3AC6E3-5B8E-43C3-AC1D-2AB5F1461145}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{DEE5DD87-39C1-BF34-B639-A387DCCF972B}" + ProjectSection(SolutionItems) = preProject + build\Common.csproj.props = build\Common.csproj.props + build\Common.csproj.targets = build\Common.csproj.targets + build\Common.Tests.csproj.props = build\Common.Tests.csproj.props + build\icon.png = build\icon.png + build\Package.props = build\Package.props + build\Project.csproj.props = build\Project.csproj.props + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Bonsai.Vimba/Bonsai.Vimba.csproj b/Bonsai.Vimba/Bonsai.Vimba.csproj deleted file mode 100644 index d325eb3..0000000 --- a/Bonsai.Vimba/Bonsai.Vimba.csproj +++ /dev/null @@ -1,38 +0,0 @@ - - - - NeuroGEARS - Bonsai - Vimba Library - Bonsai Library containing modules for acquiring images from Allied Vision cameras. Vimba SDK version 5.1.0 is required. - Copyright © NeuroGEARS Ltd 2023 - https://github.com/bonsai-rx/vimba - https://github.com/bonsai-rx/vimba/blob/main/LICENSE - https://bonsai-rx.org/assets/images/bonsai.png - false - Bonsai Rx Allied Vision Vimba - true - true - ..\bin\$(Configuration) - snupkg - true - net472 - 8.0 - 0.1.0 - - - - - - - - - ..\Externals\VimbaNET\x64\VimbaNET.dll - - - - - - - - - diff --git a/Bonsai.Vimba/Properties/launchSettings.json b/Bonsai.Vimba/Properties/launchSettings.json deleted file mode 100644 index 72a4374..0000000 --- a/Bonsai.Vimba/Properties/launchSettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "profiles": { - "Bonsai": { - "commandName": "Executable", - "executablePath": "$(registry:HKEY_CURRENT_USER\\Software\\Goncalo Lopes\\Bonsai@InstallDir)Bonsai.exe", - "commandLineArgs": "--lib:$(TargetDir). --no-boot ." - } - } -} \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..91586df --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..b7ac253 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE index 758df16..6e4ff25 100644 --- a/LICENSE +++ b/LICENSE @@ -1,11 +1,11 @@ -Copyright (c) 2023 NeuroGEARS Ltd +Copyright (c) Bonsai Foundation CIC and Contributors -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -18,7 +18,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------- +------------------------------------------------------------------------------- + [VimbaNET.dll] (hereinafter referred to as the "Software") Made available under license from Allied Vision Technologies GmbH diff --git a/build/Common.Tests.csproj.props b/build/Common.Tests.csproj.props new file mode 100644 index 0000000..c42b25f --- /dev/null +++ b/build/Common.Tests.csproj.props @@ -0,0 +1,6 @@ + + + false + false + + \ No newline at end of file diff --git a/build/Common.csproj.props b/build/Common.csproj.props new file mode 100644 index 0000000..1099119 --- /dev/null +++ b/build/Common.csproj.props @@ -0,0 +1,80 @@ + + + + + Debug + AnyCPU + + + + + 12.0 + true + strict + enable + true + + + true + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)../artifacts')) + + + $(ArtifactsPath)/wsl + + + + + true + Dependency;BonsaiLibrary + + icon.png + $(MSBuildThisFileDirectory)icon.png + + LICENSE + $(MSBuildThisFileDirectory)../LICENSE + + README.md + $(MSBuildThisFileDirectory)../docs/README.md + $(MSBuildThisFileDirectory)README.nuget.md + $(MSBuildProjectDirectory)\README.md + $(MSBuildProjectDirectory)\README.nuget.md + + + false + true + snupkg + + + false + true + + + + + $(WarningsAsErrors);NU1701;CS7035 + + + true + + + true + + + $(MSBuildThisFileDirectory)../.bonsai/Bonsai.exe + + + + + + \ No newline at end of file diff --git a/build/Common.csproj.targets b/build/Common.csproj.targets new file mode 100644 index 0000000..07f4916 --- /dev/null +++ b/build/Common.csproj.targets @@ -0,0 +1,46 @@ + + + + + + + + + + + $(TargetName.ToLowerInvariant()) + DotnetTool + + + 1591,1573 + + + + + + + + 0 + 42.42.42-dev$(DevVersion) + + $(CiBuildVersion) + + + + + + + + + + + + \ No newline at end of file diff --git a/build/Package.props b/build/Package.props new file mode 100644 index 0000000..a93a601 --- /dev/null +++ b/build/Package.props @@ -0,0 +1,11 @@ + + + Bonsai Rx Allied Vision Vimba + https://bonsai-rx.org/vimba + + Bonsai Foundation + Copyright © Bonsai Foundation CIC and Contributors + + true + + \ No newline at end of file diff --git a/build/Project.csproj.props b/build/Project.csproj.props new file mode 100644 index 0000000..1d004b4 --- /dev/null +++ b/build/Project.csproj.props @@ -0,0 +1,5 @@ + + + annotations + + \ No newline at end of file diff --git a/build/icon.png b/build/icon.png new file mode 100644 index 0000000..50b328b Binary files /dev/null and b/build/icon.png differ diff --git a/README.md b/docs/README.md similarity index 100% rename from README.md rename to docs/README.md diff --git a/docs/bonsai-docfx b/docs/bonsai-docfx new file mode 160000 index 0000000..5b584ca --- /dev/null +++ b/docs/bonsai-docfx @@ -0,0 +1 @@ +Subproject commit 5b584cadc5f1e3088f4972469243df2e3faf6925 diff --git a/docs/build.ps1 b/docs/build.ps1 new file mode 100644 index 0000000..01ad8f5 --- /dev/null +++ b/docs/build.ps1 @@ -0,0 +1,19 @@ +[CmdletBinding()] param ( + [string[]]$docfxArgs +) +Set-StrictMode -Version 3.0 +$ErrorActionPreference = 'Stop' +$PSNativeCommandUseErrorActionPreference = $true + +Push-Location $PSScriptRoot +try { + $libPaths = @() + $libPaths += Get-ChildItem "..\artifacts\bin\*\release_net4*" -Directory | Select-Object -Expand FullName + $libPaths += "..\artifacts\package\release" + + ./export-images.ps1 $libPaths + dotnet docfx metadata + dotnet docfx build $docfxArgs +} finally { + Pop-Location +} diff --git a/docs/docfx.json b/docs/docfx.json new file mode 100644 index 0000000..ffcafbf --- /dev/null +++ b/docs/docfx.json @@ -0,0 +1,84 @@ +{ + "$schema": "https://raw.githubusercontent.com/dotnet/docfx/main/schemas/docfx.schema.json", + "metadata": [ + { + "src": [ + { + "src": "../src/", + "files": "**/*.csproj", + "exclude": "**/*.Tests.csproj" + } + ], + "output": "../artifacts/docs/api/", + "enumSortOrder": "declaringOrder", + "memberLayout": "separatePages", + "filter": "filter.yml" + } + ], + "build": { + "content": [ + { + "files": [ + "*.md", + "toc.yml", + "{articles,tutorials,examples}/**/*.md", + "{articles,tutorials,examples}/**/toc.yml" + ], + "exclude": "README.md" + }, + { + "src": "../artifacts/docs/api/", + "dest": "api", + "files": "**/*.yml" + } + ], + "resource": [ + { + "files": [ + "images/**", + "workflows/**/*.{bonsai,svg}", + "{articles,tutorials,examples}/**/*.{bonsai,svg}" + ] + }, + { + "src": "../build/", + "files": "icon.png" + } + ], + "overwrite": [ + "apidoc/**/*.md" + ], + "output": "../artifacts/docs/site/", + "template": [ + "default", + "modern", + "bonsai-docfx/template", + "template" + ], + "sitemap": { + "baseUrl": "https://bonsai-rx.org/vimba" + }, + "globalMetadata": { + "_appName": "Bonsai.Vimba", + "_appTitle": "Bonsai.Vimba", + "_appFooter": "© Bonsai Foundation CIC and Contributors. Made with docfx", + "_appLogoPath": "logo.svg", + "_appFaviconPath": "icon.png", + "_enableNewTab": true, + "_enableSearch": true, + "_gitContribute": { + "apiSpecFolder": "docs/apidoc" + } + }, + "markdownEngineProperties": { + "markdigExtensions": [ + "attributes", + "customcontainers" + ] + }, + "xref": [ + "https://bonsai-rx.org/docs/xrefmap.yml", + "https://horizongir.github.io/reactive/xrefmap.yml" + ] + } +} \ No newline at end of file diff --git a/docs/export-images.ps1 b/docs/export-images.ps1 new file mode 100644 index 0000000..e613b87 --- /dev/null +++ b/docs/export-images.ps1 @@ -0,0 +1,44 @@ +[CmdletBinding()] param ( + [string[]]$LibrarySources, + [bool]$UseGalleryForWorkflowsDirectory=$false, + [bool]$UseGalleryForExamplesDirectory=$true, + [string]$OutputFolder=$null +) +Set-StrictMode -Version 3.0 +$ErrorActionPreference = 'Stop' +$PSNativeCommandUseErrorActionPreference = $true + +if ($OutputFolder) { + $OutputFolder = Join-Path (Get-Location) $OutputFolder +} + +function Process-Workflow-Collection([bool]$useGallery, [string]$workflowPath, [string]$environmentPath) { + $libPath = $LibrarySources + + if ($useGallery) { + $libPath = @() + $galleryPath = Join-Path $environmentPath 'Gallery' + $null = New-Item -ItemType Directory -Path $galleryPath -Force + foreach ($librarySource in $LibrarySources) { + Get-ChildItem -Path $librarySource -Filter *.nupkg | Copy-Item -Destination $galleryPath + } + } + + $bootstrapperPath = (Join-Path $environmentPath 'Bonsai.exe') + .\bonsai-docfx\modules\Export-Image.ps1 -libPath $libPath -workflowPath $workflowPath -bootstrapperPath $bootstrapperPath -outputFolder $OutputFolder -documentationRoot $PSScriptRoot +} + +Push-Location $PSScriptRoot +try { + if (Test-Path -Path 'workflows/') { + Process-Workflow-Collection $UseGalleryForWorkflowsDirectory './workflows' '../.bonsai/' + } + + if (Test-Path -Path 'examples/') { + foreach ($environment in (Get-ChildItem -Path 'examples/' -Filter '.bonsai' -Recurse -FollowSymlink -Directory)) { + Process-Workflow-Collection $UseGalleryForExamplesDirectory ($environment.Parent.FullName) ($environment.FullName) + } + } +} finally { + Pop-Location +} diff --git a/docs/filter.yml b/docs/filter.yml new file mode 100644 index 0000000..472eb43 --- /dev/null +++ b/docs/filter.yml @@ -0,0 +1,4 @@ +apiRules: +- exclude: + hasAttribute: + uid: System.ObsoleteAttribute diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..ba991fe --- /dev/null +++ b/docs/index.md @@ -0,0 +1,5 @@ +--- +_layout: landing +--- + +[!INCLUDE [](README.md)] diff --git a/docs/template/public/main.css b/docs/template/public/main.css new file mode 100644 index 0000000..13bc806 --- /dev/null +++ b/docs/template/public/main.css @@ -0,0 +1 @@ +@import "workflow.css"; diff --git a/docs/template/public/main.js b/docs/template/public/main.js new file mode 100644 index 0000000..d27c23a --- /dev/null +++ b/docs/template/public/main.js @@ -0,0 +1,13 @@ +import WorkflowContainer from "./workflow.js" + +export default { + defaultTheme: 'light', + iconLinks: [{ + icon: 'github', + href: 'https://github.com/bonsai-rx/vimba', + title: 'GitHub' + }], + start: () => { + WorkflowContainer.init(); + } +} diff --git a/docs/toc.yml b/docs/toc.yml new file mode 100644 index 0000000..3daf8b9 --- /dev/null +++ b/docs/toc.yml @@ -0,0 +1,2 @@ +- name: API + href: ../artifacts/docs/api/ diff --git a/docs/workflows/.gitignore b/docs/workflows/.gitignore new file mode 100644 index 0000000..e2beea4 --- /dev/null +++ b/docs/workflows/.gitignore @@ -0,0 +1,2 @@ +*.layout +*.svg diff --git a/global.json b/global.json new file mode 100644 index 0000000..989a69c --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "8.0.100", + "rollForward": "latestMinor" + } +} \ No newline at end of file diff --git a/src/Bonsai.Vimba/Bonsai.Vimba.csproj b/src/Bonsai.Vimba/Bonsai.Vimba.csproj new file mode 100644 index 0000000..acbc967 --- /dev/null +++ b/src/Bonsai.Vimba/Bonsai.Vimba.csproj @@ -0,0 +1,24 @@ + + + + Bonsai - Vimba Library + Bonsai Library containing modules for acquiring images from Allied Vision cameras. Vimba SDK version 5.1.0 is required. + net472 + + + + + + + + + ..\Externals\VimbaNET\x64\VimbaNET.dll + + + + + + + + + \ No newline at end of file diff --git a/Bonsai.Vimba/Bonsai.Vimba.props b/src/Bonsai.Vimba/Bonsai.Vimba.props similarity index 78% rename from Bonsai.Vimba/Bonsai.Vimba.props rename to src/Bonsai.Vimba/Bonsai.Vimba.props index b0bcf1a..0df8ed5 100644 --- a/Bonsai.Vimba/Bonsai.Vimba.props +++ b/src/Bonsai.Vimba/Bonsai.Vimba.props @@ -1,5 +1,4 @@ - - + $(MSBuildThisFileDirectory)..\..\build\net472\bin\x86\VimbaNET.dll diff --git a/Bonsai.Vimba/Bonsai.Vimba.targets b/src/Bonsai.Vimba/Bonsai.Vimba.targets similarity index 90% rename from Bonsai.Vimba/Bonsai.Vimba.targets rename to src/Bonsai.Vimba/Bonsai.Vimba.targets index ee5fdbb..5ce96d1 100644 --- a/Bonsai.Vimba/Bonsai.Vimba.targets +++ b/src/Bonsai.Vimba/Bonsai.Vimba.targets @@ -1,5 +1,4 @@ - - + diff --git a/Bonsai.Vimba/Properties/AssemblyInfo.cs b/src/Bonsai.Vimba/Properties/AssemblyInfo.cs similarity index 100% rename from Bonsai.Vimba/Properties/AssemblyInfo.cs rename to src/Bonsai.Vimba/Properties/AssemblyInfo.cs diff --git a/src/Bonsai.Vimba/Properties/launchSettings.json b/src/Bonsai.Vimba/Properties/launchSettings.json new file mode 100644 index 0000000..4af4f46 --- /dev/null +++ b/src/Bonsai.Vimba/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "Bonsai": { + "commandName": "Executable", + "executablePath": "$(BonsaiExecutablePath)", + "commandLineArgs": "--lib:\"$(TargetDir).\"", + "nativeDebugging": true + } + } +} \ No newline at end of file diff --git a/Bonsai.Vimba/SerialNumberConverter.cs b/src/Bonsai.Vimba/SerialNumberConverter.cs similarity index 100% rename from Bonsai.Vimba/SerialNumberConverter.cs rename to src/Bonsai.Vimba/SerialNumberConverter.cs diff --git a/Bonsai.Vimba/VimbaApi.cs b/src/Bonsai.Vimba/VimbaApi.cs similarity index 100% rename from Bonsai.Vimba/VimbaApi.cs rename to src/Bonsai.Vimba/VimbaApi.cs diff --git a/Bonsai.Vimba/VimbaCapture.cs b/src/Bonsai.Vimba/VimbaCapture.cs similarity index 100% rename from Bonsai.Vimba/VimbaCapture.cs rename to src/Bonsai.Vimba/VimbaCapture.cs diff --git a/Bonsai.Vimba/VimbaDataFrame.cs b/src/Bonsai.Vimba/VimbaDataFrame.cs similarity index 100% rename from Bonsai.Vimba/VimbaDataFrame.cs rename to src/Bonsai.Vimba/VimbaDataFrame.cs diff --git a/Externals/VimbaNET/x64/README.md b/src/Externals/VimbaNET/x64/README.md similarity index 100% rename from Externals/VimbaNET/x64/README.md rename to src/Externals/VimbaNET/x64/README.md diff --git a/Externals/VimbaNET/x86/README.md b/src/Externals/VimbaNET/x86/README.md similarity index 100% rename from Externals/VimbaNET/x86/README.md rename to src/Externals/VimbaNET/x86/README.md