Centralize eBPF version to Directory.Build.props (#3893)

* Centralize eBPF version to Directory.Build.props

Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>

* Remove unused and failing builds

Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>

---------

Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Co-authored-by: Alan Jowett <alan.jowett@microsoft.com>
This commit is contained in:
Alan Jowett 2024-10-04 08:12:31 -07:00 коммит произвёл GitHub
Родитель e0b61633e0
Коммит 5068110219
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
11 изменённых файлов: 72 добавлений и 69 удалений

Просмотреть файл

@ -4,6 +4,12 @@
SPDX-License-Identifier: MIT
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" TreatAsLocalProperty="Platform">
<PropertyGroup Label="Version">
<EbpfVersion_Major>0</EbpfVersion_Major>
<EbpfVersion_Minor>20</EbpfVersion_Minor>
<EbpfVersion_Revision>0</EbpfVersion_Revision>
<EbpfVersion>$(EbpfVersion_Major).$(EbpfVersion_Minor).$(EbpfVersion_Revision)</EbpfVersion>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
@ -70,7 +76,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<ControlFlowGuard>Guard</ControlFlowGuard>
<AdditionalOptions>/ZH:SHA_256 /we4062 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(WindowsSdkDir)Include\10.0.22621.0\km;$(SolutionDir)external\ebpf-verifier\build\packages\boost\lib\native\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(WindowsSdkDir)Include\10.0.22621.0\km;$(SolutionDir)external\ebpf-verifier\build\packages\boost\lib\native\include;$(OutDir)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<CETCompat Condition="'$(Platform)'=='x64'">true</CETCompat>
@ -109,7 +115,7 @@
<!-- Add the resource to applications, dlls, and drivers except if the resource file doesn't exist-->
<ItemGroup Condition="('$(ConfigurationType)'=='Application' Or '$(ConfigurationType)'=='DynamicLibrary' Or '$(ConfigurationType)'=='Driver') And Exists('$(SolutionDir)resource\ebpf_resource.rc')">
<ResourceCompile Include="$(SolutionDir)resource\ebpf_resource.rc">
<AdditionalIncludeDirectories>$(SolutionDir)include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)include;$(OutDir)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<ItemDefinitionGroup Condition="'$(Platform)'=='x64'">

Просмотреть файл

@ -135,10 +135,8 @@ releasing process), but if you are a contributor and have been asked to do this,
```ps
PS D:\work\ebpf-for-windows> .\scripts\update-product-version.ps1 0 12 0
Updating the version number in the 'D:\work\ebpf-for-windows\scripts\..\resource\ebpf_version.h' file...
Version number updated to '0.12.0' in D:\work\ebpf-for-windows\scripts\..\resource\ebpf_version.h
Updating the version number in the 'D:\work\ebpf-for-windows\scripts\..\installer\Product.wxs' file...
Version number updated to '0.12.0' in D:\work\ebpf-for-windows\scripts\..\installer\Product.wxs
Updating the version number in the 'E:\ebpf-for-windows\scripts\..\Directory.Build.props' file...
Version number updated to '0.12.0' in E:\ebpf-for-windows\scripts\..\Directory.Build.props
Rebuilding the solution, please wait...
Regenerating the expected 'bpf2c' output...
...

Просмотреть файл

@ -797,7 +797,6 @@ Global
{21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyDebug|ARM64.ActiveCfg = Debug|x64
{21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyDebug|ARM64.Build.0 = Debug|x64
{21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyDebug|x64.ActiveCfg = Debug|x64
{21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyDebug|x64.Build.0 = Debug|x64
{21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyDebug|x86.ActiveCfg = Debug|Win32
{21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyDebug|x86.Build.0 = Debug|Win32
{21236F4F-341C-454F-B55B-C653897AB3E8}.NativeOnlyRelease|ARM64.ActiveCfg = Debug|x64
@ -2001,13 +2000,11 @@ Global
{8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyDebug|ARM64.ActiveCfg = Debug|x64
{8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyDebug|ARM64.Build.0 = Debug|x64
{8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyDebug|x64.ActiveCfg = Debug|x64
{8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyDebug|x64.Build.0 = Debug|x64
{8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyDebug|x86.ActiveCfg = Debug|Win32
{8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyDebug|x86.Build.0 = Debug|Win32
{8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyRelease|ARM64.ActiveCfg = Release|x64
{8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyRelease|ARM64.Build.0 = Release|x64
{8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyRelease|x64.ActiveCfg = Release|x64
{8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyRelease|x64.Build.0 = Release|x64
{8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyRelease|x86.ActiveCfg = Debug|Win32
{8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.NativeOnlyRelease|x86.Build.0 = Debug|Win32
{8DD6577A-CBBE-43FE-9FC3-E42CB013CC60}.Release|ARM64.ActiveCfg = Release|x64
@ -2385,13 +2382,11 @@ Global
{F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyDebug|ARM64.ActiveCfg = Debug|x64
{F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyDebug|ARM64.Build.0 = Debug|x64
{F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyDebug|x64.ActiveCfg = Debug|x64
{F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyDebug|x64.Build.0 = Debug|x64
{F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyDebug|x86.ActiveCfg = Debug|Win32
{F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyDebug|x86.Build.0 = Debug|Win32
{F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyRelease|ARM64.ActiveCfg = Release|x64
{F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyRelease|ARM64.Build.0 = Release|x64
{F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyRelease|x64.ActiveCfg = Release|x64
{F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyRelease|x64.Build.0 = Release|x64
{F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyRelease|x86.ActiveCfg = Debug|Win32
{F106D38A-AC35-4B5A-AEEE-7235E4915A72}.NativeOnlyRelease|x86.Build.0 = Debug|Win32
{F106D38A-AC35-4B5A-AEEE-7235E4915A72}.Release|ARM64.ActiveCfg = Release|x64
@ -2465,13 +2460,11 @@ Global
{E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyDebug|ARM64.ActiveCfg = Debug|x64
{E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyDebug|ARM64.Build.0 = Debug|x64
{E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyDebug|x64.ActiveCfg = Debug|x64
{E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyDebug|x64.Build.0 = Debug|x64
{E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyDebug|x86.ActiveCfg = Debug|Win32
{E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyDebug|x86.Build.0 = Debug|Win32
{E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyRelease|ARM64.ActiveCfg = Release|x64
{E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyRelease|ARM64.Build.0 = Release|x64
{E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyRelease|x64.ActiveCfg = Release|x64
{E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyRelease|x64.Build.0 = Release|x64
{E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyRelease|x86.ActiveCfg = Debug|Win32
{E619B985-44B3-4292-A585-5CD0C4315ED3}.NativeOnlyRelease|x86.Build.0 = Debug|Win32
{E619B985-44B3-4292-A585-5CD0C4315ED3}.Release|ARM64.ActiveCfg = Release|x64

Просмотреть файл

@ -6,7 +6,7 @@ SPDX-License-Identifier: MIT
<?define ProductVersion="022C44B5-8969-4B75-8DB0-73F98B1BD7DC"?>
<?define UpgradeCode="B6BCACB1-C872-4159-ABCB-43A50668056C"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:ui="http://schemas.microsoft.com/wix/UIExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="$(var.ProductVersion)" Name="eBPF for Windows" Language="1033" Version="0.20.0" Manufacturer="Microsoft" UpgradeCode="$(var.UpgradeCode)">
<Product Id="$(var.ProductVersion)" Name="eBPF for Windows" Language="1033" Version="$(var.EbpfVersion)" Manufacturer="Microsoft" UpgradeCode="$(var.UpgradeCode)">
<Package Description="eBPF for Windows" InstallerVersion="301" Compressed="yes" InstallScope="perMachine" Manufacturer="Microsoft" Platform="x64" />
<MajorUpgrade AllowSameVersionUpgrades="yes"
Disallow="yes" DisallowUpgradeErrorMessage="An older version of [ProductName] is already installed. Please remove it first."

Просмотреть файл

@ -4,6 +4,7 @@ Copyright (c) eBPF for Windows contributors
SPDX-License-Identifier: MIT
-->
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\Directory.Build.props" />
<Import Project="..\packages\wix.3.14.1\build\wix.props" Condition="Exists('..\packages\wix.3.14.1\build\wix.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -17,31 +18,34 @@ SPDX-License-Identifier: MIT
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup>
<DefineConstants>$(DefineConstants);EbpfVersion=$(EbpfVersion)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;IncludeJIT=True;IncludeVCRedist=False</DefineConstants>
<DefineConstants>$(DefineConstants);Debug;IncludeJIT=True;IncludeVCRedist=False</DefineConstants>
<SuppressValidation>True</SuppressValidation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'NativeOnlyDebug|x64' ">
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;IncludeJIT=False;IncludeVCRedist=False</DefineConstants>
<DefineConstants>$(DefineConstants);Debug;IncludeJIT=False;IncludeVCRedist=False</DefineConstants>
<SuppressValidation>True</SuppressValidation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants Condition=" '$(ReleaseJIT)' == 'True' ">IncludeJIT=True</DefineConstants>
<DefineConstants Condition=" '$(ReleaseJIT)' == 'False' OR '$(ReleaseJIT)' == '' ">IncludeJIT=False</DefineConstants>
<DefineConstants Condition=" '$(ReleaseJIT)' == 'True' ">$(DefineConstants);IncludeJIT=True</DefineConstants>
<DefineConstants Condition=" '$(ReleaseJIT)' == 'False' OR '$(ReleaseJIT)' == '' ">$(DefineConstants);IncludeJIT=False</DefineConstants>
<SuppressValidation>True</SuppressValidation>
<DefineConstants>$(DefineConstants);IncludeVCRedist=True</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'NativeOnlyRelease|x64' ">
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants Condition=" '$(ReleaseJIT)' == 'True' ">IncludeJIT=True</DefineConstants>
<DefineConstants Condition=" '$(ReleaseJIT)' == 'False' OR '$(ReleaseJIT)' == '' ">IncludeJIT=False</DefineConstants>
<DefineConstants Condition=" '$(ReleaseJIT)' == 'True' ">$(DefineConstants);IncludeJIT=True</DefineConstants>
<DefineConstants Condition=" '$(ReleaseJIT)' == 'False' OR '$(ReleaseJIT)' == '' ">$(DefineConstants);IncludeJIT=False</DefineConstants>
<SuppressValidation>True</SuppressValidation>
<DefineConstants>$(DefineConstants);IncludeVCRedist=True</DefineConstants>
</PropertyGroup>

Просмотреть файл

@ -1,13 +0,0 @@
// Copyright (c) eBPF for Windows contributors
// SPDX-License-Identifier: MIT
#define EBPF_VERSION_MAJOR 0
#define EBPF_VERSION_MINOR 20
#define EBPF_VERSION_REVISION 0
#define QUOTE(str) #str
#define EXPAND_AND_QUOTE(str) QUOTE(str)
#define EBPF_VERSION \
EXPAND_AND_QUOTE(EBPF_VERSION_MAJOR) \
"." EXPAND_AND_QUOTE(EBPF_VERSION_MINOR) "." EXPAND_AND_QUOTE(EBPF_VERSION_REVISION)

Просмотреть файл

@ -1,24 +0,0 @@
# Copyright (c) eBPF for Windows contributors
# SPDX-License-Identifier: MIT
# .SYNOPSIS
# Get the version number from the repository.
$content = Get-Content -Path "$PSScriptRoot\..\resource\ebpf_version.h" -Raw -Encoding UTF8
# Extract EBPF_VERSION_MAJOR, EBPF_VERSION_MINOR, and EBPF_VERSION_REVISION from ebpf_version.h.
$major_version_prefix = "#define EBPF_VERSION_MAJOR "
$minor_version_prefix = "#define EBPF_VERSION_MINOR "
$revision_version_prefix = "#define EBPF_VERSION_REVISION "
$content -match "$major_version_prefix(\d+)" | Out-Null
$major_version = $matches[1]
$content -match "$minor_version_prefix(\d+)" | Out-Null
$minor_version = $matches[1]
$content -match "$revision_version_prefix(\d+)" | Out-Null
$revision_version = $matches[1]
$version = "$major_version.$minor_version.$revision_version"
Write-Output $version

Просмотреть файл

@ -8,7 +8,19 @@ param ($InputFile, $OutputFile, [parameter(Mandatory=$false)]$VCToolsRedistDir,
$git_commit_id = Get-Content -Path "$PSScriptRoot\..\include\git_commit_id.h" -Raw -Encoding UTF8
$git_commit_id = $git_commit_id.Split('"')[1]
$version = &"$PSScriptRoot\Get-Version.ps1"
$content = Get-Content -path "$PSScriptRoot\..\Directory.Build.props" -Raw -Encoding UTF8
# Parse the XML content
[xml]$xml = $content
$VersionPropertyGroup = $xml.Project.PropertyGroup | Where-Object {$_.PSObject.Properties.Name -contains "Label" -and $_.Label -eq "Version"}
# Get the version number
$version = ""
$version += $VersionPropertyGroup.EbpfVersion_Major + "."
$version += $VersionPropertyGroup.EbpfVersion_Minor + "."
$version += $VersionPropertyGroup.EbpfVersion_Revision
$content = Get-Content $InputFile
$content = $content.Replace("{version}", $version)
$content = $content.Replace("{VCToolsRedistDir}", $VCToolsRedistDir)

Просмотреть файл

@ -4,6 +4,36 @@
SPDX-License-Identifier: MIT
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="FuzzerDebug|x64">
<Configuration>FuzzerDebug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="NativeOnlyDebug|x64">
<Configuration>NativeOnlyDebug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="NativeOnlyRelease|x64">
<Configuration>NativeOnlyRelease</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<Target Name="SetVersion" BeforeTargets="PreBuildEvent">
<Exec Command='
echo #define EBPF_VERSION_MAJOR $(EbpfVersion_Major) &gt; $(OutDir)ebpf_version.h
echo #define EBPF_VERSION_MINOR $(EbpfVersion_Minor) &gt;&gt; $(OutDir)ebpf_version.h
echo #define EBPF_VERSION_REVISION $(EbpfVersion_Revision) &gt;&gt; $(OutDir)ebpf_version.h
echo #define EBPF_VERSION "$(EbpfVersion)" &gt;&gt; $(OutDir)ebpf_version.h
'/>
</Target>
<ItemGroup>
<CustomBuild Include="..\deploy-ebpf.ps1.in">
<FileType>Document</FileType>

Просмотреть файл

@ -8,21 +8,18 @@ if ("$majorVersion.$minorVersion.$revisionNumber" -match '^\d+\.\d+\.\d+$') {
if (Test-Path -Path ".\ebpf-for-windows.sln") {
# Set the new version number in the ebpf_version.h file.
$ebpf_version_file = "$PSScriptRoot\..\resource\ebpf_version.h"
$ebpf_version_file = "$PSScriptRoot\..\Directory.Build.props"
Write-Host -ForegroundColor DarkGreen "Updating the version number in the '$ebpf_version_file' file..."
# Replace <EbpfVersion_Major>0</EbpfVersion_Major> with <EbpfVersion_Major>$majorVersion</EbpfVersion_Major>
$newcontent = (Get-Content $ebpf_version_file -Raw -Encoding UTF8) `
-replace '(?<=#define EBPF_VERSION_MAJOR )\d+', $majorVersion `
-replace '(?<=#define EBPF_VERSION_MINOR )\d+', $minorVersion `
-replace '(?<=#define EBPF_VERSION_REVISION )\d+', $revisionNumber
-replace '(?<=<EbpfVersion_Major>)\d+', $majorVersion `
-replace '(?<=<EbpfVersion_Minor>)\d+', $minorVersion `
-replace '(?<=<EbpfVersion_Revision>)\d+', $revisionNumber
$newcontent | Set-Content $ebpf_version_file -NoNewline
Write-Host -ForegroundColor DarkGreen "Version number updated to '$majorVersion.$minorVersion.$revisionNumber' in $ebpf_version_file"
# Update the version number in the Wix installer file.
$ebpf_installer_file = "$PSScriptRoot\..\installer\Product.wxs"
Write-Host -ForegroundColor DarkGreen "Updating the version number in the '$ebpf_installer_file' file..."
(Get-Content $ebpf_installer_file -Raw -Encoding UTF8) -replace 'Version="\d+\.\d+\.\d+"', "Version=`"$majorVersion.$minorVersion.$revisionNumber`"" | Set-Content $ebpf_installer_file -NoNewline
Write-Host -ForegroundColor DarkGreen "Version number updated to '$majorVersion.$minorVersion.$revisionNumber' in $ebpf_installer_file"
# Rebuild the solution, so to regenerate the NuGet packages and the '.o' files with the new version number.
Write-Host -ForegroundColor DarkGreen "Rebuilding the solution, please wait..."
$res = & msbuild /m /p:Configuration=Debug /p:Platform=x64 /p:ReleaseJIT=True ebpf-for-windows.sln /t:Clean,Build

Просмотреть файл

@ -176,7 +176,7 @@ popd $(OutDir)</Command>
<ItemGroup>
<CustomBuild Include="ebpf-for-windows.nuspec.in">
<FileType>Document</FileType>
<Outputs>$(OutDir)eBPF-for-Windows.$(Platform).0.20.0.nupkg</Outputs>
<Outputs>$(OutDir)eBPF-for-Windows.$(Platform).$(EbpfVersion).nupkg</Outputs>
<Command>
powershell -NonInteractive -ExecutionPolicy Unrestricted $(SolutionDir)scripts\Set-Version.ps1 -InputFile $(SolutionDir)tools\nuget\ebpf-for-windows.nuspec.in -OutputFile $(OutDir)ebpf-for-windows.$(Platform).nuspec -Architecture $(Platform)
powershell -NonInteractive -ExecutionPolicy Unrestricted $(SolutionDir)scripts\Set-Version.ps1 -InputFile $(SolutionDir)tools\nuget\ebpf-for-windows.props.in -OutputFile $(OutDir)ebpf-for-windows.$(Platform).props -Architecture $(Platform)