Skip to content

Commit 7881dfc

Browse files
committed
Add azure-pipelines and e2e tests to vcpkg-tool.
1 parent ac41933 commit 7881dfc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1943
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.vscode

Generate-SpdxLicenseList.ps1

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<#
2+
#>
3+
[CmdletBinding(PositionalBinding=$False)]
4+
Param(
5+
[Parameter(Mandatory=$True)]
6+
[string]$Commit,
7+
8+
[Parameter()]
9+
[string]$GithubRepository = "spdx/license-list-data",
10+
11+
[Parameter()]
12+
[string]$LicensesOutFile = "$PSScriptRoot/src/vcpkg/spdx-licenses.inc",
13+
14+
[Parameter()]
15+
[string]$ExceptionsOutFile = "$PSScriptRoot/src/vcpkg/spdx-exceptions.inc"
16+
)
17+
18+
function Transform-JsonFile {
19+
[CmdletBinding()]
20+
Param(
21+
[string]$Uri,
22+
[string]$OutFile,
23+
[string]$OuterName,
24+
[string]$Id
25+
)
26+
27+
$req = Invoke-WebRequest -Uri $Uri
28+
29+
if ($req.StatusCode -ne 200)
30+
{
31+
Write-Error "Failed to GET $Uri"
32+
throw
33+
}
34+
35+
$json = $req.Content | ConvertFrom-Json -Depth 10
36+
Write-Verbose "Writing output to $OutFile"
37+
38+
$fileContent = @(
39+
"// Data downloaded from $Uri",
40+
"// Generated by scripts/Generate-SpdxLicenseList.ps1",
41+
"{")
42+
$json.$OuterName | ForEach-Object {
43+
$fileContent += " `"$($_.$Id)`","
44+
}
45+
$fileContent += "}"
46+
47+
$fileContent -join "`n" | Out-File -FilePath $OutFile -Encoding 'utf8'
48+
}
49+
50+
$baseUrl = "https://raw.githubusercontent.com/$GithubRepository/$Commit/json"
51+
Write-Verbose "Getting json files from $baseUrl"
52+
53+
Transform-JsonFile `
54+
-Uri "$baseUrl/licenses.json" `
55+
-OutFile $LicensesOutFile `
56+
-OuterName 'licenses' `
57+
-Id 'licenseId'
58+
59+
Transform-JsonFile `
60+
-Uri "$baseUrl/exceptions.json" `
61+
-OutFile $ExceptionsOutFile `
62+
-OuterName 'exceptions' `
63+
-Id 'licenseExceptionId'

azure-pipelines/Create-PRDiff.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[CmdletBinding(PositionalBinding=$False)]
2+
Param(
3+
[Parameter(Mandatory=$True)]
4+
[String]$DiffFile
5+
)
6+
7+
Start-Process -FilePath 'git' -ArgumentList 'diff' `
8+
-NoNewWindow -Wait `
9+
-RedirectStandardOutput $DiffFile
10+
if (0 -ne (Get-Item -LiteralPath $DiffFile).Length)
11+
{
12+
$msg = @(
13+
'The formatting of the files in the repo were not what we expected.',
14+
'Please access the diff from format.diff in the build artifacts,'
15+
'and apply the patch with `git apply`'
16+
)
17+
Write-Error ($msg -join "`n")
18+
throw
19+
}

azure-pipelines/Format-CxxCode.ps1

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[CmdletBinding()]
2+
$Root = Resolve-Path -LiteralPath "$PSScriptRoot/.."
3+
4+
$clangFormat = Get-Command 'clang-format' -ErrorAction 'SilentlyContinue'
5+
if ($null -ne $clangFormat)
6+
{
7+
$clangFormat = $clangFormat.Source
8+
}
9+
10+
if ($IsWindows)
11+
{
12+
if ([String]::IsNullOrEmpty($clangFormat) -or -not (Test-Path $clangFormat))
13+
{
14+
$clangFormat = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\x64\bin\clang-format.exe'
15+
}
16+
if (-not (Test-Path $clangFormat))
17+
{
18+
$clangFormat = 'C:\Program Files\LLVM\bin\clang-format.exe'
19+
}
20+
}
21+
22+
if ([String]::IsNullOrEmpty($clangFormat) -or -not (Test-Path $clangFormat))
23+
{
24+
Write-Error 'clang-format not found; is it installed?'
25+
throw
26+
}
27+
28+
$files = Get-ChildItem -Recurse -LiteralPath "$Root/src" -Filter '*.cpp'
29+
$files += Get-ChildItem -Recurse -LiteralPath "$Root/src" -Filter '*.c'
30+
$files += Get-ChildItem -Recurse -LiteralPath "$Root/include/vcpkg" -Filter '*.h'
31+
$files += Get-ChildItem -Recurse -LiteralPath "$Root/include/vcpkg-test" -Filter '*.h'
32+
$files += Get-Item "$Root/include/pch.h"
33+
$fileNames = $files.FullName
34+
35+
& $clangFormat -style=file -i @fileNames
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
set(VCPKG_TARGET_ARCHITECTURE x64)
2+
set(VCPKG_CRT_LINKAGE dynamic)
3+
set(VCPKG_LIBRARY_LINKAGE dynamic)
4+
5+
set(VCPKG_ENV_PASSTHROUGH _VCPKG_TEST_TRACKED _VCPKG_TEST_TRACKED2)
6+
set(VCPKG_ENV_PASSTHROUGH_UNTRACKED _VCPKG_TEST_UNTRACKED _VCPKG_TEST_UNTRACKED2)
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>16.0</VCProjectVersion>
23+
<ProjectGuid>{5AFB7AF5-D8FC-4A86-B0D2-3BBD039ED03A}</ProjectGuid>
24+
<RootNamespace>Project1</RootNamespace>
25+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
26+
</PropertyGroup>
27+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
28+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
29+
<ConfigurationType>Application</ConfigurationType>
30+
<UseDebugLibraries>true</UseDebugLibraries>
31+
<PlatformToolset>v142</PlatformToolset>
32+
<CharacterSet>Unicode</CharacterSet>
33+
</PropertyGroup>
34+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
35+
<ConfigurationType>Application</ConfigurationType>
36+
<UseDebugLibraries>false</UseDebugLibraries>
37+
<PlatformToolset>v142</PlatformToolset>
38+
<WholeProgramOptimization>true</WholeProgramOptimization>
39+
<CharacterSet>Unicode</CharacterSet>
40+
</PropertyGroup>
41+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
42+
<ConfigurationType>Application</ConfigurationType>
43+
<UseDebugLibraries>true</UseDebugLibraries>
44+
<PlatformToolset>v142</PlatformToolset>
45+
<CharacterSet>Unicode</CharacterSet>
46+
</PropertyGroup>
47+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
48+
<ConfigurationType>Application</ConfigurationType>
49+
<UseDebugLibraries>false</UseDebugLibraries>
50+
<PlatformToolset>v142</PlatformToolset>
51+
<WholeProgramOptimization>true</WholeProgramOptimization>
52+
<CharacterSet>Unicode</CharacterSet>
53+
</PropertyGroup>
54+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
55+
<ImportGroup Label="ExtensionSettings">
56+
</ImportGroup>
57+
<ImportGroup Label="Shared">
58+
</ImportGroup>
59+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
60+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
61+
</ImportGroup>
62+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
63+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
64+
</ImportGroup>
65+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
66+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
67+
</ImportGroup>
68+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
69+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
70+
</ImportGroup>
71+
<PropertyGroup Label="UserMacros" />
72+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
73+
<LinkIncremental>true</LinkIncremental>
74+
</PropertyGroup>
75+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
76+
<LinkIncremental>true</LinkIncremental>
77+
</PropertyGroup>
78+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
79+
<LinkIncremental>false</LinkIncremental>
80+
</PropertyGroup>
81+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
82+
<LinkIncremental>false</LinkIncremental>
83+
</PropertyGroup>
84+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
85+
<ClCompile>
86+
<WarningLevel>Level3</WarningLevel>
87+
<SDLCheck>true</SDLCheck>
88+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
89+
<ConformanceMode>true</ConformanceMode>
90+
</ClCompile>
91+
<Link>
92+
<SubSystem>Console</SubSystem>
93+
<GenerateDebugInformation>true</GenerateDebugInformation>
94+
</Link>
95+
</ItemDefinitionGroup>
96+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
97+
<ClCompile>
98+
<WarningLevel>Level3</WarningLevel>
99+
<SDLCheck>true</SDLCheck>
100+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
101+
<ConformanceMode>true</ConformanceMode>
102+
</ClCompile>
103+
<Link>
104+
<SubSystem>Console</SubSystem>
105+
<GenerateDebugInformation>true</GenerateDebugInformation>
106+
</Link>
107+
</ItemDefinitionGroup>
108+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
109+
<ClCompile>
110+
<WarningLevel>Level3</WarningLevel>
111+
<FunctionLevelLinking>true</FunctionLevelLinking>
112+
<IntrinsicFunctions>true</IntrinsicFunctions>
113+
<SDLCheck>true</SDLCheck>
114+
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
115+
<ConformanceMode>true</ConformanceMode>
116+
</ClCompile>
117+
<Link>
118+
<SubSystem>Console</SubSystem>
119+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
120+
<OptimizeReferences>true</OptimizeReferences>
121+
<GenerateDebugInformation>true</GenerateDebugInformation>
122+
</Link>
123+
</ItemDefinitionGroup>
124+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
125+
<ClCompile>
126+
<WarningLevel>Level3</WarningLevel>
127+
<FunctionLevelLinking>true</FunctionLevelLinking>
128+
<IntrinsicFunctions>true</IntrinsicFunctions>
129+
<SDLCheck>true</SDLCheck>
130+
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
131+
<ConformanceMode>true</ConformanceMode>
132+
</ClCompile>
133+
<Link>
134+
<SubSystem>Console</SubSystem>
135+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
136+
<OptimizeReferences>true</OptimizeReferences>
137+
<GenerateDebugInformation>true</GenerateDebugInformation>
138+
</Link>
139+
</ItemDefinitionGroup>
140+
<ItemGroup>
141+
<ClCompile Include="Source.cpp" />
142+
</ItemGroup>
143+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
144+
<Import Project="..\..\buildsystems\msbuild\vcpkg.targets" />
145+
</Project>

0 commit comments

Comments
 (0)