Skip to content

Commit b722521

Browse files
authored
Don't add c-ares/CMakeFiles dir to exclusion list if doesn't exist (#4)
Motivation: `c-ares/CMakeFiles/` doesn't exist unless cmake is run locally. User reports that the exclude line causes SwiftPM warning about invalid exclude. Modification: Add `c-ares/CMakeFiles/` to exclude list iff it exists and is non-empty.
1 parent 48bb739 commit b722521

File tree

4 files changed

+41
-13
lines changed

4 files changed

+41
-13
lines changed

Package.swift

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
// swift-tools-version:5.0
2+
3+
import class Foundation.FileManager
24
import PackageDescription
35

6+
var caresExclude = [
7+
"./c-ares/acountry.c",
8+
"./c-ares/adig.c",
9+
"./c-ares/ahost.c",
10+
"./c-ares/ares_android.c",
11+
"./c-ares/windows_port.c",
12+
"./c-ares/test/",
13+
]
14+
15+
do {
16+
if !(try FileManager.default.contentsOfDirectory(atPath: "./Sources/CAsyncDNSResolver/c-ares/CMakeFiles").isEmpty) {
17+
caresExclude.append("./c-ares/CMakeFiles/")
18+
}
19+
} catch {
20+
// Assume CMakeFiles does not exist so no need to exclude it
21+
}
22+
423
let package = Package(
524
name: "swift-async-dns-resolver",
625
products: [
@@ -12,15 +31,7 @@ let package = Package(
1231
targets: [
1332
.target(
1433
name: "CAsyncDNSResolver", dependencies: [],
15-
exclude: [
16-
"./c-ares/acountry.c",
17-
"./c-ares/adig.c",
18-
"./c-ares/ahost.c",
19-
"./c-ares/ares_android.c",
20-
"./c-ares/windows_port.c",
21-
"./c-ares/CMakeFiles/",
22-
"./c-ares/test/",
23-
],
34+
exclude: caresExclude,
2435
sources: ["./c-ares"],
2536
cSettings: [
2637
.headerSearchPath("./c-ares"),

docker/docker-compose.1804.54.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: "3"
2+
3+
services:
4+
5+
runtime-setup:
6+
image: swift-async-dns-resolver:18.04-5.4
7+
build:
8+
args:
9+
base_image: "swiftlang/swift:nightly-5.4-bionic"
10+
11+
test:
12+
image: swift-async-dns-resolver:18.04-5.4
13+
environment: []
14+
#- SANITIZER_ARG=--sanitize=thread
15+
16+
shell:
17+
image: swift-async-dns-resolver:18.04-5.4

docker/docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ services:
2222
- CAP_NET_RAW
2323
- CAP_NET_BIND_SERVICE
2424

25-
sanity:
25+
soundness:
2626
<<: *common
27-
command: /bin/bash -xcl "./scripts/sanity.sh"
27+
command: /bin/bash -xcl "./scripts/soundness.sh"
2828

2929
test:
3030
<<: *common

scripts/sanity.sh renamed to scripts/soundness.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
##
44
## This source file is part of the SwiftAsyncDNSResolver open source project
55
##
6-
## Copyright (c) 2020 Apple Inc. and the SwiftAsyncDNSResolver project authors
6+
## Copyright (c) 2020-2021 Apple Inc. and the SwiftAsyncDNSResolver project authors
77
## Licensed under Apache License v2.0
88
##
99
## See LICENSE.txt for license information
@@ -18,7 +18,7 @@ here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1818

1919
function replace_acceptable_years() {
2020
# this needs to replace all acceptable forms with 'YEARS'
21-
sed -e 's/2017-201[89]/YEARS/' -e 's/2019-2020/YEARS/' -e 's/2019/YEARS/' -e 's/2020/YEARS/'
21+
sed -e 's/2020-2021/YEARS/' -e 's/2020/YEARS/' -e 's/2021/YEARS/'
2222
}
2323

2424
printf "=> Checking format... "

0 commit comments

Comments
 (0)