Code Monkey home page Code Monkey logo

Comments (12)

alexeyxo avatar alexeyxo commented on June 15, 2024

Hi. Please, send me a zip of the directory. I will look.

from protobuf-swift.

alexeyxo avatar alexeyxo commented on June 15, 2024

What command do you use to generate files?

from protobuf-swift.

mwildehahn avatar mwildehahn commented on June 15, 2024

For some reason gmail keeps bouncing the follow up email i'm trying to send.

If you take the zip i sent you and run:

mkdir src
tar -xvf protobufs.tar.gz
mv protobufs src
mkdir swift
find src -type f -name '*.proto' | xargs protoc --proto_path ./src --swift_out swift/

that should generate the protobufs with the errors

from protobuf-swift.

mwildehahn avatar mwildehahn commented on June 15, 2024

I'm still having issues with these nested protobufs.

From what I can tell, it seems like the order in which you define the structures you use to represent the package hierarchy matters. I'm not sure how the swift compiler determines the order these will get compiled if the definitions are in different files.

I'm sending you a couple of sample projects that demonstrate the issue.

If all of the definitions are in order within one file, everything builds correctly.

ie something like:

public struct Services { public struct Organization { public struct Actions { public struct CreateOrganization { }}}}
public extension Services { public struct Profile { public struct Actions { public struct GetExtendedProfile { }}}}
public extension Services.Profile { public struct Containers { public struct Profile { }}}
public extension Services.Organization { public struct Containers { public struct Organization { }}}
public extension Services.Organization.Containers { public struct Team { }}
public extension Services.Organization.Actions { public struct GetOrganization { }}

works in a playground.

as opposed to:

public extension Services.Organization.Actions { public struct GetOrganization { }}
public extension Services.Profile { public struct Containers { public struct Profile { }}}
public struct Services { public struct Organization { public struct Actions { public struct CreateOrganization { }}}}
public extension Services { public struct Profile { public struct Actions { public struct GetExtendedProfile { }}}}
public extension Services.Organization { public struct Containers { public struct Organization { }}}
public extension Services.Organization.Containers { public struct Team { }}

which fails with "'Profile' is not a member type of 'Services'"

from protobuf-swift.

mwildehahn avatar mwildehahn commented on June 15, 2024

https://developer.apple.com/swift/blog/?id=7

makes it clear why the above two don't work in the playground, the playgrounds are "order-dependent". i'm not sure why the project i sent you is not "order-independent" as it should be.

from protobuf-swift.

alexeyxo avatar alexeyxo commented on June 15, 2024

This is some kind of magic:)

from protobuf-swift.

alexeyxo avatar alexeyxo commented on June 15, 2024

I look this example in the weekend.

from protobuf-swift.

alexeyxo avatar alexeyxo commented on June 15, 2024

scrennproto
This is a bug in Xcode. When I change the order of files - all compiled :)

from protobuf-swift.

brandonroth avatar brandonroth commented on June 15, 2024

@mhahn did you file a bug report on this? I am having the same problem as you and changing the compile order fixes the problem for me. I think it would be worth it to add this edge case to the readme so others don't spin their wheels wondering why it doesn't work.

from protobuf-swift.

mwildehahn avatar mwildehahn commented on June 15, 2024

i never did, i guess now we could probably open an issue on the swift code
base?

On Tue, Feb 9, 2016 at 5:49 PM brandonroth [email protected] wrote:

@mhahn https://github.com/mhahn did you file a bug report on this? I am
having the same problem as you and changing the compile order fixes the
problem for me. I think it would be worth it to add this edge case to the
readme so others don't spin their wheels wondering why it doesn't work.


Reply to this email directly or view it on GitHub
#49 (comment)
.

from protobuf-swift.

brandonroth avatar brandonroth commented on June 15, 2024

I'm planning on creating a sample project to demonstrate the issue and file a bug report. Thanks for posting your solution of compile order, it saved my day!

from protobuf-swift.

mwildehahn avatar mwildehahn commented on June 15, 2024

thanks to @alexeyxo without his screenshot i wouldn't have known you can adjust compile order ;)

from protobuf-swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.