He-Pin commented on code in PR #746:
URL: https://github.com/apache/pekko-grpc/pull/746#discussion_r3466902267


##########
sbt-plugin/src/main/scala/org/apache/pekko/grpc/sbt/PekkoGrpcPlugin.scala:
##########
@@ -117,7 +117,28 @@ object PekkoGrpcPlugin extends AutoPlugin {
         pekkoGrpcCodeGeneratorSettings / target := crossTarget.value / 
"pekko-grpc" / Defaults.nameForSrc(
           configuration.value.name),
         managedSourceDirectories += (pekkoGrpcCodeGeneratorSettings / 
target).value,
-        unmanagedResourceDirectories ++= (PB.recompile / 
resourceDirectories).value,
+        packageBin / mappings := {
+          val existingMappings = (packageBin / mappings).value
+          val unpackedFiles = PB.unpackDependencies.value.files
+          val mappingsToAdd =
+            
unpackedFiles.pair(Path.relativeTo(Seq(PB.externalSourcePath.value, 
PB.externalIncludePath.value)))
+          @scala.annotation.tailrec
+          def withoutDuplicates(soFar: List[(File, String)], seen: 
Set[String], toAdd: Seq[(File, String)])
+              : Seq[(File, String)] = {
+            toAdd.headOption match {
+              case Some((file, string)) =>
+                if (seen.contains(string)) {
+                  withoutDuplicates(soFar, seen, toAdd.tail)
+                } else {
+                  withoutDuplicates((file, string) :: soFar, seen + string, 
toAdd.tail)

Review Comment:
   Why not just a mutable hashSet?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to