File tree 1 file changed +42
-0
lines changed
1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # #===----------------------------------------------------------------------===##
3
+ # #
4
+ # # This source file is part of the SwiftNIO open source project
5
+ # #
6
+ # # Copyright (c) 2024 Apple Inc. and the SwiftNIO project authors
7
+ # # Licensed under Apache License v2.0
8
+ # #
9
+ # # See LICENSE.txt for license information
10
+ # # See CONTRIBUTORS.txt for the list of SwiftNIO project authors
11
+ # #
12
+ # # SPDX-License-Identifier: Apache-2.0
13
+ # #
14
+ # #===----------------------------------------------------------------------===##
15
+
16
+ set -euo pipefail
17
+
18
+ log () { printf -- " ** %s\n" " $* " >&2 ; }
19
+ error () { printf -- " ** ERROR: %s\n" " $* " >&2 ; }
20
+ fatal () { error " $@ " ; exit 1; }
21
+
22
+ log " Checking for Cxx interoperability comaptibility..."
23
+
24
+ source_dir=$( pwd)
25
+ working_dir=$( mktemp -d)
26
+ project_name=$( basename " $working_dir " )
27
+ source_file=Sources/$project_name /$( echo " $project_name " | tr . _) .swift
28
+ library_products=$( swift package dump-package | jq -r ' .products[] | select(.type.library != null) | .name' )
29
+ package_name=$( swift package dump-package | jq -r ' .name' )
30
+
31
+ cd " $working_dir "
32
+ swift package init
33
+ echo " package.dependencies.append(.package(path: \" $source_dir \" ))" >> Package.swift
34
+
35
+ for product in $library_products ; do
36
+ echo " package.targets.first!.dependencies.append(.product(name: \" $product \" , package: \" $package_name \" ))" >> Package.swift
37
+ echo " import $product " >> " $source_file "
38
+ done
39
+
40
+ swift build
41
+
42
+ log " ✅ Passed the Cxx interoperability tests."
You can’t perform that action at this time.
0 commit comments