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

Package name end with .Protobuf in proto3 #130

Open
langyanduan opened this issue Apr 22, 2016 · 3 comments
Open

Package name end with .Protobuf in proto3 #130

langyanduan opened this issue Apr 22, 2016 · 3 comments
Labels

Comments

@langyanduan
Copy link

protoc
$ brew update
$ brew install protobuf --devel --verbose
...
$ protoc --version
libprotoc 3.0.0
protobuf-swift
$ git clone https://github.com/alexeyxo/protobuf-swift
$ git checkout -b ProtoBuf3.0-Swift2.0 origin/ProtoBuf3.0-Swift2.0
$ ./scripts/build.sh
Cocoapods
pod 'ProtocolBuffers-Swift', :git => 'https://github.com/alexeyxo/protobuf-swift', :branch => 'ProtoBuf3.0-Swift2.0'

Error

if named package end with .Protobuf, the swift file will has wrong package name.

.proto file

syntax = "proto3";
package Swift.Protobuf;

.swift file

// Generated by the Protocol Buffers 3.0 compiler.  DO NOT EDIT!
// Source file "api.proto"
// Syntax "Proto3"

import Foundation
import ProtocolBuffers


public struct Swift { public extension Protobuf}

OK

if package named end with other word like Swift.Protobuf1, it's look good.

.proto file

syntax = "proto3";
package Swift.Protobuf1;

.swift file

// Generated by the Protocol Buffers 3.0 compiler.  DO NOT EDIT!
// Source file "api.proto"
// Syntax "Proto3"

import Foundation
import ProtocolBuffers


public struct Swift { public extension Protobuf1 { }}

@alexeyxo
Copy link
Owner

The word "Protobuf" is a reserved name for standard packages from google.

@langyanduan
Copy link
Author

"Google.Protobuf" is a reserved name? But i see other language can supports "xxx.Protobuf" as package name.

@kosciej
Copy link

kosciej commented May 5, 2016

I confirm, other languages support package name like com.something.somethingelse.protobuf. "protobuf" in package name doesn't seem to be reserved word.

I've encountered the same issue when tried to compile proto file from my project (actively used with several mainstream languages).

@alexeyxo alexeyxo reopened this May 5, 2016
@alexeyxo alexeyxo added the bug label May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants