Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Q] xcodebuild with Swift Package Failed #280

Closed
HevaWu opened this issue Feb 21, 2020 · 6 comments
Closed

[Q] xcodebuild with Swift Package Failed #280

HevaWu opened this issue Feb 21, 2020 · 6 comments

Comments

@HevaWu
Copy link

HevaWu commented Feb 21, 2020

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()
@HevaWu HevaWu changed the title [Q] [Q] xcodebuild with Swift Package Failed Feb 21, 2020
@HevaWu
Copy link
Author

HevaWu commented Feb 25, 2020

@ishkawa , Sorry for the direct mention.
Could you help checking this problem? 😭

@ikesyo
Copy link
Collaborator

ikesyo commented Feb 25, 2020

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:

// Workaround for http://www.openradar.me/19809067
// This issue only occurs on iOS 8

@HevaWu
Copy link
Author

HevaWu commented Feb 25, 2020

@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?

@HevaWu
Copy link
Author

HevaWu commented Feb 25, 2020

@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!! 😄

@HevaWu HevaWu closed this as completed Feb 25, 2020
@ikesyo
Copy link
Collaborator

ikesyo commented Feb 25, 2020

I'm glad to hear that 😄

@HevaWu
Copy link
Author

HevaWu commented Feb 26, 2020

Thank you for all of the help !! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants