Skip to content

Commit

Permalink
scalapblib: fix transformer not picked up (#1626)
Browse files Browse the repository at this point in the history
Fix issue: #1625

Pull request: #1626
  • Loading branch information
borissmidt authored Dec 17, 2021
1 parent 65e1c59 commit 78acf98
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions contrib/scalapblib/src/ScalaPBWorker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ class ScalaPBWorker {

val instance = new ScalaPBWorkerApi {
override def compileScalaPB(
source: File,
root: File,
sources: Seq[File],
scalaPBOptions: String,
generatedDirectory: File,
otherArgs: Seq[String]
): Unit = {
val opts = if (scalaPBOptions.isEmpty) "" else scalaPBOptions + ":"
val args = otherArgs ++ Seq(
s"--scala_out=${opts}${generatedDirectory.getCanonicalPath}",
s"--proto_path=${source.getParentFile.getCanonicalPath}",
source.getCanonicalPath
)
s"--proto_path=${root.getCanonicalPath}"
) ++ sources.map(_.getCanonicalPath)
ctx.log.debug(s"ScalaPBC args: ${args.mkString(" ")}")
mainMethod.invoke(null, args.toArray)
}
}
Expand Down Expand Up @@ -86,10 +87,12 @@ class ScalaPBWorker {
def compileScalaPBDir(inputDir: os.Path): Unit = {
// ls throws if the path doesn't exist
if (inputDir.toIO.exists) {
os.walk(inputDir).filter(_.last.matches(".*.proto"))
.foreach { proto =>
compiler.compileScalaPB(proto.toIO, scalaPBOptions, dest.toIO, scalaPBCExtraArgs)
}
val files = os
.walk(inputDir)
.filter(_.last.matches(".*.proto"))
.map(_.toIO)
.toIndexedSeq
compiler.compileScalaPB(inputDir.toIO, files, scalaPBOptions, dest.toIO, scalaPBCExtraArgs)
}
}

Expand All @@ -101,7 +104,8 @@ class ScalaPBWorker {

trait ScalaPBWorkerApi {
def compileScalaPB(
source: File,
root: File,
source: Seq[File],
scalaPBOptions: String,
generatedDirectory: File,
otherArgs: Seq[String]
Expand Down

0 comments on commit 78acf98

Please sign in to comment.