-
Notifications
You must be signed in to change notification settings - Fork 435
Enable InternalImportsByDefault
in remaining modules
#2042
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -29,7 +29,7 @@ bin_path=$(swift build -c release --show-bin-path) | |||
protoc_gen_swift="$bin_path/protoc-gen-swift" | ||||
protoc_generate_grpc_swift="$bin_path/protoc-gen-grpc-swift" | ||||
|
||||
# Genreates gRPC by invoking protoc with the gRPC Swift plugin. | ||||
# Generates gRPC by invoking protoc with the gRPC Swift plugin. | ||||
# Parameters: | ||||
# - $1: .proto file | ||||
# - $2: proto path | ||||
|
@@ -46,7 +46,7 @@ function generate_grpc { | |||
invoke_protoc "${args[@]}" "$proto" | ||||
} | ||||
|
||||
# Genreates messages by invoking protoc with the Swift plugin. | ||||
# Generates messages by invoking protoc with the Swift plugin. | ||||
# Parameters: | ||||
# - $1: .proto file | ||||
# - $2: proto path | ||||
|
@@ -228,8 +228,8 @@ function generate_service_messages_interop_tests { | |||
local output="$root/Sources/InteroperabilityTests/Generated" | ||||
|
||||
for proto in "${protos[@]}"; do | ||||
generate_message "$proto" "$here/tests/interoperability" "$output" "Visibility=Public" "FileNaming=DropPath" | ||||
generate_grpc "$proto" "$here/tests/interoperability" "$output" "Visibility=Public" "Server=true" "_V2=true" "FileNaming=DropPath" | ||||
generate_message "$proto" "$here/tests/interoperability" "$output" "Visibility=Public" "FileNaming=DropPath" "UseAccessLevelOnImports=true" | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this the default for protobuf? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's the default only if compiling with Swift 6 (it defaults to false on <6). Since we use this only in the v2 modules I could get rid of it, but I thought it was clearer. I can get rid of it though, I don't think it matters. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha. I think we should be consistent with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, protobuf uses Swift 6 language mode: We default to true but ignore it in v1:
This means if you use gRPC Swift v2 with a Swift 6 compiler but in Swift 5 language mode you get imports for gRPC but not Protobuf (unless you specify otherwise). Would you mind changing our options to match Protobuf? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, good catch! Fixed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Half fixed 🙃 Can we have the args to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, so I've been playing around with this and I think we've got a bit of a problem. We could get around this on gRPC and get the right default if, in the I'm starting to think we should just change the option defaults to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. I think the behaviour we really want is dependent on the language mode of the module into which the code is being generated which isn't possible for us to know. Failing that I think doing it based on the compiler version is reasonable. |
||||
generate_grpc "$proto" "$here/tests/interoperability" "$output" "Visibility=Public" "Server=true" "_V2=true" "FileNaming=DropPath" "UseAccessLevelOnImports=true" | ||||
done | ||||
} | ||||
|
||||
|
@@ -260,8 +260,8 @@ function generate_health_service { | |||
local proto="$here/upstream/grpc/health/v1/health.proto" | ||||
local output="$root/Sources/Services/Health/Generated" | ||||
|
||||
generate_message "$proto" "$(dirname "$proto")" "$output" "Visibility=Package" | ||||
generate_grpc "$proto" "$(dirname "$proto")" "$output" "Visibility=Package" "Client=true" "Server=true" "_V2=true" | ||||
generate_message "$proto" "$(dirname "$proto")" "$output" "Visibility=Package" "UseAccessLevelOnImports=true" | ||||
generate_grpc "$proto" "$(dirname "$proto")" "$output" "Visibility=Package" "Client=true" "Server=true" "_V2=true" "UseAccessLevelOnImports=true" | ||||
} | ||||
|
||||
#------------------------------------------------------------------------------ | ||||
|
Uh oh!
There was an error while loading. Please reload this page.