mirror of
https://github.com/github/awesome-copilot.git
synced 2026-08-14 05:06:54 +00:00
Addressed PR review feedback
This commit is contained in:
@@ -7,44 +7,65 @@ Reference for the `vcpkg` skill. Use this when a user asks about using vcpkg in
|
||||
Configure binary caching to avoid rebuilding packages:
|
||||
|
||||
**Azure Blob Storage:**
|
||||
```powershell
|
||||
$env:VCPKG_BINARY_SOURCES = "clear;x-azblob,https://myaccount.blob.core.windows.net/vcpkg-cache,$env:AZURE_STORAGE_SAS_TOKEN,readwrite"
|
||||
```
|
||||
set VCPKG_BINARY_SOURCES=clear;x-azblob,https://myaccount.blob.core.windows.net/vcpkg-cache,<sas-token>,readwrite
|
||||
```bash
|
||||
export VCPKG_BINARY_SOURCES="clear;x-azblob,https://myaccount.blob.core.windows.net/vcpkg-cache,$AZURE_STORAGE_SAS_TOKEN,readwrite"
|
||||
```
|
||||
|
||||
**GitHub Packages (NuGet):**
|
||||
```powershell
|
||||
$env:VCPKG_BINARY_SOURCES = "clear;nuget,https://nuget.pkg.github.com/your-org/index.json,readwrite"
|
||||
```
|
||||
set VCPKG_BINARY_SOURCES=clear;nuget,https://nuget.pkg.github.com/your-org/index.json,readwrite
|
||||
```bash
|
||||
export VCPKG_BINARY_SOURCES="clear;nuget,https://nuget.pkg.github.com/your-org/index.json,readwrite"
|
||||
```
|
||||
|
||||
**Local filesystem:**
|
||||
```powershell
|
||||
$env:VCPKG_BINARY_SOURCES = "clear;files,C:\vcpkg-cache,readwrite"
|
||||
```
|
||||
set VCPKG_BINARY_SOURCES=clear;files,C:/vcpkg-cache,readwrite
|
||||
```bash
|
||||
export VCPKG_BINARY_SOURCES="clear;files,/var/tmp/vcpkg-cache,readwrite"
|
||||
```
|
||||
|
||||
**Sharing between CI and local dev:** Use the same remote cache (Azure Blob or NuGet feed) in both environments. CI writes (`readwrite`), developers read (`read`):
|
||||
```
|
||||
```powershell
|
||||
# CI (writes cache)
|
||||
set VCPKG_BINARY_SOURCES=clear;x-azblob,https://myaccount.blob.core.windows.net/cache,<sas>,readwrite
|
||||
$env:VCPKG_BINARY_SOURCES = "clear;x-azblob,https://myaccount.blob.core.windows.net/cache,$env:AZURE_STORAGE_SAS_TOKEN,readwrite"
|
||||
|
||||
# Developer (reads cache)
|
||||
set VCPKG_BINARY_SOURCES=clear;x-azblob,https://myaccount.blob.core.windows.net/cache,<sas>,read
|
||||
$env:VCPKG_BINARY_SOURCES = "clear;x-azblob,https://myaccount.blob.core.windows.net/cache,$env:AZURE_STORAGE_SAS_TOKEN,read"
|
||||
```
|
||||
```bash
|
||||
# CI (writes cache)
|
||||
export VCPKG_BINARY_SOURCES="clear;x-azblob,https://myaccount.blob.core.windows.net/cache,$AZURE_STORAGE_SAS_TOKEN,readwrite"
|
||||
|
||||
# Developer (reads cache)
|
||||
export VCPKG_BINARY_SOURCES="clear;x-azblob,https://myaccount.blob.core.windows.net/cache,$AZURE_STORAGE_SAS_TOKEN,read"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Generating an SBOM (Software Bill of Materials)
|
||||
|
||||
vcpkg can generate an SBOM in SPDX format:
|
||||
```
|
||||
vcpkg install --x-write-nuget-packages-config=packages.config
|
||||
vcpkg emits per-port SPDX SBOM files during normal source builds; no special SBOM flag is required.
|
||||
```console
|
||||
vcpkg install
|
||||
```
|
||||
|
||||
For manifest mode, after install check `vcpkg_installed/<triplet>/share/` for SPDX files. Each installed port generates an SPDX JSON document at:
|
||||
```
|
||||
vcpkg_installed/<triplet>/share/<port>/sbom.spdx.json
|
||||
Each installed port writes:
|
||||
```text
|
||||
<installed-root>/<triplet>/share/<port>/vcpkg.spdx.json
|
||||
```
|
||||
|
||||
To aggregate: use `vcpkg x-package-info --x-installed` to list all packages and versions, then feed into your SBOM toolchain (e.g., Microsoft SBOM Tool, CycloneDX).
|
||||
`<installed-root>` depends on integration mode:
|
||||
- CLI manifest mode: `<manifest-root>/vcpkg_installed`
|
||||
- CMake integration (default): `${CMAKE_BINARY_DIR}/vcpkg_installed` (or `VCPKG_INSTALLED_DIR` if overridden)
|
||||
- MSBuild integration (default): `$(VcpkgManifestRoot)\vcpkg_installed` (or `$(VcpkgInstalledDir)` if overridden)
|
||||
|
||||
If you need a single consolidated SBOM, enumerate installed ports (for example with `vcpkg x-package-info --x-installed`) and merge/transform the per-port SPDX files in your SBOM pipeline.
|
||||
|
||||
---
|
||||
|
||||
@@ -74,6 +95,7 @@ Option 2: **Script-based** — create a scheduled CI job that:
|
||||
Test across multiple triplets in a CI matrix:
|
||||
```yaml
|
||||
# GitHub Actions example
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
triplet: [x64-windows, x64-linux, x64-osx]
|
||||
@@ -87,10 +109,20 @@ strategy:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install vcpkg
|
||||
run: |
|
||||
git clone https://github.com/microsoft/vcpkg
|
||||
./vcpkg/bootstrap-vcpkg.sh
|
||||
- name: Install dependencies
|
||||
run: vcpkg install --triplet ${{ matrix.triplet }}
|
||||
- name: Clone vcpkg
|
||||
run: git clone https://github.com/microsoft/vcpkg
|
||||
- name: Bootstrap vcpkg (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: .\vcpkg\bootstrap-vcpkg.bat
|
||||
- name: Bootstrap vcpkg (Linux/macOS)
|
||||
if: runner.os != 'Windows'
|
||||
run: ./vcpkg/bootstrap-vcpkg.sh
|
||||
- name: Install dependencies (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: .\vcpkg\vcpkg.exe install --triplet ${{ matrix.triplet }}
|
||||
- name: Install dependencies (Linux/macOS)
|
||||
if: runner.os != 'Windows'
|
||||
run: ./vcpkg/vcpkg install --triplet ${{ matrix.triplet }}
|
||||
```
|
||||
|
||||
@@ -93,7 +93,9 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|
||||
```
|
||||
|
||||
Use it: `vcpkg install telemetry-sdk --overlay-ports=./my-overlays`
|
||||
Classic mode: `vcpkg install telemetry-sdk --overlay-ports=./my-overlays`
|
||||
|
||||
Manifest mode: add `telemetry-sdk` to `vcpkg.json`, then run `vcpkg install --overlay-ports=./my-overlays`.
|
||||
Or in `vcpkg-configuration.json`:
|
||||
```json
|
||||
{
|
||||
@@ -105,7 +107,7 @@ Or in `vcpkg-configuration.json`:
|
||||
|
||||
## Default Features
|
||||
|
||||
Set default features in `vcpkg.json` for a port so they're always enabled:
|
||||
Control whether a dependency's existing default features are enabled, and request additional features in a project manifest:
|
||||
```json
|
||||
{
|
||||
"dependencies": [
|
||||
|
||||
@@ -11,11 +11,10 @@ Build logs are stored at:
|
||||
|
||||
Key log files:
|
||||
- `config-<triplet>-out.log` — CMake configure output
|
||||
- `build-<triplet>-out.log` — Build (compile) output
|
||||
- `install-<triplet>-out.log` — Install step output
|
||||
- `config-<triplet>-err.log` — CMake configure errors
|
||||
- `build-<triplet>-err.log` — Build errors
|
||||
- `package-<triplet>-out.log` — Packaging output
|
||||
- `build-<triplet>-<dbg|rel>-<out|err>.log` — common build logs
|
||||
- `install-<triplet>-<dbg|rel>-<out|err>.log` — common install logs
|
||||
|
||||
Exact names vary by port and build helper; use the path vcpkg prints for the failing command.
|
||||
|
||||
When a build fails, vcpkg prints the path to the relevant log. Start with the `-err.log` file for the failing step.
|
||||
|
||||
@@ -41,7 +40,7 @@ If CMake says `Could not find a package configuration file provided by "X"`:
|
||||
2. Run `vcpkg install` to reconcile (manifest mode auto-removes unused packages)
|
||||
|
||||
In classic mode:
|
||||
```
|
||||
```console
|
||||
vcpkg remove boost-regex
|
||||
vcpkg remove boost-regex --recurse # also removes dependents
|
||||
```
|
||||
@@ -63,8 +62,8 @@ Update the features in `vcpkg.json`:
|
||||
Then run `vcpkg install` — vcpkg will detect the feature change and rebuild.
|
||||
|
||||
In classic mode:
|
||||
```
|
||||
vcpkg install curl[ssl,ssh] # reinstalls with new features
|
||||
```console
|
||||
vcpkg install curl[ssl,ssh] --recurse # permits rebuilding with the new feature set
|
||||
```
|
||||
|
||||
### Replacing One Library with Another
|
||||
@@ -76,6 +75,23 @@ vcpkg install curl[ssl,ssh] # reinstalls with new features
|
||||
|
||||
### Cleaning the vcpkg Cache
|
||||
|
||||
```powershell
|
||||
# Remove build trees (intermediate build files)
|
||||
Remove-Item -Recurse -Force <vcpkg-root>\buildtrees
|
||||
|
||||
# Remove downloaded archives
|
||||
Remove-Item -Recurse -Force <vcpkg-root>\downloads
|
||||
|
||||
# Remove installed packages (classic mode only)
|
||||
Remove-Item -Recurse -Force <vcpkg-root>\installed
|
||||
|
||||
# Remove all package build artifacts
|
||||
vcpkg x-clean
|
||||
|
||||
# In manifest mode, remove the local vcpkg_installed directory
|
||||
Remove-Item -Recurse -Force .\vcpkg_installed
|
||||
```
|
||||
|
||||
```bash
|
||||
# Remove build trees (intermediate build files)
|
||||
rm -rf <vcpkg-root>/buildtrees
|
||||
|
||||
Reference in New Issue
Block a user