vcpkg/ports/aws-sdk-cpp/generateFeatures.ps1
Ahmed Yarub Hani Al Nuaimi c1c253fabc
[aws-sdk-cpp] [openssl] Fix iOS build (#17338)
* Add curl try_compile parameters
Don't set compiler when compiling for iOS

* Update OpenSSL and AWS SDK for C++ port versions

* [vcpkg baseline][marble] Disable find I18n

* update version record

* Update versions/a-/aws-sdk-cpp.json

* Update versions/o-/openssl.json

* Fix port-versions after merging master branch

* Update versions/a-/aws-sdk-cpp.json

* Update versions/o-/openssl.json

* Fix merge conflicts

* Merge master branch

* Refactor OpenSSL's build script

* Refactor OpenSSL's build script

* Fix version

* Fix WASM build

* Fix version

* Fix disabled flags

* Disable treating warnings as errors

* Disable treating warnings as errors

* Fix hashes

* fix indentation

* [aws-sdk-cpp] use the powershell file to generate

* Fix versions after merging

* Fix versions after merging

Co-authored-by: Ahmed Yarub Hani Al Nuaimi <ahmed.alnuaimi@zwift.com>
Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
2021-06-07 12:05:29 -07:00

74 lines
2.6 KiB
PowerShell

[CmdletBinding()]
param(
[Parameter(Mandatory=$true)][string]$SourcesRef,
[Parameter(Mandatory=$false)][string]$PortDirectory = $PSScriptRoot,
[Parameter(Mandatory=$false)][string]$vcpkg = "$PSScriptRoot/../../vcpkg"
)
$ErrorActionPreference = "Stop"
$ManifestIn = "$PortDirectory/vcpkg.in.json"
$ManifestOut = "$PortDirectory/vcpkg.json"
$CMakeFragmentFile = "$PortDirectory/compute_build_only.cmake"
$ExtractedSources = "${env:TEMP}/aws-sdk-cpp-generateFeatures-$SourcesRef"
if (-not (Test-Path $ExtractedSources)) {
if (Test-Path "$ExtractedSources.tmp") {
Remove-Item -Force "$ExtractedSources.tmp"
}
git clone "https://github.com/aws/aws-sdk-cpp" "$ExtractedSources.tmp" | Out-Host
git -c "$ExtractedSources.tmp" checkout $SourcesRef
Move-Item "$ExtractedSources.tmp" "$ExtractedSources"
}
Write-Host "Using sources directory: $ExtractedSources"
$subfolders = Get-Item $ExtractedSources\aws-cpp-sdk-*
$manifest = Get-Content $ManifestIn | ConvertFrom-Json
$manifest | Add-Member `
-NotePropertyName '$note' `
-NotePropertyValue 'Automatically generated by generateFeatures.ps1'
$manifest | Add-Member -NotePropertyName 'features' -NotePropertyValue @{}
$cmakefragmenttext = @("# Automatically generated by generateFeatures.ps1")
function GetDescription($dir, $modulename)
{
if (Test-Path "$dir\CMakeLists.txt")
{
$descs = @(Select-String -Path "$dir\CMakeLists.txt" -Pattern "`"C\+\+ SDK for the AWS [^`"]*`"")
if ($descs.count -eq 1) {
$desc = $descs[0].Matches.Value -replace "`"",""
"$desc"
}
else { "C++ SDK for the AWS $modulename service" }
}
else { "C++ SDK for the AWS $modulename service" }
}
foreach ($subfolder in $subfolders)
{
$modulename = $subfolder.name -replace "^aws-cpp-sdk-",""
if ($modulename -match "-tests`$") { continue }
if ($modulename -match "-sample`$") { continue }
if ($modulename -eq "core") { continue }
$lowermodulename = $modulename.ToLower()
$manifest.features.Add("$lowermodulename", @{ description=(GetDescription $subfolder $modulename) })
$cmakefragmenttext += @(
"if(`"$lowermodulename`" IN_LIST FEATURES)",
" list(APPEND BUILD_ONLY $modulename)",
"endif()"
)
}
[IO.File]::WriteAllText($ManifestOut, (ConvertTo-Json -Depth 5 -InputObject $manifest))
Write-Verbose ($cmakefragmenttext -join "`n")
[IO.File]::WriteAllText($CMakeFragmentFile, ($cmakefragmenttext -join "`n") +"`n")
& $vcpkg format-manifest --feature-flags=-manifests $ManifestOut