Skip to content

Commit 5ee9e87

Browse files
authored
Merge pull request #318 from MrMage/rebuild-carthage
Minor tweaks in preparation for SwiftGRPCNIO.
2 parents d00d987 + 7e6e28c commit 5ee9e87

File tree

11 files changed

+4766
-4412
lines changed

11 files changed

+4766
-4412
lines changed

.travis-install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
cd
2929
mkdir -p local
3030

31-
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
31+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
3232
PROTOC_URL=https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-osx-x86_64.zip
3333
else
3434
# Install swift
@@ -43,7 +43,7 @@ fi
4343
# Install protoc
4444
echo $PROTOC_URL
4545
curl -fSsL $PROTOC_URL -o protoc.zip
46-
unzip protoc.zip -d local
46+
unzip -q protoc.zip -d local
4747

4848
# Verify installation
4949
find local

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ script:
5454
- echo -en 'travis_fold:start:swift.resolve-deps\\r' && swift package -v resolve && echo -en 'travis_fold:end:swift.resolve-deps\\r'
5555
- echo -en 'travis_fold:start:make.all\\r' && make all && echo -en 'travis_fold:end:make.all\\r'
5656
- echo -en 'travis_fold:start:make.test\\r' && make test && echo -en 'travis_fold:end:make.test\\r'
57-
- echo -en 'travis_fold:start:make.test-plugin\\r' && make test-plugin && echo -en 'travis_fold:end:make.test-plugin\\r'
58-
- echo -en 'travis_fold:start:make.test-echo\\r' && make test-echo && echo -en 'travis_fold:end:make.test-echo\\r'
57+
- echo -en 'travis_fold:start:make.test_plugin\\r' && make test-plugin && echo -en 'travis_fold:end:make.test_plugin\\r'
58+
- echo -en 'travis_fold:start:make.test_echo\\r' && make test-echo && echo -en 'travis_fold:end:make.test_echo\\r'
5959
- echo -en 'travis_fold:start:make.project\\r' && if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make project; fi && echo -en 'travis_fold:end:make.project\\r'
60-
- echo -en 'travis_fold:start:make.build-carthage\\r' && if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make clean && make build-carthage-debug; fi && echo -en 'travis_fold:end:make.build-carthage\\r'

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ xcodebuild: project
4343
xcodebuild -project SwiftGRPC.xcodeproj -configuration "Debug" -parallelizeTargets -target SwiftGRPC -target Echo -target Simple -target protoc-gen-swiftgrpc build
4444

4545
build-carthage:
46-
carthage build --no-skip-current
46+
carthage build -project SwiftGRPC-Carthage.xcodeproj --no-skip-current
4747

4848
build-carthage-debug:
49-
carthage build --no-skip-current --configuration Debug --platform iOS, macOS
49+
carthage build -project SwiftGRPC-Carthage.xcodeproj --no-skip-current --configuration Debug --platform iOS, macOS
5050

5151
clean:
5252
-rm -rf Packages
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
/*
2+
* Copyright 2016, gRPC Authors All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import Foundation
17+
18+
/// Status codes for gRPC operations (replicated from status_code_enum.h)
19+
public enum StatusCode: Int {
20+
/// Not an error; returned on success.
21+
case ok = 0
22+
23+
/// The operation was cancelled (typically by the caller).
24+
case cancelled = 1
25+
26+
/// Unknown error. An example of where this error may be returned is if a
27+
/// Status value received from another address space belongs to an error-space
28+
/// that is not known in this address space. Also errors raised by APIs that
29+
/// do not return enough error information may be converted to this error.
30+
case unknown = 2
31+
32+
/// Client specified an invalid argument. Note that this differs from
33+
/// FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are
34+
/// problematic regardless of the state of the system (e.g., a malformed file
35+
/// name).
36+
case invalidArgument = 3
37+
38+
/// Deadline expired before operation could complete. For operations that
39+
/// change the state of the system, this error may be returned even if the
40+
/// operation has completed successfully. For example, a successful response
41+
/// from a server could have been delayed long enough for the deadline to
42+
/// expire.
43+
case deadlineExceeded = 4
44+
45+
/// Some requested entity (e.g., file or directory) was not found.
46+
case notFound = 5
47+
48+
/// Some entity that we attempted to create (e.g., file or directory) already
49+
/// exists.
50+
case alreadyExists = 6
51+
52+
/// The caller does not have permission to execute the specified operation.
53+
/// PERMISSION_DENIED must not be used for rejections caused by exhausting
54+
/// some resource (use RESOURCE_EXHAUSTED instead for those errors).
55+
/// PERMISSION_DENIED must not be used if the caller can not be identified
56+
/// (use UNAUTHENTICATED instead for those errors).
57+
case permissionDenied = 7
58+
59+
/// The request does not have valid authentication credentials for the
60+
/// operation.
61+
case unauthenticated = 16
62+
63+
/// Some resource has been exhausted, perhaps a per-user quota, or perhaps the
64+
/// entire file system is out of space.
65+
case resourceExhausted = 8
66+
67+
/// Operation was rejected because the system is not in a state required for
68+
/// the operation's execution. For example, directory to be deleted may be
69+
/// non-empty, an rmdir operation is applied to a non-directory, etc.
70+
///
71+
/// A litmus test that may help a service implementor in deciding
72+
/// between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:
73+
/// (a) Use UNAVAILABLE if the client can retry just the failing call.
74+
/// (b) Use ABORTED if the client should retry at a higher-level
75+
/// (e.g., restarting a read-modify-write sequence).
76+
/// (c) Use FAILED_PRECONDITION if the client should not retry until
77+
/// the system state has been explicitly fixed. E.g., if an "rmdir"
78+
/// fails because the directory is non-empty, FAILED_PRECONDITION
79+
/// should be returned since the client should not retry unless
80+
/// they have first fixed up the directory by deleting files from it.
81+
/// (d) Use FAILED_PRECONDITION if the client performs conditional
82+
/// REST Get/Update/Delete on a resource and the resource on the
83+
/// server does not match the condition. E.g., conflicting
84+
/// read-modify-write on the same resource.
85+
case failedPrecondition = 9
86+
87+
/// The operation was aborted, typically due to a concurrency issue like
88+
/// sequencer check failures, transaction aborts, etc.
89+
///
90+
/// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED,
91+
/// and UNAVAILABLE.
92+
case aborted = 10
93+
94+
/// Operation was attempted past the valid range. E.g., seeking or reading
95+
/// past end of file.
96+
///
97+
/// Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed
98+
/// if the system state changes. For example, a 32-bit file system will
99+
/// generate INVALID_ARGUMENT if asked to read at an offset that is not in the
100+
/// range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from
101+
/// an offset past the current file size.
102+
///
103+
/// There is a fair bit of overlap between FAILED_PRECONDITION and
104+
/// OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error)
105+
/// when it applies so that callers who are iterating through a space can
106+
/// easily look for an OUT_OF_RANGE error to detect when they are done.
107+
case outOfRange = 11
108+
109+
/// Operation is not implemented or not supported/enabled in this service.
110+
case unimplemented = 12
111+
112+
/// Internal errors. Means some invariants expected by underlying System has
113+
/// been broken. If you see one of these errors, Something is very broken.
114+
case internalError = 13
115+
116+
/// The service is currently unavailable. This is a most likely a transient
117+
/// condition and may be corrected by retrying with a backoff.
118+
///
119+
/// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED,
120+
/// and UNAVAILABLE.
121+
case unavailable = 14
122+
123+
/// Unrecoverable data loss or corruption.
124+
case dataLoss = 15
125+
126+
/// Force users to include a default branch:
127+
case doNotUse = -1
128+
}

Sources/SwiftGRPC/Core/gRPC.swift

Lines changed: 0 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -46,115 +46,3 @@ public final class gRPC {
4646
return String(cString: grpc_g_stands_for(), encoding: String.Encoding.utf8)!
4747
}
4848
}
49-
50-
/// Status codes for gRPC operations (replicated from status_code_enum.h)
51-
public enum StatusCode: Int {
52-
/// Not an error; returned on success.
53-
case ok = 0
54-
55-
/// The operation was cancelled (typically by the caller).
56-
case cancelled = 1
57-
58-
/// Unknown error. An example of where this error may be returned is if a
59-
/// Status value received from another address space belongs to an error-space
60-
/// that is not known in this address space. Also errors raised by APIs that
61-
/// do not return enough error information may be converted to this error.
62-
case unknown = 2
63-
64-
/// Client specified an invalid argument. Note that this differs from
65-
/// FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are
66-
/// problematic regardless of the state of the system (e.g., a malformed file
67-
/// name).
68-
case invalidArgument = 3
69-
70-
/// Deadline expired before operation could complete. For operations that
71-
/// change the state of the system, this error may be returned even if the
72-
/// operation has completed successfully. For example, a successful response
73-
/// from a server could have been delayed long enough for the deadline to
74-
/// expire.
75-
case deadlineExceeded = 4
76-
77-
/// Some requested entity (e.g., file or directory) was not found.
78-
case notFound = 5
79-
80-
/// Some entity that we attempted to create (e.g., file or directory) already
81-
/// exists.
82-
case alreadyExists = 6
83-
84-
/// The caller does not have permission to execute the specified operation.
85-
/// PERMISSION_DENIED must not be used for rejections caused by exhausting
86-
/// some resource (use RESOURCE_EXHAUSTED instead for those errors).
87-
/// PERMISSION_DENIED must not be used if the caller can not be identified
88-
/// (use UNAUTHENTICATED instead for those errors).
89-
case permissionDenied = 7
90-
91-
/// The request does not have valid authentication credentials for the
92-
/// operation.
93-
case unauthenticated = 16
94-
95-
/// Some resource has been exhausted, perhaps a per-user quota, or perhaps the
96-
/// entire file system is out of space.
97-
case resourceExhausted = 8
98-
99-
/// Operation was rejected because the system is not in a state required for
100-
/// the operation's execution. For example, directory to be deleted may be
101-
/// non-empty, an rmdir operation is applied to a non-directory, etc.
102-
///
103-
/// A litmus test that may help a service implementor in deciding
104-
/// between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:
105-
/// (a) Use UNAVAILABLE if the client can retry just the failing call.
106-
/// (b) Use ABORTED if the client should retry at a higher-level
107-
/// (e.g., restarting a read-modify-write sequence).
108-
/// (c) Use FAILED_PRECONDITION if the client should not retry until
109-
/// the system state has been explicitly fixed. E.g., if an "rmdir"
110-
/// fails because the directory is non-empty, FAILED_PRECONDITION
111-
/// should be returned since the client should not retry unless
112-
/// they have first fixed up the directory by deleting files from it.
113-
/// (d) Use FAILED_PRECONDITION if the client performs conditional
114-
/// REST Get/Update/Delete on a resource and the resource on the
115-
/// server does not match the condition. E.g., conflicting
116-
/// read-modify-write on the same resource.
117-
case failedPrecondition = 9
118-
119-
/// The operation was aborted, typically due to a concurrency issue like
120-
/// sequencer check failures, transaction aborts, etc.
121-
///
122-
/// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED,
123-
/// and UNAVAILABLE.
124-
case aborted = 10
125-
126-
/// Operation was attempted past the valid range. E.g., seeking or reading
127-
/// past end of file.
128-
///
129-
/// Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed
130-
/// if the system state changes. For example, a 32-bit file system will
131-
/// generate INVALID_ARGUMENT if asked to read at an offset that is not in the
132-
/// range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from
133-
/// an offset past the current file size.
134-
///
135-
/// There is a fair bit of overlap between FAILED_PRECONDITION and
136-
/// OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error)
137-
/// when it applies so that callers who are iterating through a space can
138-
/// easily look for an OUT_OF_RANGE error to detect when they are done.
139-
case outOfRange = 11
140-
141-
/// Operation is not implemented or not supported/enabled in this service.
142-
case unimplemented = 12
143-
144-
/// Internal errors. Means some invariants expected by underlying System has
145-
/// been broken. If you see one of these errors, Something is very broken.
146-
case internalError = 13
147-
148-
/// The service is currently unavailable. This is a most likely a transient
149-
/// condition and may be corrected by retrying with a backoff.
150-
///
151-
/// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED,
152-
/// and UNAVAILABLE.
153-
case unavailable = 14
154-
155-
/// Unrecoverable data loss or corruption.
156-
case dataLoss = 15
157-
158-
/// Force users to include a default branch:
159-
case doNotUse = -1
160-
}

0 commit comments

Comments
 (0)