in maven-plugin/src/main/scala/org/apache/pekko/grpc/maven/AbstractGenerateMojo.scala [135:169]
def addGeneratedSourceRoot(generatedSourcesDir: String): Unit
override def execute(): Unit = {
val chosenLanguage = parseLanguage(language)
var directoryFound = false
protoPaths.forEach { protoPath =>
// verify proto dir exists
// https://maven.apache.org/plugin-developers/common-bugs.html#Resolving_Relative_Paths
val protoDir = {
val protoFile = new File(protoPath)
if (!protoFile.isAbsolute()) {
new File(project.getBasedir(), protoPath).toPath().normalize().toFile()
} else {
protoFile
}
}
if (protoDir.exists()) {
directoryFound = true
// generated sources should be compiled
val generatedSourcesDir = s"$outputDirectory/pekko-grpc${chosenLanguage.targetDirSuffix}"
val compileSourceRoot = {
val generatedSourcesFile = new File(generatedSourcesDir)
if (!generatedSourcesFile.isAbsolute()) {
new File(project.getBasedir(), generatedSourcesDir).toPath().normalize().toFile()
} else {
generatedSourcesFile
}
}
addGeneratedSourceRoot(generatedSourcesDir)
generate(chosenLanguage, compileSourceRoot, protoDir)
}
}
if (!directoryFound) sys.error(s"None of protobuf sources directories $protoPaths do not exist")
}