Skip to content

Commit

Permalink
Work around the SwiftPM layout change. (#2389)
Browse files Browse the repository at this point in the history
Motivation:

SwiftPM has changed its default layout for packages in
swiftlang/swift-package-manager#6144. This breaks our CI, which assumes the
prior layout. We should work around this.

Modifications:

Enhance the code to tolerate both layouts.

Result:

Integration tests run on all platforms
  • Loading branch information
Lukasa authored Mar 13, 2023
1 parent e208367 commit 61043a3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
5 changes: 5 additions & 0 deletions IntegrationTests/tests_02_syscall_wrappers/defines.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
set -eu

function make_package() {
if [[ ! -d "$tmpdir/syscallwrapper/Sources/syscallwrapper/" ]]; then
mkdir "$tmpdir/syscallwrapper/Sources/syscallwrapper/"
mv "$tmpdir"/syscallwrapper/Sources/*.swift "$tmpdir/syscallwrapper/Sources/syscallwrapper/"
fi

cat > "$tmpdir/syscallwrapper/Package.swift" <<"EOF"
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ tmpdir=$(mktemp -d /tmp/.swift-nio-syscall-wrappers-sh-test_XXXXXX)
mkdir "$tmpdir/syscallwrapper"
cd "$tmpdir/syscallwrapper"
swift package init --type=executable
cat > "$tmpdir/syscallwrapper/Sources/syscallwrapper/main.swift" <<EOF

main_path="$tmpdir/syscallwrapper/Sources/main.swift"
if [[ -d "$tmpdir/syscallwrapper/Sources/syscallwrapper/" ]]; then
main_path="$tmpdir/syscallwrapper/Sources/syscallwrapper/main.swift"
fi

cat > "$main_path" <<EOF
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
import Darwin
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ tmpdir=$(mktemp -d /tmp/.swift-nio-syscall-wrappers-sh-test_XXXXXX)
mkdir "$tmpdir/syscallwrapper"
cd "$tmpdir/syscallwrapper"
swift package init --type=executable
cat > "$tmpdir/syscallwrapper/Sources/syscallwrapper/main.swift" <<EOF

main_path="$tmpdir/syscallwrapper/Sources/main.swift"
if [[ -d "$tmpdir/syscallwrapper/Sources/syscallwrapper/" ]]; then
main_path="$tmpdir/syscallwrapper/Sources/syscallwrapper/main.swift"
fi

cat > "$main_path" <<EOF
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
import Darwin
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ tmpdir=$(mktemp -d /tmp/.swift-nio-syscall-wrappers-sh-test_XXXXXX)
mkdir "$tmpdir/syscallwrapper"
cd "$tmpdir/syscallwrapper"
swift package init --type=executable
cat > "$tmpdir/syscallwrapper/Sources/syscallwrapper/main.swift" <<EOF

main_path="$tmpdir/syscallwrapper/Sources/main.swift"
if [[ -d "$tmpdir/syscallwrapper/Sources/syscallwrapper/" ]]; then
main_path="$tmpdir/syscallwrapper/Sources/syscallwrapper/main.swift"
fi

cat > "$main_path" <<EOF
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
import Darwin
#else
Expand Down

0 comments on commit 61043a3

Please sign in to comment.