diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 15029cd..a73dbee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,9 @@ name: Build (Windows) on: push: - branches: [ "master", "main" ] + branches: [ "master", "main", "sow/**" ] pull_request: - branches: [ "master", "main" ] + branches: [ "master", "main", "sow/**" ] workflow_dispatch: jobs: @@ -35,6 +35,36 @@ jobs: - name: Setup MSBuild uses: microsoft/setup-msbuild@v2 + - name: Compute SAMVersion + id: ver + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + # Prefer head_ref when its a sow branch (release-promotion PRs from sow/* to main), + # else use base_ref on PR events / ref_name on push events. + $headRef = '${{ github.head_ref }}' + $baseRef = '${{ github.base_ref }}' + $refName = '${{ github.ref_name }}' + if ($headRef -match '^sow/\d{4}-Q\d$') { + $ref = $headRef + } elseif ('${{ github.event_name }}' -eq 'pull_request') { + $ref = $baseRef + } else { + $ref = $refName + } + # .NET AssemblyVersion components are UInt16 (max 65535). Cap to 60000 for headroom. + $run = ${{ github.run_number }} % 60000 + if ($ref -match 'sow/(\d{4})-Q(\d)') { + $v = "$($Matches[1]).$($Matches[2]).$run.0" + $src = "branch '$ref'" + } else { + $now = (Get-Date).ToUniversalTime() + $quarter = [int][Math]::Ceiling($now.Month / 3.0) + $v = "$($now.Year).$quarter.$run.0" + $src = "date $($now.ToString('yyyy-MM-dd')) (ref '$ref' not sow/yyyy-Qx)" + } + Write-Host "SAMVersion = $v (from $src)" + "samversion=$v" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - name: Clone dependency repos (siblings) shell: pwsh @@ -55,10 +85,32 @@ jobs: $deps = $buildOrder[0..($buildOrder.Count-2)] foreach ($r in $deps) { if (Test-Path $r) { continue } - Write-Host "Cloning https://github.com/$org/$r.git" - git clone --depth 1 "https://github.com/$org/$r.git" $r + $headRef = '${{ github.head_ref }}' + $baseRef = '${{ github.base_ref }}' + $refName = '${{ github.ref_name }}' + $candidates = @() + if ($headRef) { $candidates += $headRef } + # Current sow branch: base_ref on PR events, ref_name on push events. + $sowRef = if ($baseRef -match '^sow/') { $baseRef } elseif ($refName -match '^sow/') { $refName } else { '' } + if ($sowRef -and $sowRef -ne $headRef) { $candidates += $sowRef } + $candidates += 'sow/2026-Q2' + $cloned = $false + foreach ($cand in $candidates) { + $has = (git ls-remote --heads "https://github.com/$org/$r.git" $cand 2>$null | Out-String).Trim() + if ($has) { + Write-Host "Cloning $org/$r @ $cand" + git clone --depth 1 --branch $cand "https://github.com/$org/$r.git" $r + $cloned = $true + break + } + } + if (-not $cloned) { + Write-Host "Cloning $org/$r @ default branch" + git clone --depth 1 "https://github.com/$org/$r.git" $r + } } + # Ensure ReferencePath exists even before SAM_Windows builds New-Item -ItemType Directory -Force -Path "SAM_Windows\build" | Out-Null @@ -77,6 +129,7 @@ jobs: '/v:m' '/p:Configuration=Release' '/p:UseSharedCompilation=false' + '/p:SAMVersion=${{ steps.ver.outputs.samversion }}' '/p:RunPostBuildEvent=OnOutputUpdated' "/p:ReferencePath=$windowsRef" ) diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..509f4c6 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,57 @@ + + + + + 1.0.0.0 + $(SAMVersion) + $(SAMVersion) + + $(SAMVersion)+$(SAMSourceRevision) + + false + true + + + + + + <_SAMVersionLine Include="// <auto-generated />" /> + <_SAMVersionLine Include="[assembly: System.Reflection.AssemblyVersionAttribute("$(SAMVersion)")]" /> + <_SAMVersionLine Include="[assembly: System.Reflection.AssemblyFileVersionAttribute("$(SAMVersion)")]" /> + + <_SAMVersionLine Include="[assembly: System.Reflection.AssemblyInformationalVersionAttribute("$(InformationalVersion)")]" Condition="'$(InformationalVersion)' != ''" /> + + + + + + + + + + diff --git a/Grasshopper/SAM.Analytical.Grasshopper.Topologic/Kernel/AssemblyInfo.cs b/Grasshopper/SAM.Analytical.Grasshopper.Topologic/Kernel/AssemblyInfo.cs index ea0a9dc..12667d7 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper.Topologic/Kernel/AssemblyInfo.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper.Topologic/Kernel/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System; using System.Drawing; diff --git a/Grasshopper/SAM.Analytical.Grasshopper.Topologic/Properties/AssemblyInfo.cs b/Grasshopper/SAM.Analytical.Grasshopper.Topologic/Properties/AssemblyInfo.cs index d2c0151..aaa5bd6 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper.Topologic/Properties/AssemblyInfo.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper.Topologic/Properties/AssemblyInfo.cs @@ -55,6 +55,3 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Grasshopper/SAM.Analytical.Grasshopper.Topologic/SAM.Analytical.Grasshopper.Topologic.csproj b/Grasshopper/SAM.Analytical.Grasshopper.Topologic/SAM.Analytical.Grasshopper.Topologic.csproj index 1adb99b..be73021 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper.Topologic/SAM.Analytical.Grasshopper.Topologic.csproj +++ b/Grasshopper/SAM.Analytical.Grasshopper.Topologic/SAM.Analytical.Grasshopper.Topologic.csproj @@ -10,7 +10,6 @@ false true true - false false false @@ -70,9 +69,7 @@ 8.21.25188.17001 runtime - - 13.0.3 - + diff --git a/Grasshopper/SAM.Core.Grasshopper.Topologic/Kernel/AssemblyInfo.cs b/Grasshopper/SAM.Core.Grasshopper.Topologic/Kernel/AssemblyInfo.cs index bf2e417..0aaee5f 100644 --- a/Grasshopper/SAM.Core.Grasshopper.Topologic/Kernel/AssemblyInfo.cs +++ b/Grasshopper/SAM.Core.Grasshopper.Topologic/Kernel/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System; using System.Drawing; diff --git a/Grasshopper/SAM.Core.Grasshopper.Topologic/Properties/AssemblyInfo.cs b/Grasshopper/SAM.Core.Grasshopper.Topologic/Properties/AssemblyInfo.cs index 08fb1d4..f3ba277 100644 --- a/Grasshopper/SAM.Core.Grasshopper.Topologic/Properties/AssemblyInfo.cs +++ b/Grasshopper/SAM.Core.Grasshopper.Topologic/Properties/AssemblyInfo.cs @@ -55,6 +55,3 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Grasshopper/SAM.Core.Grasshopper.Topologic/SAM.Core.Grasshopper.Topologic.csproj b/Grasshopper/SAM.Core.Grasshopper.Topologic/SAM.Core.Grasshopper.Topologic.csproj index 5782f21..3fa508b 100644 --- a/Grasshopper/SAM.Core.Grasshopper.Topologic/SAM.Core.Grasshopper.Topologic.csproj +++ b/Grasshopper/SAM.Core.Grasshopper.Topologic/SAM.Core.Grasshopper.Topologic.csproj @@ -10,7 +10,6 @@ false true true - false false false @@ -51,9 +50,7 @@ runtime - - 13.0.3 - + diff --git a/Grasshopper/SAM.Geometry.Grasshopper.Topologic/Kernel/AssemblyInfo.cs b/Grasshopper/SAM.Geometry.Grasshopper.Topologic/Kernel/AssemblyInfo.cs index e0893a4..ef91e90 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper.Topologic/Kernel/AssemblyInfo.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper.Topologic/Kernel/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System; using System.Drawing; diff --git a/Grasshopper/SAM.Geometry.Grasshopper.Topologic/Properties/AssemblyInfo.cs b/Grasshopper/SAM.Geometry.Grasshopper.Topologic/Properties/AssemblyInfo.cs index bcdd67f..c080d39 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper.Topologic/Properties/AssemblyInfo.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper.Topologic/Properties/AssemblyInfo.cs @@ -55,6 +55,3 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Grasshopper/SAM.Geometry.Grasshopper.Topologic/SAM.Geometry.Grasshopper.Topologic.csproj b/Grasshopper/SAM.Geometry.Grasshopper.Topologic/SAM.Geometry.Grasshopper.Topologic.csproj index 7f65815..566ba8c 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper.Topologic/SAM.Geometry.Grasshopper.Topologic.csproj +++ b/Grasshopper/SAM.Geometry.Grasshopper.Topologic/SAM.Geometry.Grasshopper.Topologic.csproj @@ -10,7 +10,6 @@ false true true - false false false @@ -58,9 +57,7 @@ 8.21.25188.17001 runtime - - 13.0.3 - + diff --git a/SAM_Topologic/SAM.Analytical.Topologic/Properties/AssemblyInfo.cs b/SAM_Topologic/SAM.Analytical.Topologic/Properties/AssemblyInfo.cs index 2c3e0d1..ca82c5a 100644 --- a/SAM_Topologic/SAM.Analytical.Topologic/Properties/AssemblyInfo.cs +++ b/SAM_Topologic/SAM.Analytical.Topologic/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/SAM_Topologic/SAM.Analytical.Topologic/SAM.Analytical.Topologic.csproj b/SAM_Topologic/SAM.Analytical.Topologic/SAM.Analytical.Topologic.csproj index b7d7db6..5890e8f 100644 --- a/SAM_Topologic/SAM.Analytical.Topologic/SAM.Analytical.Topologic.csproj +++ b/SAM_Topologic/SAM.Analytical.Topologic/SAM.Analytical.Topologic.csproj @@ -2,7 +2,6 @@ netstandard2.0 Library - False false false false @@ -49,7 +48,7 @@ - + Copy /Y "$(SolutionDir)references\TopologicCore.dll" "$(SolutionDir)build\TopologicCore.dll" @@ -57,7 +56,5 @@ Copy /Y "$(SolutionDir)references\TK*.dll" "$(SolutionDir)build\TK*.dll"SAM_Topologic SAM_Topologic Copyright © 2019 - 1.0.0.0 - 1.0.0.0 \ No newline at end of file diff --git a/SAM_Topologic/SAM.Core.Topologic/Properties/AssemblyInfo.cs b/SAM_Topologic/SAM.Core.Topologic/Properties/AssemblyInfo.cs index 1aceea8..e9218cf 100644 --- a/SAM_Topologic/SAM.Core.Topologic/Properties/AssemblyInfo.cs +++ b/SAM_Topologic/SAM.Core.Topologic/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -/* +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +/* * This file is part of the Sustaiable Analytical Model (SAM) * Copyright (c) 2020, the respective contributors. All rights reserved. * diff --git a/SAM_Topologic/SAM.Core.Topologic/SAM.Core.Topologic.csproj b/SAM_Topologic/SAM.Core.Topologic/SAM.Core.Topologic.csproj index 52334f4..d4494b0 100644 --- a/SAM_Topologic/SAM.Core.Topologic/SAM.Core.Topologic.csproj +++ b/SAM_Topologic/SAM.Core.Topologic/SAM.Core.Topologic.csproj @@ -2,7 +2,6 @@ netstandard2.0 Library - False false false false @@ -33,7 +32,7 @@ - + Copy /Y "$(SolutionDir)references\TopologicCore.dll" "$(SolutionDir)build\TopologicCore.dll" @@ -41,8 +40,6 @@ Copy /Y "$(SolutionDir)references\TK*.dll" "$(SolutionDir)build\TK*.dll" Copy /Y "$(SolutionDir)references\tbb*.dll" "$(SolutionDir)build\tbb*.dll" SAM_Topologic SAM_Topologic - Copyright © 2020 - 1.0.%2a - 1.0.%2a + Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors \ No newline at end of file diff --git a/SAM_Topologic/SAM.Geometry.Topologic/Properties/AssemblyInfo.cs b/SAM_Topologic/SAM.Geometry.Topologic/Properties/AssemblyInfo.cs index 4ec2925..0ddc3bc 100644 --- a/SAM_Topologic/SAM.Geometry.Topologic/Properties/AssemblyInfo.cs +++ b/SAM_Topologic/SAM.Geometry.Topologic/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -/* +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +/* * This file is part of the Sustaiable Analytical Model (SAM) * Copyright (c) 2020, the respective contributors. All rights reserved. * diff --git a/SAM_Topologic/SAM.Geometry.Topologic/SAM.Geometry.Topologic.csproj b/SAM_Topologic/SAM.Geometry.Topologic/SAM.Geometry.Topologic.csproj index 200ef4e..95952aa 100644 --- a/SAM_Topologic/SAM.Geometry.Topologic/SAM.Geometry.Topologic.csproj +++ b/SAM_Topologic/SAM.Geometry.Topologic/SAM.Geometry.Topologic.csproj @@ -2,7 +2,6 @@ netstandard2.0 Library - False false false false @@ -28,15 +27,13 @@ - + - Copy /Y "$(SolutionDir)references\TopologicCore.dll" "$(SolutionDir)build\TopologicCore.dll" -Copy /Y "$(SolutionDir)references\TK*.dll" "$(SolutionDir)build\TK*.dll" + robocopy "$(SolutionDir)references" "$(SolutionDir)build" TopologicCore.dll /R:5 /W:2 & IF %ERRORLEVEL% LEQ 7 SET ERRORLEVEL=0 +robocopy "$(SolutionDir)references" "$(SolutionDir)build" TK*.dll /R:5 /W:2 & IF %ERRORLEVEL% LEQ 7 SET ERRORLEVEL=0 SAM_Topologic SAM_Topologic - Copyright © 2020 - 1.0.%2a - 1.0.%2a + Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors \ No newline at end of file