Files
swift-crypto/scripts/cxx-interop-compatibility.sh
T
Gustavo CairoandYim Lee 3e8497753e Add cxx interop build pipeline (#212)
* Add cxx interop build pipeline

* Update docker-compose.2204.59.yaml

* Change cxx interop CI step to build separate project instead of using cxx compiler flag

* Update docker-compose for 5.10

* Fix package name in docker

* Change code root dirname and remove test target

---------

Co-authored-by: Yim Lee <yim_lee@apple.com>
2023-12-21 12:55:03 +00:00

63 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
##===----------------------------------------------------------------------===##
##
## This source file is part of the SwiftCrypto open source project
##
## Copyright (c) 2023 Apple Inc. and the SwiftCrypto project authors
## Licensed under Apache License v2.0
##
## See LICENSE.txt for license information
## See CONTRIBUTORS.md for the list of SwiftCrypto project authors
##
## SPDX-License-Identifier: Apache-2.0
##
##===----------------------------------------------------------------------===##
set -eu
sourcedir=$(dirname "$(readlink -f $0)")/..
workingdir=$(mktemp -d)
projectname=$(basename $workingdir)
cd $workingdir
swift package init
cat << EOF > Package.swift
// swift-tools-version: 5.9
import PackageDescription
let package = Package(
name: "interop",
platforms: [.macOS(.v10_15)],
products: [
.library(
name: "interop",
targets: ["interop"]
),
],
dependencies: [
.package(path: "$sourcedir")
],
targets: [
.target(
name: "interop",
// Depend on all products of swift-crypto to make sure they're all
// compatible with cxx interop.
dependencies: [
.product(name: "Crypto", package: "swift-crypto"),
.product(name: "_CryptoExtras", package: "swift-crypto")
],
swiftSettings: [.interoperabilityMode(.Cxx)]
)
]
)
EOF
cat << EOF > Sources/$projectname/$(echo $projectname | tr . _).swift
import Crypto
import _CryptoExtras
EOF
swift build