Automate publishing to vcpkg (#1283)

* Disable dependency on azure-core until azure-core releases to vcpkg.

* Remove release artifact creation script and pipeline step

* Copy items from root cmake generate outputs (no need to do individual project preparation)

* Space

* Add VcpkgPortName (package port names may change in the future to include non v1 version numbers like azure-template-cpp-v2)

* Destination should be artifact name, not vcpkg port name

* Disable PR steps

* SHA512 1 -> SHA512 %SHA512%

* New release procedure

* Unblock publishing process

* Increment azure-template version

* Update branch strategy, uncomment final release of template

* Increment version to test release

* Fix remote branch checkout logic

* Increment version

* Exit successfully

* Increment version

* Increment Version

* Version Increment

* Add a difference in the output file to validate multiple runs against a target PR branch

* Enable existing PR branches in create-pull-request.yml

* Increment version

* Fix archetype-cpp-release.yml syntax

* Skip checkout instead

* Increment version

* Fix automated version incrementing

* Increment version

* Update CHANGELOG.md

* Update CHANGELOG.md date

* Revert CONTROL file

* Remove Build-Depends

* Increment version

* Output commands

* Check out branch in either branch scenario

* Increment version

* Fetch the .tar.gz file using convention, the REST API does not give the location of the .tar.gz

* Increment Version

* ToLower

* Increment

* Increment version

* Version updater should not append a new line to the end of the file contents (existing new line at the end of the file will remain, if present)

* Add azure-template2 to validate base case of shipping different packages instead of file replacement validation from previous runs

* Remove extra backtick

* Add template2 to root CMakeLists.txt

* Review feedback: Support main scenario with packages coming from different location (no new file conflicts)

* Remove file blocking link check step. This is ok because the whole azure-template2 folder will be removed after this verification is complete

* Version increment

* Make template2 install in different locations

* Increment version

* Remove azure-template2 that was used for validating publishing multiple packages

* Remove template2 from ci.yml

* Use "SHA512 1" syntax as proposed by vcpkg documentation and regex replacement

* Review feedback

* Increment version

* Quotes

* Review feedback and re-add New-ReleaseAsset.ps1
This commit is contained in:
Daniel Jurek 2021-01-13 14:35:18 -08:00 committed by GitHub
parent d7cded9feb
commit f15c823e79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 186 additions and 311 deletions

View File

@ -241,40 +241,25 @@ jobs:
Write-Host "##vso[task.setvariable variable=AZURE_SDK_VERSION]$version"
displayName: Create package info JSON file
# Building from the root of the repo at this point because of the
# nature of the CMake build system. The SoureDirectory should probably
# change.
- task: PowerShell@2
inputs:
targetType: filePath
filePath: eng/scripts/New-ReleaseArtifact.ps1
arguments: >-
-SourceDirectory ./
-PackageSpecPath $(Build.ArtifactStagingDirectory)/packages/${{ artifact.Name }}/package-info.json
-Destination $(Build.ArtifactStagingDirectory)/packages/${{ artifact.Name }}/vcpkg
-Workspace $(Agent.TempDirectory)/vcpkg-${{ artifact.Name }}
pwsh: true
displayName: Compress publish artifact and stage for publishing
- task: Powershell@2
inputs:
targetType: inline
script: |
# If there is no vcpkg directory skip staging the vcpkg port artifacts
if (!(Test-Path sdk/${{ parameters.ServiceDirectory }}/${{ artifact.Name }}/vcpkg/)) {
if (!(Test-Path build/vcpkg/ports/${{ artifact.VcpkgPortName }})) {
Write-Host "No vcpkg port directory at build/vcpkg/ports/${{ artifact.VcpkgPortName }}"
exit
}
New-Item `
-ItemType Directory `
$(Build.ArtifactStagingDirectory)/packages/${{ artifact.Name }}/vcpkg/port -Force
$(Build.ArtifactStagingDirectory)/packages/${{ artifact.Name }}/vcpkg -Force
Copy-Item `
sdk/${{ parameters.ServiceDirectory }}/${{ artifact.Name }}/vcpkg/* `
$(Build.ArtifactStagingDirectory)/packages/${{ artifact.Name }}/vcpkg/port `
-Exclude README.md
Copy-Item -Recurse `
build/vcpkg/ports/${{ artifact.VcpkgPortName }}/. `
$(Build.ArtifactStagingDirectory)/packages/${{ artifact.Name }}/vcpkg/port
pwsh: true
displayName: Copy vcpkg port template files and remove .template extension
displayName: Copy vcpkg port files from build
- pwsh: |
$outputPath = Join-Path -Path $(Build.ArtifactStagingDirectory) packages/${{ artifact.Name }}

View File

@ -86,11 +86,19 @@ stages:
steps:
- checkout: self
- pwsh: |
$branchName = "azure-sdk-for-cpp-${{ artifact.Name }}-$(Build.BuildId)"
if ('$(VcpkgForkBranchName)') {
Write-Host "Using queue time branch name"
$branchName = '$(VcpkgForkBranchName)'
}
Write-Host "##vso[task.setvariable variable=PrBranchName]$branchName"
displayName: Set fork branch name
- task: Powershell@2
inputs:
filePath: eng/scripts/Initialize-VcpkgRelease.ps1
arguments: >-
-GitHubPat $(azuresdk-github-pat)
-GitHubRepo "$(Build.Repository.Name)"
-PackageSpecPath $(Pipeline.Workspace)/packages/${{artifact.Name}}/package-info.json
-SourceDirectory $(Pipeline.Workspace)/packages/${{artifact.Name}}/vcpkg
@ -98,41 +106,49 @@ stages:
pwsh: true
displayName: Initialize vcpkg release
# There are potential race conditions if this script runs
# in parallel against the same branch name. Release only
# one package at a time.
- pwsh: |
Write-Host "git clone https://github.com/microsoft/vcpkg $(Pipeline.Workspace)/vcpkg"
git clone https://github.com/microsoft/vcpkg $(Pipeline.Workspace)/vcpkg
if ($LASTEXITCODE -ne 0) {
Write-Error "Unable to check out vcpkg repo"
exit $LASTEXITCODE
}
Write-Host "cd $(Pipeline.Workspace)/vcpkg"
cd $(Pipeline.Workspace)/vcpkg
# There is no need to check out a branch, the
# create-pull-request.yml template creates the branch
# Clean out the folder so that template files removed
# are not inadvertently re-added
if (Test-Path "ports/${{ artifact.Name }}") {
Remove-Item -v -r "ports/${{ artifact.Name }}"
if (Test-Path "ports/${{ artifact.VcpkgPortName }}") {
Remove-Item -v -r "ports/${{ artifact.VcpkgPortName }}"
}
New-Item -Type Directory ports/${{ artifact.Name }}
Copy-Item -Verbose $(Pipeline.Workspace)/packages/${{artifact.Name}}/vcpkg/port/* ports/${{ artifact.Name }}
New-Item -Type Directory ports/${{ artifact.VcpkgPortName }}
Copy-Item -Verbose $(Pipeline.Workspace)/packages/${{artifact.Name}}/vcpkg/port/* ports/${{ artifact.VcpkgPortName }}
# Show artifacts copied into ports folder for PR
Get-ChildItem -Recurse ports/${{ artifact.Name }}
Get-ChildItem -Recurse ports/${{ artifact.VcpkgPortName }}
Write-Host "git status"
git status
displayName: Copy updated files into vcpkg fork for PR
condition: ne(variables['SkipVcpkgUpdate'], 'true')
# This template does not need to check the
# SkipVcpkgUpdate variable, it will stop if there are no
# changes in the git repo.
- template: /eng/common/pipelines/templates/steps/create-pull-request.yml
parameters:
RepoOwner: Microsoft
RepoName: vcpkg
WorkingDirectory: $(Pipeline.Workspace)/vcpkg
PrBranchName: azure-sdk-for-cpp-${{ artifact.Name }}-$(Build.BuildId)
CommitMsg: "Update port for ${{ artifact.Name }}"
PRTitle: "Update port for ${{ artifact.Name }}"
PrBranchName: $(PrBranchName)
CommitMsg: "Update port for ${{ artifact.VcpkgPortName }}"
PRTitle: "Update port for ${{ artifact.VcpkgPortName }}"
BaseBranchName: master
PushArgs: -f
- ${{if ne(artifact.skipUpdatePackageVersion, 'true')}}:
- deployment: UpdatePackageVersion

View File

@ -1,7 +1,7 @@
<#
.SYNOPSIS
Uploads the release asset and mutates files in $SourceDirectory/port to point to
the uploaded GitHub release asset.
Downloads the release asset and mutates the portfile.cmake file to use the
SHA512 hash of the release asset.
.PARAMETER SourceDirectory
Location of vcpkg assets (usually `<artifact-path>/packages/<package-name>/vcpkg`)
@ -9,9 +9,6 @@ Location of vcpkg assets (usually `<artifact-path>/packages/<package-name>/vcpkg
.PARAMETER PackageSpecPath
Location of the relevant package-info.json file
.PARAMETER GitHubPat
PAT for uploading asset to GitHub release and creating PR
.PARAMETER GitHubRepo
Name of the GitHub repo (of the form Azure/azure-sdk-for-cpp)
@ -26,10 +23,6 @@ param (
[ValidateNotNullOrEmpty()]
[string] $PackageSpecPath,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $GitHubPat,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $GitHubRepo
@ -38,29 +31,29 @@ param (
# If there's nothing in the "port" folder to upload set SkipVcpkgUpdate to true
# and exit. Other steps will check SkipVcpkgUpdate to decide whether to move
# forward.
if (!(Get-ChildItem -Path "$SourceDirectory/port")) {
if (!(Get-ChildItem -Path "$SourceDirectory/port/CONTROL")) {
Write-Host "###vso[task.setvariable variable=SkipVcpkgUpdate]true"
exit
}
$packageSpec = Get-Content -Raw -Path $PackageSpecPath | ConvertFrom-Json
$assetFilename = "$($packageSpec.packageName).tar.gz"
$tarGzUri = "https://github.com/$GitHubRepo/archive/$($packageSpec.packageName).tar.gz"
# Upload the asset to the release
Write-Verbose "Uploading asset: $assetFilename..."
$assetInfo = & $PSScriptRoot/../common/scripts/New-ReleaseAsset.ps1 `
-ReleaseTag $packageSpec.packageName `
-AssetPath $SourceDirectory/$assetFilename `
-GitHubRepo $GitHubRepo `
-GitHubPat $GitHubPat
Write-Host "Downloading tarball to compute hash from $tarGzUri"
$localTarGzPath = New-TemporaryFile
Invoke-WebRequest -Uri $tarGzUri -OutFile $localTarGzPath
$sha512 = (Get-FileHash -Path "$SourceDirectory/$assetFilename" -Algorithm SHA512).Hash
$sha512 = (Get-FileHash -Path $localTarGzPath -Algorithm SHA512).Hash.ToLower()
Write-Host "SHA512: $sha512"
Write-Verbose "Mutating files with release info and creating PR"
# Use asset URL to fill in vcpkg port tokens
& $PSScriptRoot/New-VcpkgPortDefinition.ps1 `
-SourceDirectory "$SourceDirectory/port" `
-Version $packageSpec.Version `
-Url $assetInfo.browser_download_url `
-Filename $assetFilename `
-Sha512 $sha512
Write-Verbose "Writing the SHA512 hash"
$portfileLocation = "$SourceDirectory/port/portfile.cmake"
# Regex replace SHA512 preserving spaces. The placeholder "SHA512 1" is
# recommended in vcpkg documentation
# Before: " SHA512 1"
# After: " SHA512 f6cf1c16c52"
$newContent = Get-Content -Raw -Path $portfileLocation `
| ForEach-Object { $_ -replace '(SHA512\s+)1', "`${1}$sha512" }
$newContent | Set-Content $portfileLocation

View File

@ -4,7 +4,15 @@ $packagePattern = "*.json"
$MetadataUri = "https://raw.githubusercontent.com/Azure/azure-sdk/master/_data/releases/latest/cpp-packages.csv"
$BlobStorageUrl = "https://azuresdkdocs.blob.core.windows.net/%24web?restype=container&comp=list&prefix=cpp%2F&delimiter=%2F"
# Parse out package publishing information given a nupkg ZIP format.
function Get-cpp-PackageInfoFromRepo($pkgPath, $serviceDirectory, $pkgName)
{
$packageVersion = & $PSScriptRoot/Get-PkgVersion.ps1 -ServiceDirectory $serviceDirectory -PackageName $pkgName
return [PackageProps]::new($pkgName, $packageVersion, $pkgPath, $serviceDirectory)
}
# Parse out package publishing information from a package-info.json file.
function Get-cpp-PackageInfoFromPackageFile($pkg, $workingDirectory)
{
$packageInfo = Get-Content -Raw -Path $pkg | ConvertFrom-Json

View File

@ -1,85 +0,0 @@
<#
.SYNOPSIS
Creates a .tar.gz archive of files in a given folder.
.DESCRIPTION
This is supposed to help zip up any location where artifacts are properly staged
for placement in an archive. It does this by reading in the package information
from the package.json file, then creating an archive named for the package and
version, and copying the package to an artifact location.
.PARAMETER SourceDirectory
Source directory to compress. Files and folders in that source directory
(except .git) will be compressed.
.PARAMETER PackageSpecPath
Location of the package.json file.
.PARAMETER Destination
Location to copy the artifact file to.
.PARAMETER Destination
Name of the destination to which the archive should be copied.
.PARAMETER Workspace
Workspace folder where assets are staged before creating.
#>
param (
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $SourceDirectory,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $PackageSpecPath,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $Destination,
[Parameter()]
[ValidateNotNullOrEmpty()]
[string] $Workspace = "$env:TEMP/vcpkg-workspace"
)
$initialLocation = Get-Location
try {
$packageSpec = Get-Content -Raw -Path $PackageSpecPath | ConvertFrom-Json
$archiveName = $packageSpec.packageName
Write-Verbose "Archive Name: $archiveName"
# Set up workspace, copy source to workspace
Remove-Item -Path $Workspace -Force -Recurse -ErrorAction Ignore
New-Item -ItemType directory -Path "$Workspace/$archiveName" -Force
Copy-Item `
-Path $SourceDirectory/* `
-Destination "$Workspace/$archiveName/" `
-Recurse `
-Exclude ".git"
# Move outside of workspace so the archive root contains a folder named
# after the package and its contents are the package contents. For example:
# azure-template-1.2.3/
# CMakeLists.txt
# ...
Set-Location $Workspace
# Create the tar.gz file
tar -cvz --exclude .git -f "$archiveName.tar.gz" $archiveName
New-Item -ItemType Directory $Destination -Force
# Copy release archive to the appropriate destination location
Copy-Item `
-Path "$archiveName.tar.gz" `
-Destination $Destination `
-Verbose
} finally {
Set-Location $initialLocation
}

View File

@ -1,61 +0,0 @@
<#
.SYNOPSIS
Replaces token content in each file of the SourceDirectory (assumes no subfolders)
.PARAMETER SourceDirectory
Location of vcpkg port files
(usually `<artifact-path>/packages/<package-name>/vcpkg/port`)
.PARAMETER Version
Replaces %VERSION% token in files with the value of this parameter
.PARAMETER Url
Replaces %URL% token in files with the value of this parameter
.PARAMETER Filename
Replaces %FILENAME% token in files with the value of this parameter
.PARAMETER Sha512
Replaces %SHA512% token in files with the value of this parameter
#>
param (
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $SourceDirectory,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $Version,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $Url,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $Filename,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $Sha512
)
$files = Get-ChildItem -Path $SourceDirectory -Include *.template -Recurse
Write-Host $files
foreach ($file in $files) {
Write-Host "Updating file contents: $file"
$content = Get-Content -Raw -Path $file
$newContent = $content `
-replace '%VERSION%', $Version `
-replace '%URL%', $Url `
-replace '%FILENAME%', $Filename `
-replace '%SHA512%', $Sha512
$newContent | Set-Content $file
$file | Rename-Item -NewName { $_.Name -replace '.template', '' }
}

View File

@ -40,7 +40,7 @@ function Update-Version(
[AzureEngSemanticVersion]$SemVer,
$VersionHppLocation,
$Unreleased=$True,
$ReplaceVersion=$False)
$ReplaceLatestEntryTitle=$False)
{
Write-Verbose "New Version: $SemVer"
if ($SemVer.HasValidPrereleaseLabel() -ne $true){
@ -57,15 +57,15 @@ function Update-Version(
$newContent = $versionHppContent -replace $VersionRegex, "`${1}$($SemVer.Major)`${2}$($SemVer.Minor)`${3}$($SemVer.Patch)`${4}`"`""
}
$newContent | Set-Content $VersionHppLocation
$newContent | Set-Content $VersionHppLocation -NoNewline
# Set Version in ChangeLog file
$ChangelogPath = Join-Path $RepoRoot "sdk" $ServiceDirectory $PackageName "CHANGELOG.md"
& "${RepoRoot}/eng/common/Update-Change-Log.ps1" `
& "${RepoRoot}/eng/common/scripts/Update-ChangeLog.ps1" `
-Version $SemVer.ToString() `
-ChangeLogPath $ChangelogPath `
-ServiceDirectory $ServiceDirectory `
-PackageName $PackageName `
-Unreleased $Unreleased `
-ReplaceVersion $ReplaceVersion
-ReplaceLatestEntryTitle $ReplaceLatestEntryTitle
}
$versionHppLocation = Get-VersionHppLocaiton `
@ -94,6 +94,6 @@ else
-SemVer $SemVer `
-VersionHppLocation $versionHppLocation `
-Unreleased $False `
-ReplaceVersion $True
-ReplaceLatestEntryTitle $True
}

View File

@ -0,0 +1,4 @@
# Vcpkg Publish Automation Assets
These files are used by the engineering system to publish to vcpkg. They are not
required to build the library.

View File

@ -35,3 +35,4 @@ stages:
Artifacts:
- Name: azure-core
Path: azure-core
VcpkgPortName: azure-core-cpp

View File

@ -0,0 +1,4 @@
# Vcpkg Publish Automation Assets
These files are used by the engineering system to publish to vcpkg. They are not
required to build the library.

View File

@ -36,3 +36,4 @@ stages:
Artifacts:
- Name: azure-identity
Path: azure-identity
VcpkgPortName: azure-identity-cpp

View File

@ -0,0 +1,4 @@
# Vcpkg Publish Automation Assets
These files are used by the engineering system to publish to vcpkg. They are not
required to build the library.

View File

@ -0,0 +1,4 @@
# Vcpkg Publish Automation Assets
These files are used by the engineering system to publish to vcpkg. They are not
required to build the library.

View File

@ -0,0 +1,4 @@
# Vcpkg Publish Automation Assets
These files are used by the engineering system to publish to vcpkg. They are not
required to build the library.

View File

@ -0,0 +1,4 @@
# Vcpkg Publish Automation Assets
These files are used by the engineering system to publish to vcpkg. They are not
required to build the library.

View File

@ -43,9 +43,13 @@ stages:
Artifacts:
- Name: azure-storage-common
Path: azure-storage-common
VcpkgPortName: azure-storage-common-cpp
- Name: azure-storage-blobs
Path: azure-storage-blobs
VcpkgPortName: azure-storage-blobs-cpp
- Name: azure-storage-files-datalake
Path: azure-storage-files-datalake
VcpkgPortName: azure-storage-files-datalake-cpp
- Name: azure-storage-files-shares
Path: azure-storage-files-shares
VcpkgPortName: azure-storage-files-shares-cpp

View File

@ -1,6 +1,76 @@
# Release History
## 1.0.0-beta.8 (Unreleased)
## 1.0.0-beta.25 (2020-01-12)
* Validate vcpkg publishing automation (part 20)
## 1.0.0-beta.24 (2020-01-11)
* Validate vcpkg publishing automation (part 19)
## 1.0.0-beta.23 (2020-01-11)
* Validate vcpkg publishing automation (part 18)
## 1.0.0-beta.22 (2020-01-08)
* Validate vcpkg publishing automation (part 17)
## 1.0.0-beta.21 (2020-01-08)
* Validate vcpkg publishing automation (part 17)
## 1.0.0-beta.20 (2020-01-08)
* Validate vcpkg publishing automation (part 16)
## 1.0.0-beta.19 (2020-01-08)
* Validate vcpkg publishing automation (part 15)
## 1.0.0-beta.18 (2021-01-08)
* Validate vcpkg publishing automation (part 14)
## 1.0.0-beta.17 (2021-01-08)
* Validate vcpkg publishing automation (part 13)
## 1.0.0-beta.16 (2021-01-07)
* Validate vcpkg publishing automation (part 13)
## 1.0.0-beta.15 (2021-01-07)
* Validate vcpkg publishing automation (part 12)
## 1.0.0-beta.14 (2021-01-07)
* Validate vcpkg publishing automation (part 11)
## 1.0.0-beta.13 (2021-01-07)
* Validate vcpkg publishing automation (part 10)
## 1.0.0-beta.12 (2021-01-07)
* Validate vcpkg publishing automation (part 9)
## 1.0.0-beta.11 (2021-01-07)
* Validate vcpkg publishing automation (part 8)
## 1.0.0-beta.10 (2021-01-07)
* Validate vcpkg publishing automation (part 7)
## 1.0.0-beta.9 (2021-01-07)
* Validate vcpkg publishing automation (part 6)
## 1.0.0-beta.8 (2021-01-07)
* Validate vcpkg publishing automation
## 1.0.0-beta.7 (2020-09-15)

View File

@ -19,12 +19,13 @@ include(global_compile_options)
az_vcpkg_integrate()
if(NOT AZ_ALL_LIBRARIES)
find_package(azure-core-cpp CONFIG QUIET)
if(NOT azure-core-cpp_FOUND)
find_package(azure-core-cpp REQUIRED)
endif()
endif()
# Disable dependency on azure-core until azure-core has released to vcpkg
# if(NOT AZ_ALL_LIBRARIES)
# find_package(azure-core-cpp CONFIG QUIET)
# if(NOT azure-core-cpp_FOUND)
# find_package(azure-core-cpp REQUIRED)
# endif()
# endif()
set(
AZURE_TEMPLATE_HEADER
@ -46,10 +47,12 @@ target_include_directories(
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
$<INSTALL_INTERFACE:include>
${azure-core-cpp_INCLUDE_DIRS}
# Disable dependency on azure-core until azure-core has released to vcpkg
# ${azure-core-cpp_INCLUDE_DIRS}
)
target_link_libraries(azure-template PUBLIC Azure::azure-core)
# Disable dependency on azure-core until azure-core has released to vcpkg
# target_link_libraries(azure-template PUBLIC Azure::azure-core)
# make sure that users can consume the project as a library.
add_library(Azure::azure-template ALIAS azure-template)

View File

@ -8,7 +8,7 @@
#define AZURE_TEMPLATE_VERSION_MAJOR 1
#define AZURE_TEMPLATE_VERSION_MINOR 0
#define AZURE_TEMPLATE_VERSION_PATCH 0
#define AZURE_TEMPLATE_VERSION_PRERELEASE "beta.8"
#define AZURE_TEMPLATE_VERSION_PRERELEASE "beta.25"
namespace Azure { namespace Template { namespace Details {

View File

@ -3,7 +3,6 @@
#
Source: azure-template-cpp
Version: @AZ_LIBRARY_VERSION@
Build-Depends: azure-core-cpp
Description: Microsoft Azure Template SDK for C++
This is a template library meant to illustrate initial client library development process for Azure SDK.
It is not meant to be published to vcpkg.

View File

@ -1,4 +0,0 @@
Source: azure-template
Version: %VERSION%
Homepage: https://github.com/Azure/azure-sdk-for-cpp/tree/master/sdk/template/azure-template
Description: Azure C++ SDK Template

View File

@ -1,80 +0,0 @@
# Common Ambient Variables:
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
# CURRENT_INSTALLED_DIR = ${VCPKG_ROOT_DIR}\installed\${TRIPLET}
# DOWNLOADS = ${VCPKG_ROOT_DIR}\downloads
# PORT = current port name (zlib, etc)
# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
# VCPKG_TOOLCHAIN = ON OFF
# TRIPLET_SYSTEM_ARCH = arm x86 x64
# BUILD_ARCH = "Win32" "x64" "ARM"
# MSBUILD_PLATFORM = "Win32"/"x64"/${TRIPLET_SYSTEM_ARCH}
# DEBUG_CONFIG = "Debug Static" "Debug Dll"
# RELEASE_CONFIG = "Release Static"" "Release DLL"
# VCPKG_TARGET_IS_WINDOWS
# VCPKG_TARGET_IS_UWP
# VCPKG_TARGET_IS_LINUX
# VCPKG_TARGET_IS_OSX
# VCPKG_TARGET_IS_FREEBSD
# VCPKG_TARGET_IS_ANDROID
# VCPKG_TARGET_IS_MINGW
# VCPKG_TARGET_EXECUTABLE_SUFFIX
# VCPKG_TARGET_STATIC_LIBRARY_SUFFIX
# VCPKG_TARGET_SHARED_LIBRARY_SUFFIX
#
# See additional helpful variables in /docs/maintainers/vcpkg_common_definitions.md
# # Specifies if the port install should fail immediately given a condition
# vcpkg_fail_port_install(MESSAGE "azure-template currently only supports Linux and Mac platforms" ON_TARGET "Windows")
vcpkg_download_distfile(ARCHIVE
URLS "%URL%"
FILENAME "%FILENAME%"
SHA512 %SHA512%
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
# (Optional) A friendly name to use instead of the filename of the archive (e.g.: a version number or tag).
# REF 1.0.0
# (Optional) Read the docs for how to generate patches at:
# https://github.com/Microsoft/vcpkg/blob/master/docs/examples/patching.md
# PATCHES
# 001_port_fixes.patch
# 002_more_port_fixes.patch
)
# # Check if one or more features are a part of a package installation.
# # See /docs/maintainers/vcpkg_check_features.md for more details
# vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
# FEATURES # <- Keyword FEATURES is required because INVERTED_FEATURES are being used
# tbb WITH_TBB
# INVERTED_FEATURES
# tbb ROCKSDB_IGNORE_PACKAGE_TBB
# )
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA # Disable this option if project cannot be built with Ninja
OPTIONS -DWARNINGS_AS_ERRORS=OFF
# OPTIONS_RELEASE -DOPTIMIZE=1
# OPTIONS_DEBUG -DDEBUGGABLE=1
)
vcpkg_install_cmake()
# # Moves all .cmake files from /debug/share/azure-template/ to /share/azure-template/
# # See /docs/maintainers/vcpkg_fixup_cmake_targets.md for more details
# vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/azure-template)
# # Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/azure-template RENAME copyright)
# # Post-build test for cmake libraries
# vcpkg_test_cmake(PACKAGE_NAME azure-template)

View File

@ -37,3 +37,4 @@ stages:
Artifacts:
- Name: azure-template
Path: azure-template
VcpkgPortName: azure-template-cpp