swift.tests.cxx-interop-test: init

I used this to verify the libc++ changes.

Emily 0ec026a1 8df3205b

Changed files
+90
pkgs
development
compilers
swift
compiler
cxx-interop-test
wrapper
+4
pkgs/development/compilers/swift/compiler/default.nix
···
swiftStaticLibSubdir
;
# Internal attr for the wrapper.
_wrapperParams = wrapperParams;
};
···
swiftStaticLibSubdir
;
+
tests = {
+
cxx-interop-test = callPackage ../cxx-interop-test { };
+
};
+
# Internal attr for the wrapper.
_wrapperParams = wrapperParams;
};
+57
pkgs/development/compilers/swift/cxx-interop-test/default.nix
···
···
+
{
+
lib,
+
stdenv,
+
swift,
+
swiftpm,
+
swiftPackages,
+
}:
+
+
swiftPackages.stdenv.mkDerivation (finalAttrs: {
+
name = "swift-cxx-interop-test";
+
+
src = ./src;
+
+
nativeBuildInputs = [
+
swift
+
swiftpm
+
];
+
+
installPhase = ''
+
runHook preInstall
+
+
binPath="$(swiftpmBinPath)"
+
mkdir -p -- "$out/bin"
+
cp -- "$binPath/${finalAttrs.meta.mainProgram}" "$out/bin"
+
+
runHook postInstall
+
'';
+
+
installCheckPhase = ''
+
runHook preInstallCheck
+
+
"$out/bin/${finalAttrs.meta.mainProgram}" | grep 'Hello, world!'
+
+
runHook postInstallCheck
+
'';
+
+
doInstallCheck = true;
+
+
env = {
+
# Gross hack copied from `protoc-gen-swift` :(
+
LD_LIBRARY_PATH = lib.optionalString stdenv.hostPlatform.isLinux (
+
lib.makeLibraryPath [
+
swiftPackages.Dispatch
+
]
+
);
+
};
+
+
meta = {
+
inherit (swift.meta)
+
team
+
platforms
+
badPlatforms
+
;
+
license = lib.licenses.mit;
+
mainProgram = "CxxInteropTest";
+
};
+
})
+9
pkgs/development/compilers/swift/cxx-interop-test/src/.gitignore
···
···
+
.DS_Store
+
/.build
+
/Packages
+
/*.xcodeproj
+
xcuserdata/
+
DerivedData/
+
.swiftpm/config/registries.json
+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
+
.netrc
+16
pkgs/development/compilers/swift/cxx-interop-test/src/Package.swift
···
···
+
// swift-tools-version: 5.8
+
+
import PackageDescription
+
+
let package = Package(
+
name: "CxxInteropTest",
+
targets: [
+
.executableTarget(
+
name: "CxxInteropTest",
+
path: "Sources",
+
swiftSettings: [
+
.unsafeFlags(["-enable-experimental-cxx-interop"])
+
]
+
)
+
]
+
)
+3
pkgs/development/compilers/swift/cxx-interop-test/src/Sources/main.swift
···
···
+
import CxxStdlib
+
+
print(String(cxxString: std.string("Hello, world!")))
+1
pkgs/development/compilers/swift/wrapper/default.nix
···
swiftArch
swiftModuleSubdir
swiftLibSubdir
;
};
}
···
swiftArch
swiftModuleSubdir
swiftLibSubdir
+
tests
;
};
}