-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid adding unnecessary imports to generated source files (#717)
* Only add the imports that are actually needed When generating Scala from protobuf files, only add imports for things that are actually referenced in that file. * Make ProtoSrcGenerator return a list of lines in the file Refactor for consistency with the other generators. It now returns a list of the lines in the generated file instead of a singleton list containing the whole file contents.
- Loading branch information
Showing
7 changed files
with
139 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
modules/idlgen/core/src/test/resources/proto/streaming_no_shapeless_no.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
syntax = "proto3"; | ||
|
||
package com.proto; | ||
|
||
message MyRequest { | ||
string a = 1; | ||
} | ||
|
||
message MyResponse { | ||
string a = 1; | ||
} | ||
|
||
service MyService { | ||
rpc GetThing (MyRequest) returns (MyResponse) {} | ||
} |
18 changes: 18 additions & 0 deletions
18
modules/idlgen/core/src/test/resources/proto/streaming_no_shapeless_yes.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
syntax = "proto3"; | ||
|
||
package com.proto; | ||
|
||
message MyRequest { | ||
oneof a { | ||
int32 b = 1; | ||
string c = 2; | ||
} | ||
} | ||
|
||
message MyResponse { | ||
string a = 1; | ||
} | ||
|
||
service MyService { | ||
rpc GetThing (MyRequest) returns (MyResponse) {} | ||
} |
15 changes: 15 additions & 0 deletions
15
modules/idlgen/core/src/test/resources/proto/streaming_yes_shapeless_no.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
syntax = "proto3"; | ||
|
||
package com.proto; | ||
|
||
message MyRequest { | ||
string a = 1; | ||
} | ||
|
||
message MyResponse { | ||
string a = 1; | ||
} | ||
|
||
service MyService { | ||
rpc GetThing (MyRequest) returns (stream MyResponse) {} | ||
} |
18 changes: 18 additions & 0 deletions
18
modules/idlgen/core/src/test/resources/proto/streaming_yes_shapeless_yes.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
syntax = "proto3"; | ||
|
||
package com.proto; | ||
|
||
message MyRequest { | ||
oneof a { | ||
int32 b = 1; | ||
string c = 2; | ||
} | ||
} | ||
|
||
message MyResponse { | ||
string a = 1; | ||
} | ||
|
||
service MyService { | ||
rpc GetThing (MyRequest) returns (stream MyResponse) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters