Skip to content

Commit

Permalink
Add azure-pipelines and e2e tests to vcpkg-tool.
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyONeal committed Feb 3, 2021
1 parent ac41933 commit 7881dfc
Show file tree
Hide file tree
Showing 44 changed files with 1,943 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.vscode
63 changes: 63 additions & 0 deletions Generate-SpdxLicenseList.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<#
#>
[CmdletBinding(PositionalBinding=$False)]
Param(
[Parameter(Mandatory=$True)]
[string]$Commit,

[Parameter()]
[string]$GithubRepository = "spdx/license-list-data",

[Parameter()]
[string]$LicensesOutFile = "$PSScriptRoot/src/vcpkg/spdx-licenses.inc",

[Parameter()]
[string]$ExceptionsOutFile = "$PSScriptRoot/src/vcpkg/spdx-exceptions.inc"
)

function Transform-JsonFile {
[CmdletBinding()]
Param(
[string]$Uri,
[string]$OutFile,
[string]$OuterName,
[string]$Id
)

$req = Invoke-WebRequest -Uri $Uri

if ($req.StatusCode -ne 200)
{
Write-Error "Failed to GET $Uri"
throw
}

$json = $req.Content | ConvertFrom-Json -Depth 10
Write-Verbose "Writing output to $OutFile"

$fileContent = @(
"// Data downloaded from $Uri",
"// Generated by scripts/Generate-SpdxLicenseList.ps1",
"{")
$json.$OuterName | ForEach-Object {
$fileContent += " `"$($_.$Id)`","
}
$fileContent += "}"

$fileContent -join "`n" | Out-File -FilePath $OutFile -Encoding 'utf8'
}

$baseUrl = "https://raw.githubusercontent.com/$GithubRepository/$Commit/json"
Write-Verbose "Getting json files from $baseUrl"

Transform-JsonFile `
-Uri "$baseUrl/licenses.json" `
-OutFile $LicensesOutFile `
-OuterName 'licenses' `
-Id 'licenseId'

Transform-JsonFile `
-Uri "$baseUrl/exceptions.json" `
-OutFile $ExceptionsOutFile `
-OuterName 'exceptions' `
-Id 'licenseExceptionId'
19 changes: 19 additions & 0 deletions azure-pipelines/Create-PRDiff.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[CmdletBinding(PositionalBinding=$False)]
Param(
[Parameter(Mandatory=$True)]
[String]$DiffFile
)

Start-Process -FilePath 'git' -ArgumentList 'diff' `
-NoNewWindow -Wait `
-RedirectStandardOutput $DiffFile
if (0 -ne (Get-Item -LiteralPath $DiffFile).Length)
{
$msg = @(
'The formatting of the files in the repo were not what we expected.',
'Please access the diff from format.diff in the build artifacts,'
'and apply the patch with `git apply`'
)
Write-Error ($msg -join "`n")
throw
}
35 changes: 35 additions & 0 deletions azure-pipelines/Format-CxxCode.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[CmdletBinding()]
$Root = Resolve-Path -LiteralPath "$PSScriptRoot/.."

$clangFormat = Get-Command 'clang-format' -ErrorAction 'SilentlyContinue'
if ($null -ne $clangFormat)
{
$clangFormat = $clangFormat.Source
}

if ($IsWindows)
{
if ([String]::IsNullOrEmpty($clangFormat) -or -not (Test-Path $clangFormat))
{
$clangFormat = 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\x64\bin\clang-format.exe'
}
if (-not (Test-Path $clangFormat))
{
$clangFormat = 'C:\Program Files\LLVM\bin\clang-format.exe'
}
}

if ([String]::IsNullOrEmpty($clangFormat) -or -not (Test-Path $clangFormat))
{
Write-Error 'clang-format not found; is it installed?'
throw
}

$files = Get-ChildItem -Recurse -LiteralPath "$Root/src" -Filter '*.cpp'
$files += Get-ChildItem -Recurse -LiteralPath "$Root/src" -Filter '*.c'
$files += Get-ChildItem -Recurse -LiteralPath "$Root/include/vcpkg" -Filter '*.h'
$files += Get-ChildItem -Recurse -LiteralPath "$Root/include/vcpkg-test" -Filter '*.h'
$files += Get-Item "$Root/include/pch.h"
$fileNames = $files.FullName

& $clangFormat -style=file -i @fileNames
6 changes: 6 additions & 0 deletions azure-pipelines/e2e_ports/env-passthrough/passthrough.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)

set(VCPKG_ENV_PASSTHROUGH _VCPKG_TEST_TRACKED _VCPKG_TEST_TRACKED2)
set(VCPKG_ENV_PASSTHROUGH_UNTRACKED _VCPKG_TEST_UNTRACKED _VCPKG_TEST_UNTRACKED2)
145 changes: 145 additions & 0 deletions azure-pipelines/e2e_ports/integrate-install/NoProps.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>{5AFB7AF5-D8FC-4A86-B0D2-3BBD039ED03A}</ProjectGuid>
<RootNamespace>Project1</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Source.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="..\..\buildsystems\msbuild\vcpkg.targets" />
</Project>
Loading

0 comments on commit 7881dfc

Please sign in to comment.