From 8cdee6caa0ce2292a644e609e6c0bf71fbb9b9fe Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 6 Aug 2026 19:56:05 -0400 Subject: [PATCH] swiftPackages_ng.swift-corelibs-xctest: init at 6.2.4 --- .../sw/swift-corelibs-xctest/package.nix | 88 +++++++++++++++++++ .../compilers/swift_ng/sources-6.2.json | 3 + 2 files changed, 91 insertions(+) create mode 100644 pkgs/development/compilers/swift_ng/by-name/sw/swift-corelibs-xctest/package.nix diff --git a/pkgs/development/compilers/swift_ng/by-name/sw/swift-corelibs-xctest/package.nix b/pkgs/development/compilers/swift_ng/by-name/sw/swift-corelibs-xctest/package.nix new file mode 100644 index 000000000000..7c5310b501cd --- /dev/null +++ b/pkgs/development/compilers/swift_ng/by-name/sw/swift-corelibs-xctest/package.nix @@ -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; + }; +}) diff --git a/pkgs/development/compilers/swift_ng/sources-6.2.json b/pkgs/development/compilers/swift_ng/sources-6.2.json index 87d0e53f4e5a..3ca74c79e30d 100644 --- a/pkgs/development/compilers/swift_ng/sources-6.2.json +++ b/pkgs/development/compilers/swift_ng/sources-6.2.json @@ -11,6 +11,9 @@ "swift-corelibs-libdispatch": { "hash": "sha256-Tu2G9FAP4q1xgM1n9q17T6VrqJ3tv8RezyUex38yNds=" }, + "swift-corelibs-xctest": { + "hash": "sha256-BbzY1kZUaHu7O29c8J7xDuelik6lhqmfSSskvvPZ7R4=" + }, "swift-driver": { "hash": "sha256-CZYqUadpAsAUnCTZElobZS9nlMfCuHiMnac3o0k7hnI=" },