swiftPackages_ng.swift-corelibs-xctest: init at 6.2.4

This commit is contained in:
Randy Eckenrode
2026-08-06 19:56:05 -04:00
parent eef51f196c
commit 8cdee6caa0
2 changed files with 91 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
{
lib,
cmake,
fetchFromGitHub,
ninja,
stdenv,
swift-corelibs-foundation,
swift-corelibs-libdispatch,
swift-foundation,
swift-foundation-icu,
swift-minimal,
swift_release,
swift_sources,
}:
let
# Our minimum deployment target is higher than 10.12, but we can target lower, and some dependants require it.
# This is harmless on non-Darwin.
minTriple =
lib.replaceString stdenv.hostPlatform.darwinMinVersion "10.12"
stdenv.hostPlatform.swift.triple;
# swift-corelibs-xctest requires Dispatch and Foundation.
swift = swift-minimal.override { inherit swift-corelibs-libdispatch swift-foundation; };
in
stdenv.mkDerivation (finalAttrs: {
pname = "swift-corelibs-xctest";
version = swift_release;
outputs = [
"out"
"dev"
];
src = fetchFromGitHub {
owner = "swiftlang";
repo = "swift-corelibs-xctest";
tag = "swift-${finalAttrs.version}-RELEASE";
inherit (swift_sources.swift-corelibs-xctest) hash;
};
strictDeps = true;
cmakeFlags = [ (lib.cmakeBool "USE_FOUNDATION_FRAMEWORK" true) ];
preConfigure = ''
appendToVar cmakeFlags -DCMAKE_Swift_COMPILER_TARGET=${minTriple}
appendToVar cmakeFlags -DCMAKE_Swift_FLAGS=-module-cache-path\ "$NIX_BUILD_TOP/module-cache"
'';
nativeBuildInputs = [
cmake
ninja
swift
];
buildInputs =
# swift-corelibs-xctest expects to find these via CMake on non-Darwin platforms.
lib.optionals (!stdenv.hostPlatform.isDarwin) [
swift-corelibs-foundation
swift-corelibs-libdispatch
swift-foundation
swift-foundation-icu
];
postInstall = ''
dylib_name=libXCTest${stdenv.hostPlatform.extensions.library}
dylib_path="''${!outputLib}/lib/swift/${stdenv.hostPlatform.swift.platform}"
mv "$dylib_path/$dylib_name" "''${!outputLib}/lib/$dylib_name"
moveToOutput lib/swift/${stdenv.hostPlatform.swift.platform} "''${!outputDev}"
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool "''${!outputLib}/lib/$dylib_name" \
-change "$dylib_path/$dylib_name" "''${!outputLib}/lib/$dylib_name"
'';
__structuredAttrs = true;
meta = {
description = "Framework for writing unit tests in Swift";
homepage = "https://github.com/swiftlang/swift-corelibs-xctest";
platforms = lib.platforms.darwin ++ lib.platforms.linux ++ lib.platforms.windows;
license = lib.licenses.asl20;
maintainers = lib.teams.swift.members;
};
})

View File

@@ -11,6 +11,9 @@
"swift-corelibs-libdispatch": {
"hash": "sha256-Tu2G9FAP4q1xgM1n9q17T6VrqJ3tv8RezyUex38yNds="
},
"swift-corelibs-xctest": {
"hash": "sha256-BbzY1kZUaHu7O29c8J7xDuelik6lhqmfSSskvvPZ7R4="
},
"swift-driver": {
"hash": "sha256-CZYqUadpAsAUnCTZElobZS9nlMfCuHiMnac3o0k7hnI="
},