If a port has a dependency on itself, as a host dependency, then if the host build fails, the non-host build will still run:
Let ports be:
ports/
a/
vcpkg.json
portfile.cmake
with ports/a/vcpkg.json:
{
"name": "a",
"version": "0",
"dependencies": [
{
"name": "a",
"host": true
}
]
}
and ports/a/portfile.cmake:
if(TARGET_TRIPLET STREQUAL HOST_TRIPLET)
message(FATAL_ERROR boop)
endif()
Then, run vcpkg ci x64-osx --debug on an arm64-osx machine, and you will get the following:
PS /../nimazzuc/projects/vcpkg> ./vcpkg ci x64-osx --debug
<snip>
Could not locate cached archive: /Users/nimazzuc/.cache/vcpkg/archives/17/17bf6db38435f8c4ee181d3042b0528b67054794.zip
Could not locate cached archive: /Users/nimazzuc/.cache/vcpkg/archives/69/695ea88918267e4fe0eb5532ed4df67bcad2088a.zip
Starting package 1/2: a:arm64-osx
Building package a[core]:arm64-osx...
-- Using community triplet arm64-osx. This triplet configuration is not guaranteed to succeed.
-- [COMMUNITY] Loading triplet configuration from: /Users/nimazzuc/projects/vcpkg/triplets/community/arm64-osx.cmake
[DEBUG] popen(/Users/nimazzuc/projects/vcpkg/downloads/tools/cmake-3.20.2-osx/cmake-3.20.2-macos-universal/CMake.app/Contents/bin/cmake -DALL_FEATURES= -DCURRENT_PORT_DIR=/Users/nimazzuc/projects/vcpkg/ports/a -D_HOST_TRIPLET=arm64-osx -DFEATURES=core -DPORT=a -DVCPKG_USE_HEAD_VERSION=0 -D_VCPKG_DOWNLOAD_TOOL=BUILT_IN -D_VCPKG_EDITABLE=0 -D_VCPKG_NO_DOWNLOADS=0 -D_VCPKG_PROHIBIT_BACKCOMPAT_FEATURES=1 -DCMD=BUILD -DDOWNLOADS=/Users/nimazzuc/projects/vcpkg/downloads -DTARGET_TRIPLET=arm64-osx -DTARGET_TRIPLET_FILE=/Users/nimazzuc/projects/vcpkg/triplets/community/arm64-osx.cmake -DVCPKG_BASE_VERSION=2021-05-05 -DVCPKG_CONCURRENCY=9 -DVCPKG_PLATFORM_TOOLSET=external -DGIT=/usr/bin/git -DVCPKG_ROOT_DIR=/Users/nimazzuc/projects/vcpkg -DPACKAGES_DIR=/Users/nimazzuc/projects/vcpkg/packages -DBUILDTREES_DIR=/Users/nimazzuc/projects/vcpkg/buildtrees -D_VCPKG_INSTALLED_DIR=/Users/nimazzuc/projects/vcpkg/installed -DDOWNLOADS=/Users/nimazzuc/projects/vcpkg/downloads -DVCPKG_MANIFEST_INSTALL=OFF -P /Users/nimazzuc/projects/vcpkg/scripts/ports.cmake 2>&1)
CMake Error at ports/a/portfile.cmake:2 (message):
boo
Call Stack (most recent call first):
scripts/ports.cmake:139 (include)
[DEBUG] cmd_execute_and_stream_data() returned 256 after 57670 us
Error: Building package a:arm64-osx failed with: BUILD_FAILED
Elapsed time for package a:arm64-osx: 59.31 ms
Starting package 2/2: a:x64-osx
Building package a[core]:x64-osx...
[DEBUG] /Users/nimazzuc/projects/vcpkg/buildtrees/_vcpkg/src/vcpkg-tool-2021-05-05-9f849c4c43e50d1b16186ae76681c27b0c1be9d9/src/vcpkg/build.cpp(1250)
[DEBUG] Exiting after 6514811 us (6500783 us)
This is not replicated when a -> b:host, and b:host fails.
If a port has a dependency on itself, as a host dependency, then if the host build fails, the non-host build will still run:
Let
portsbe:with
ports/a/vcpkg.json:{ "name": "a", "version": "0", "dependencies": [ { "name": "a", "host": true } ] }and
ports/a/portfile.cmake:Then, run
vcpkg ci x64-osx --debugon anarm64-osxmachine, and you will get the following:This is not replicated when
a -> b:host, andb:hostfails.