[Q] `xcodebuild` with Swift Package Failed
HevaWu opened this issue · 6 comments
Hi
Recently we are trying the use SwiftPackage of APIKit into our project. After importing, Xcode build successfully but the xcodebuild
command part failed.
By looking into the log, since APIKit have this code:
#if SWIFT_PACKAGE
class AbstractInputStream: InputStream {
init() {
super.init(data: Data())
}
}
#endif
and the overriding & super
related code failed. It looks like it cannot be archive the correct super one.
I would be appreciate if you could tell me how we could fix it.
Best regards
Here is the script of the failed log:
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:170:22: property does not override any property from its superclass
override var hasBytesAvailable: Bool {
^~~~~~~~~~~~~~
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:174:23: method does not override any method from its superclass
override func read(_ buffer: UnsafeMutablePointer<UInt8>, maxLength: Int) -> Int {
~~~~~~~~ ^
❌ SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:127:37: use of undeclared type 'AbstractInputStream'
internal class PartInputStream: AbstractInputStream {
~~~~~~~~ ^
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:259:22: property does not override any property from its superclass
override var streamStatus: Stream.Status {
^~~~~~~~~~~~~~~~~~~
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:263:22: property does not override any property from its superclass
override var hasBytesAvailable: Bool {
~~~~~~~~ ^
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:267:23: method does not override any method from its superclass
override func open() {
~~~~~~~~ ^
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:271:23: method does not override any method from its superclass
override func close() {
~~~~~~~~ ^
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:275:23: method does not override any method from its superclass
override func read(_ buffer: UnsafeMutablePointer<UInt8>, maxLength: Int) -> Int {
~~~~~~~~ ^
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:315:22: property does not override any property from its superclass
override var delegate: StreamDelegate? {
~~~~~~~~ ^
❌ SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:320:23: method does not override any method from its superclass
override func schedule(in aRunLoop: RunLoop, forMode mode: RunLoop.Mode) {
~~~~~~~~ ^
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:324:23: method does not override any method from its superclass
override func remove(from aRunLoop: RunLoop, forMode mode: RunLoop.Mode) {
~~~~~~~~ ^
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:215:42: use of undeclared type 'AbstractInputStream'
internal class MultipartInputStream: AbstractInputStream {
~~~~~~~~ ^
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:51:33: cannot convert value of type 'MultipartFormDataBodyParameters.MultipartInputStream' to expected argument type 'InputStream'
return .inputStream(inputStream)
^~~~~~~~~~~~~~~~~~~
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:54:48: cannot convert value of type 'MultipartFormDataBodyParameters.MultipartInputStream' to expected argument type 'InputStream'
return .data(try Data(inputStream: inputStream))
^~~~~~~~~~~
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:154:13: 'super' members cannot be referenced in a root class
super.init()
^~~~~~~~~~~
❌ /SourcePackages/checkouts/APIKit/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift:231:13: 'super' members cannot be referenced in a root class
super.init()
This is related to #160 and #209. It's unfortunate that Xcode 11's SwiftPM packages support is a bit different from usual SwiftPM CLI (swift build
command). Specifically the SWIFT_PACKAGE
condition is not set on Xcode 11's Swift packages build.
Regarding the AbstractInputStream
workaround used here, we should be able to remove the workaround if we bump iOS Deployment Target to 9 or above:
APIKit/Sources/APIKit/APIKit.h
Lines 8 to 9 in e5724dc
@ikesyo san
Thank you for the reply.
I've checked that the error only appears around ⬇️ .
https://github.com/ishkawa/APIKit/blob/master/Sources/APIKit/BodyParameters/MultipartFormDataBodyParameters.swift#L9-L15
I'm thinking maybe this setting have conflicts with our project SWIFT_ACTIVE_COMPILATION_CONDITIONS
flag.
I got that AbstractInputStream
is for fixing the iOS 8, do you have any plan that for iOS 9+, don't contain this code anymore?
@ikesyo san
Sorry for late reply.
Based on the SWIFT_PACKAGE
flag problem, we might find some solution for fixing the conflicts with our SWIFT_ACTIVE_COMPILATION_CONDITIONS
.
-> by setting our SWIFT_ACTIVE_COMPILATION_CONDITIONS
with $(inherited)
So I will close this ticket. :)
Have a nice day!! 😄
I'm glad to hear that 😄
Thank you for all of the help !! 👍