Skip to content

Commit c984b69

Browse files
committed
Merge branch 'develop' into main
2 parents d745581 + d77e9e8 commit c984b69

File tree

6 files changed

+136
-12
lines changed

6 files changed

+136
-12
lines changed

.github/workflows/swift.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: "20 9 * * 1"
8+
9+
jobs:
10+
linux:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
image:
16+
- swift:5.0.3-xenial
17+
- swift:5.1.5-xenial
18+
- swift:5.2.5-xenial
19+
- swift:5.3.2-xenial
20+
- swift:5.3.2-bionic
21+
container: ${{ matrix.image }}
22+
steps:
23+
- name: Checkout Repository
24+
uses: actions/checkout@v2
25+
- name: Build Swift Debug Package
26+
run: swift build -c debug
27+
- name: Build Swift Release Package
28+
run: swift build -c release
29+
nextstep:
30+
runs-on: macos-latest
31+
steps:
32+
- name: Select latest available Xcode
33+
uses: maxim-lobanov/[email protected]
34+
with:
35+
xcode-version: 12.2
36+
- name: Checkout Repository
37+
uses: actions/checkout@v2
38+
- name: Build Swift Debug Package
39+
run: swift build -c debug
40+
- name: Build Swift Release Package
41+
run: swift build -c release

Makefile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Makefile
2+
3+
# local config
4+
SWIFT_BUILD=swift build
5+
SWIFT_CLEAN=swift package clean
6+
SWIFT_BUILD_DIR=.build
7+
SWIFT_TEST=swift test
8+
CONFIGURATION=debug
9+
DOCKER=/usr/local/bin/docker
10+
#DOCKER=docker
11+
12+
# docker config
13+
SWIFT_BUILD_IMAGE="swift:5.0"
14+
#SWIFT_BUILD_IMAGE="swift:5.3.1"
15+
#SWIFT_BUILD_IMAGE="swift:5.1.3"
16+
DOCKER_BUILD_DIR=".docker$(SWIFT_BUILD_DIR)"
17+
SWIFT_DOCKER_BUILD_DIR="$(DOCKER_BUILD_DIR)/x86_64-unknown-linux/$(CONFIGURATION)"
18+
DOCKER_BUILD_PRODUCT="$(DOCKER_BUILD_DIR)/$(TOOL_NAME)"
19+
20+
21+
SWIFT_SOURCES=Sources/*/*.swift
22+
23+
all: all-native
24+
25+
#all: docker-all
26+
27+
all-native:
28+
$(SWIFT_BUILD) -c $(CONFIGURATION)
29+
30+
# Cannot test in `release` configuration?!
31+
test:
32+
$(SWIFT_TEST)
33+
34+
clean :
35+
$(SWIFT_CLEAN)
36+
# We have a different definition of "clean", might be just German
37+
# pickyness.
38+
rm -rf $(SWIFT_BUILD_DIR)
39+
40+
$(DOCKER_BUILD_PRODUCT): $(SWIFT_SOURCES)
41+
$(DOCKER) run --rm \
42+
-v "$(PWD):/src" \
43+
-v "$(PWD)/$(DOCKER_BUILD_DIR):/src/.build" \
44+
"$(SWIFT_BUILD_IMAGE)" \
45+
bash -c 'cd /src && swift build -c $(CONFIGURATION)'
46+
47+
docker-all: $(DOCKER_BUILD_PRODUCT)
48+
49+
docker-test: docker-all
50+
$(DOCKER) run --rm \
51+
-v "$(PWD):/src" \
52+
-v "$(PWD)/$(DOCKER_BUILD_DIR):/src/.build" \
53+
"$(SWIFT_BUILD_IMAGE)" \
54+
bash -c 'cd /src && swift test -c $(CONFIGURATION)'
55+
56+
docker-clean:
57+
rm $(DOCKER_BUILD_PRODUCT)
58+
59+
docker-distclean:
60+
rm -rf $(DOCKER_BUILD_DIR)
61+
62+
distclean: clean docker-distclean
63+
64+
docker-emacs:
65+
$(DOCKER) run --rm -it \
66+
-v "$(PWD):/src" \
67+
-v "$(PWD)/$(DOCKER_BUILD_DIR):/src/.build" \
68+
"$(SWIFT_BUILD_IMAGE)" \
69+
emacs /src

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ let package = Package(
1616
.package(url: "https://github.com/Macro-swift/MacroExpress.git",
1717
from: "0.6.0"),
1818
.package(url: "https://github.com/AlwaysRightInstitute/SwiftXmlRpc.git",
19-
from: "0.8.5")
19+
from: "0.8.6")
2020
],
2121

2222
targets: [

Sources/MacroXmlRpc/RouteKeeper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ public extension RouteKeeper {
1818
( XmlRpc.Call ) throws -> XmlRpcValueRepresentable)
1919
-> Self
2020
{
21-
post(xmlrpc.synchronousCall(methodName, execute: execute))
21+
return post(xmlrpc.synchronousCall(methodName, execute: execute))
2222
}
2323
}

Sources/MacroXmlRpc/TypedRoutes.swift

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public extension RouteKeeper {
2525
where A1 : IntrospectibleXmlRpcValue,
2626
R : IntrospectibleXmlRpcValue
2727
{
28-
post(xmlrpc.synchronousCall(methodName) { call in
28+
return post(xmlrpc.synchronousCall(methodName) { call in
2929
guard call.parameters.count == 1,
3030
let a1 = A1(xmlRpcValue: call.parameters[0])
3131
else { throw XmlRpc.Fault(code: 400, reason: "Invalid parameters") }
@@ -42,7 +42,7 @@ public extension RouteKeeper {
4242
A2 : IntrospectibleXmlRpcValue,
4343
R : IntrospectibleXmlRpcValue
4444
{
45-
post(xmlrpc.synchronousCall(methodName) { call in
45+
return post(xmlrpc.synchronousCall(methodName) { call in
4646
guard call.parameters.count == 2,
4747
let a1 = A1(xmlRpcValue: call.parameters[0]),
4848
let a2 = A2(xmlRpcValue: call.parameters[1])
@@ -57,27 +57,27 @@ public extension RouteKeeper {
5757

5858
extension String: IntrospectibleXmlRpcValue {
5959
@inlinable
60-
public static var xmlRpcValueType : XmlRpc.Value.ValueType { .string }
60+
public static var xmlRpcValueType : XmlRpc.Value.ValueType { return .string }
6161
}
6262

6363
extension Int: IntrospectibleXmlRpcValue {
6464
@inlinable
65-
public static var xmlRpcValueType : XmlRpc.Value.ValueType { .int }
65+
public static var xmlRpcValueType : XmlRpc.Value.ValueType { return .int }
6666
}
6767

6868
extension Double: IntrospectibleXmlRpcValue {
6969
@inlinable
70-
public static var xmlRpcValueType : XmlRpc.Value.ValueType { .double }
70+
public static var xmlRpcValueType : XmlRpc.Value.ValueType { return .double }
7171
}
7272

7373
extension Bool: IntrospectibleXmlRpcValue {
7474
@inlinable
75-
public static var xmlRpcValueType : XmlRpc.Value.ValueType { .bool }
75+
public static var xmlRpcValueType : XmlRpc.Value.ValueType { return .bool }
7676
}
7777

7878
extension Collection where Element : IntrospectibleXmlRpcValue {
7979
@inlinable
80-
public static var xmlRpcValueType : XmlRpc.Value.ValueType { .array }
80+
public static var xmlRpcValueType : XmlRpc.Value.ValueType { return .array }
8181
}
8282

8383
extension Array : IntrospectibleXmlRpcValue
@@ -94,7 +94,9 @@ extension Dictionary : IntrospectibleXmlRpcValue
9494
Value : IntrospectibleXmlRpcValue
9595
{
9696
@inlinable
97-
public static var xmlRpcValueType : XmlRpc.Value.ValueType { .dictionary }
97+
public static var xmlRpcValueType : XmlRpc.Value.ValueType {
98+
return .dictionary
99+
}
98100
}
99101

100102
#if canImport(Foundation)
@@ -103,11 +105,15 @@ extension Dictionary : IntrospectibleXmlRpcValue
103105

104106
extension DateComponents: IntrospectibleXmlRpcValue {
105107
@inlinable
106-
public static var xmlRpcValueType : XmlRpc.Value.ValueType { .dateTime }
108+
public static var xmlRpcValueType : XmlRpc.Value.ValueType {
109+
return .dateTime
110+
}
107111
}
108112

109113
extension URL: IntrospectibleXmlRpcValue {
110114
@inlinable
111-
public static var xmlRpcValueType : XmlRpc.Value.ValueType { .string }
115+
public static var xmlRpcValueType : XmlRpc.Value.ValueType {
116+
return .string
117+
}
112118
}
113119
#endif // canImport(Foundation)

Sources/MacroXmlRpc/ValueType.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import protocol XmlRpc.XmlRpcValueRepresentable
1010

1111
public extension XmlRpc.Value {
1212

13+
#if swift(>=5.1)
1314
/**
1415
* The various possible XML-RPC value types used in XML-RPC introspection.
1516
* Note that those are flat, i.e. arrays and dictionaries are not further
@@ -21,6 +22,13 @@ public extension XmlRpc.Value {
2122
case string, bool, int, double, dateTime, data
2223
case array, dictionary
2324
}
25+
#else
26+
enum ValueType: Hashable {
27+
case null
28+
case string, bool, int, double, dateTime, data
29+
case array, dictionary
30+
}
31+
#endif
2432

2533
@inlinable
2634
var xmlRpcValueType: ValueType {

0 commit comments

Comments
 (0)