Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/golden/testdata/scala/BUILD.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
exports_files(["config.yaml"])

# gazelle:proto_language scala enabled true
# gazelle:proto_rule proto_scala_library attr exports @com_google_protobuf//:protobuf_java
# gazelle:proto_rule proto_scala_library option --plugins=protoc-gen-scala
# gazelle:proto_rule grpc_scala_library option --plugins=protoc-gen-akka-grpc
1 change: 1 addition & 0 deletions example/golden/testdata/scala/BUILD.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
exports_files(["config.yaml"])

# gazelle:proto_language scala enabled true
# gazelle:proto_rule proto_scala_library attr exports @com_google_protobuf//:protobuf_java
# gazelle:proto_rule proto_scala_library option --plugins=protoc-gen-scala
# gazelle:proto_rule grpc_scala_library option --plugins=protoc-gen-akka-grpc
1 change: 1 addition & 0 deletions example/golden/testdata/scala/proto/BUILD.out
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ proto_scala_library(
name = "proto_proto_scala_library",
srcs = ["proto_scala.srcjar"],
visibility = ["//visibility:public"],
exports = ["@com_google_protobuf//:protobuf_java"],
deps = [
"@com_google_protobuf//:protobuf_java",
"@maven_scala//:com_thesamet_scalapb_lenses_2_12",
Expand Down
1 change: 1 addition & 0 deletions example/golden/testdata/scala/syntax/BUILD.out
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ proto_scala_library(
name = "syntax_proto_scala_library",
srcs = ["syntax_scala.srcjar"],
visibility = ["//visibility:public"],
exports = ["@com_google_protobuf//:protobuf_java"],
deps = [
"//lib:scala",
"//proto:proto_proto_scala_library",
Expand Down
12 changes: 10 additions & 2 deletions pkg/rule/rules_scala/scala_library.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ func (s *scalaLibrary) Name() string {
// KindInfo implements part of the LanguageRule interface.
func (s *scalaLibrary) KindInfo() rule.KindInfo {
return rule.KindInfo{
MergeableAttrs: map[string]bool{"srcs": true},
ResolveAttrs: map[string]bool{"deps": true},
MergeableAttrs: map[string]bool{
"srcs": true,
"exports": true,
},
ResolveAttrs: map[string]bool{"deps": true},
}
}

Expand Down Expand Up @@ -171,6 +174,11 @@ func (s *scalaLibraryRule) Rule(otherGen ...*rule.Rule) *rule.Rule {
newRule.SetAttr("deps", deps)
}

exports := s.ruleConfig.GetAttr("exports")
if len(exports) > 0 {
newRule.SetAttr("exports", exports)
}

visibility := s.Visibility()
if len(visibility) > 0 {
newRule.SetAttr("visibility", visibility)
Expand Down