Skip to content

Commit

Permalink
Merge pull request #1099 from dorssel/gitversion
Browse files Browse the repository at this point in the history
Refactor GitVersion
  • Loading branch information
dorssel authored Dec 26, 2024
2 parents b1232cd + 7a419cd commit b8bc86b
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 103 deletions.
7 changes: 7 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
"trx2junit"
],
"rollForward": false
},
"gitversion.tool": {
"version": "6.1.0",
"commands": [
"dotnet-gitversion"
],
"rollForward": false
}
}
}
4 changes: 3 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ jobs:
uses: actions/setup-dotnet@v4

- name: Install dependencies
run: dotnet restore
run: |
dotnet tool restore
dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
Expand Down
40 changes: 20 additions & 20 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2021 Frans van Dorsselaer
Expand All @@ -7,37 +7,39 @@ SPDX-License-Identifier: GPL-3.0-only
<Project>

<PropertyGroup>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' != 'true'">false</ContinuousIntegrationBuild>

<!-- Use the latest .NET SDK -->
<!-- This product requires Windows 10 (Windows Server 2019) or higher -->
<MainTargetFramework>net9.0-windows10.0.17763</MainTargetFramework>
<!-- This product only supports x64 (the only architecture supported by VBoxUsb) -->
<Platforms>x64</Platforms>
</PropertyGroup>

<!-- Sane defaults; override in project where needed -->

<PropertyGroup>
<!-- This allows building on Linux; however, building the installer requires Windows -->
<EnableWindowsTargeting>true</EnableWindowsTargeting>

<!-- Use the latest C# language standard -->
<LangVersion>13.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>

<!-- Be very strict -->
<WarningLevel>9999</WarningLevel>
<Nullable>enable</Nullable>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AnalysisLevel>latest-all</AnalysisLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CheckForOverflowUnderflow Condition="'$(Configuration)' == 'Debug'">true</CheckForOverflowUnderflow>

<!-- Common defaults -->
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<InvariantGlobalization>true</InvariantGlobalization>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
<SelfContained>false</SelfContained>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
<IsTrimmable Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">true</IsTrimmable>
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>
<GenerateDependencyFile>false</GenerateDependencyFile>
<!--
See https://github.com/dotnet/roslyn/issues/41640
Expand All @@ -47,27 +49,25 @@ SPDX-License-Identifier: GPL-3.0-only
<NoWarn>CS1591</NoWarn>

<!-- Deterministic builds -->
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<RestoreLockedMode Condition="'$(GITHUB_ACTIONS)' == 'true'">true</RestoreLockedMode>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>

<!-- Assembly metadata -->
<Product>usbipd-win</Product>
<Company>Frans van Dorsselaer</Company>
<Copyright>Copyright (C) $([System.DateTime]::UtcNow.ToString("yyyy")) $(Company)</Copyright>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" PrivateAssets="all" />
<Compile Include="$(MSBuildThisFileDirectory)Fake_GitVersionInformation.cs" Condition=" '$(MSBuildRuntimeType)' != 'Core' " />
<PackageReference Include="Dorssel.GitVersion.MsBuild" PrivateAssets="all" />
</ItemGroup>

<PropertyGroup Condition=" '$(MSBuildRuntimeType)' != 'Core' ">
<GitVersion_FullSemVer>0.9.99+999</GitVersion_FullSemVer>
<GitVersion_MajorMinorPatch>0.9.99</GitVersion_MajorMinorPatch>
<GitVersion_Major>0</GitVersion_Major>
<GitVersion_Minor>9</GitVersion_Minor>
<GitVersion_Patch>99</GitVersion_Patch>
</PropertyGroup>
<Target Name="SetCopyright" AfterTargets="GetVersion">
<PropertyGroup>
<!-- For deterministic builds, use the commit year as the copyright year. -->
<CopyrightYear Condition="$(ContinuousIntegrationBuild)">$([System.DateTime]::Parse($(GitVersion_CommitDate)).ToString("yyyy"))</CopyrightYear>
<CopyrightYear Condition="!$(ContinuousIntegrationBuild)">$([System.DateTime]::UtcNow.ToString("yyyy"))</CopyrightYear>
<Copyright>Copyright (C) $(CopyrightYear) $(Company)</Copyright>
</PropertyGroup>
</Target>

</Project>
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SPDX-License-Identifier: GPL-3.0-only
<Project>
<ItemGroup>
<!-- all -->
<PackageVersion Include="GitVersion.MsBuild" Version="6.0.5" />
<PackageVersion Include="Dorssel.GitVersion.MsBuild" Version="1.1.0" />
<!-- Usbipd -->
<PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.0" />
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.106" />
Expand Down
46 changes: 0 additions & 46 deletions Fake_GitVersionInformation.cs

This file was deleted.

6 changes: 0 additions & 6 deletions Installer/Installer.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ SPDX-License-Identifier: GPL-3.0-only
<PackageReference Include="WixToolset.UI.wixext" />
<PackageReference Include="WixToolset.Util.wixext" />
</ItemGroup>
<ItemGroup>
<Compile Remove="..\Fake_GitVersionInformation.cs" Condition=" '$(MSBuildRuntimeType)' != 'Core' " />
</ItemGroup>
<Target Name="SetTarget" AfterTargets="GetVersion">
<!--
Now that we have determined the version, augment the OutputName to include the version number.
Expand Down Expand Up @@ -52,9 +49,6 @@ SPDX-License-Identifier: GPL-3.0-only
<CreateProperty Value="$(DefineConstants);ProductCode=EA1D5623-E6A7-4E4A-9259-E39722$([System.Byte]::Parse($(GitVersion_Major)).ToString(X2))$([System.Byte]::Parse($(GitVersion_Minor)).ToString(X2))$([System.Byte]::Parse($(GitVersion_Patch)).ToString(X2))">
<Output TaskParameter="Value" PropertyName="DefineConstants" />
</CreateProperty>
<CreateProperty Value="$(DefineConstants);GitVersion_MajorMinorPatch=$(GitVersion_MajorMinorPatch)" Condition=" '$(MSBuildRuntimeType)' != 'Core' ">
<Output TaskParameter="Value" PropertyName="DefineConstants" />
</CreateProperty>
</Target>
<Target Name="AssumePublishedDependencies" BeforeTargets="BeforeBuild">
<Message Importance="high" Text="Making installer for (assumed) pre-published Usbipd and Usbipd.PowerShell" />
Expand Down
8 changes: 4 additions & 4 deletions Installer/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"version": 2,
"dependencies": {
"native,Version=v0.0": {
"GitVersion.MsBuild": {
"Dorssel.GitVersion.MsBuild": {
"type": "Direct",
"requested": "[6.0.5, )",
"resolved": "6.0.5",
"contentHash": "vjqDQVrYXbuokLtp5OryzvumVDF9THjpAiURAehKWEe2PEkxEzOQuedFdiSf9wChL6nxCRrL+rNZ5VhcDf6xYQ=="
"requested": "[1.1.0, )",
"resolved": "1.1.0",
"contentHash": "oabDrUuI3t6viTgMJPb6M6fYYHZBFkHG5QPNPJvIQayKi2LhEgIEeiyfyUKr1RQrr1imDEI4z8VOgEUndfzVnw=="
},
"WixToolset.Firewall.wixext": {
"type": "Direct",
Expand Down
8 changes: 4 additions & 4 deletions UnitTests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"version": 2,
"dependencies": {
"net9.0-windows10.0.17763": {
"GitVersion.MsBuild": {
"Dorssel.GitVersion.MsBuild": {
"type": "Direct",
"requested": "[6.0.5, )",
"resolved": "6.0.5",
"contentHash": "vjqDQVrYXbuokLtp5OryzvumVDF9THjpAiURAehKWEe2PEkxEzOQuedFdiSf9wChL6nxCRrL+rNZ5VhcDf6xYQ=="
"requested": "[1.1.0, )",
"resolved": "1.1.0",
"contentHash": "oabDrUuI3t6viTgMJPb6M6fYYHZBFkHG5QPNPJvIQayKi2LhEgIEeiyfyUKr1RQrr1imDEI4z8VOgEUndfzVnw=="
},
"Microsoft.NET.Test.Sdk": {
"type": "Direct",
Expand Down
8 changes: 4 additions & 4 deletions UsbIds/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"version": 2,
"dependencies": {
".NETStandard,Version=v2.0": {
"GitVersion.MsBuild": {
"Dorssel.GitVersion.MsBuild": {
"type": "Direct",
"requested": "[6.0.5, )",
"resolved": "6.0.5",
"contentHash": "vjqDQVrYXbuokLtp5OryzvumVDF9THjpAiURAehKWEe2PEkxEzOQuedFdiSf9wChL6nxCRrL+rNZ5VhcDf6xYQ=="
"requested": "[1.1.0, )",
"resolved": "1.1.0",
"contentHash": "oabDrUuI3t6viTgMJPb6M6fYYHZBFkHG5QPNPJvIQayKi2LhEgIEeiyfyUKr1RQrr1imDEI4z8VOgEUndfzVnw=="
},
"Microsoft.CodeAnalysis.CSharp": {
"type": "Direct",
Expand Down
22 changes: 14 additions & 8 deletions Usbipd.Automation/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"version": 2,
"dependencies": {
".NETStandard,Version=v2.0": {
"GitVersion.MsBuild": {
"Dorssel.GitVersion.MsBuild": {
"type": "Direct",
"requested": "[6.0.5, )",
"resolved": "6.0.5",
"contentHash": "vjqDQVrYXbuokLtp5OryzvumVDF9THjpAiURAehKWEe2PEkxEzOQuedFdiSf9wChL6nxCRrL+rNZ5VhcDf6xYQ=="
"requested": "[1.1.0, )",
"resolved": "1.1.0",
"contentHash": "oabDrUuI3t6viTgMJPb6M6fYYHZBFkHG5QPNPJvIQayKi2LhEgIEeiyfyUKr1RQrr1imDEI4z8VOgEUndfzVnw=="
},
"NETStandard.Library": {
"type": "Direct",
Expand All @@ -24,11 +24,17 @@
}
},
"net9.0-windows10.0.17763": {
"GitVersion.MsBuild": {
"Dorssel.GitVersion.MsBuild": {
"type": "Direct",
"requested": "[1.1.0, )",
"resolved": "1.1.0",
"contentHash": "oabDrUuI3t6viTgMJPb6M6fYYHZBFkHG5QPNPJvIQayKi2LhEgIEeiyfyUKr1RQrr1imDEI4z8VOgEUndfzVnw=="
},
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[6.0.5, )",
"resolved": "6.0.5",
"contentHash": "vjqDQVrYXbuokLtp5OryzvumVDF9THjpAiURAehKWEe2PEkxEzOQuedFdiSf9wChL6nxCRrL+rNZ5VhcDf6xYQ=="
"requested": "[9.0.0, )",
"resolved": "9.0.0",
"contentHash": "zAwp213evC3UkimtVXRb+Dlgc/40QG145nmZDtp2LO9zJJMfrp+i/87BnXN7tRXEA4liyzdFkjqG1HE8/RPb4A=="
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions Usbipd.PowerShell/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"version": 2,
"dependencies": {
".NETStandard,Version=v2.0": {
"GitVersion.MsBuild": {
"Dorssel.GitVersion.MsBuild": {
"type": "Direct",
"requested": "[6.0.5, )",
"resolved": "6.0.5",
"contentHash": "vjqDQVrYXbuokLtp5OryzvumVDF9THjpAiURAehKWEe2PEkxEzOQuedFdiSf9wChL6nxCRrL+rNZ5VhcDf6xYQ=="
"requested": "[1.1.0, )",
"resolved": "1.1.0",
"contentHash": "oabDrUuI3t6viTgMJPb6M6fYYHZBFkHG5QPNPJvIQayKi2LhEgIEeiyfyUKr1RQrr1imDEI4z8VOgEUndfzVnw=="
},
"NETStandard.Library": {
"type": "Direct",
Expand Down
1 change: 1 addition & 0 deletions Usbipd/Usbipd.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ SPDX-License-Identifier: GPL-3.0-only
<IsPublishable>true</IsPublishable>
<PublishProfile>Properties\PublishProfiles\InputForInstaller.pubxml</PublishProfile>
<PublishAot>true</PublishAot>
<CopyOutputSymbolsToPublishDirectory>false</CopyOutputSymbolsToPublishDirectory>
<OptimizationPreference>Speed</OptimizationPreference>

<AssemblyName>usbipd</AssemblyName>
Expand Down
8 changes: 4 additions & 4 deletions Usbipd/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"version": 2,
"dependencies": {
"net9.0-windows10.0.17763": {
"GitVersion.MsBuild": {
"Dorssel.GitVersion.MsBuild": {
"type": "Direct",
"requested": "[6.0.5, )",
"resolved": "6.0.5",
"contentHash": "vjqDQVrYXbuokLtp5OryzvumVDF9THjpAiURAehKWEe2PEkxEzOQuedFdiSf9wChL6nxCRrL+rNZ5VhcDf6xYQ=="
"requested": "[1.1.0, )",
"resolved": "1.1.0",
"contentHash": "oabDrUuI3t6viTgMJPb6M6fYYHZBFkHG5QPNPJvIQayKi2LhEgIEeiyfyUKr1RQrr1imDEI4z8VOgEUndfzVnw=="
},
"Microsoft.DotNet.ILCompiler": {
"type": "Direct",
Expand Down
1 change: 0 additions & 1 deletion usbipd-win.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
Fake_GitVersionInformation.cs = Fake_GitVersionInformation.cs
GitVersion.yml = GitVersion.yml
global.json = global.json
nuget.config = nuget.config
Expand Down

0 comments on commit b8bc86b

Please sign in to comment.