-
Notifications
You must be signed in to change notification settings - Fork 31
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
follow up with maintainers of externally maintained alpakka connectors #23
Comments
I have used the following code to use source generators and search/replace on the imports to publish the same library for akka and pekko: import sbt._
object PekkoMigration {
def generatePekkoSourcesFromAkka(scalaSourceDirectory: File, sourceManagedDir: File): Seq[File] = {
val scalaFiles: PathFinder = scalaSourceDirectory ** "*.scala"
//collect the files
val filesToBeCopied: Seq[(File, File)] = scalaFiles.get().map { f =>
val Some(relative) = scalaSourceDirectory.relativize(f)
val target: File = sourceManagedDir / relative.toPath.toString
(f, target)
}
//copy the files
val copiedFiles = IO.copy(filesToBeCopied).toSeq
//rewrite imports
copiedFiles.map { f =>
val modifiedLines = IO.readLines(f).map {
case l if l.startsWith("import akka.stream.alpakka") =>
l.replaceFirst("import akka.stream.alpakka", "import org.apache.pekko.stream.connectors")
case l if l.startsWith("import akka") =>
l.replaceFirst("import akka", "import org.apache.pekko")
case l => l
}
IO.writeLines(f, modifiedLines)
f
}
}
} and then you can use it like this Compile / sourceGenerators += Def.task {
PekkoMigration.generatePekkoSourcesFromAkka((AKKA_PROJECT / Compile / scalaSource).value, (Compile / sourceManaged).value)
}.taskValue It is not very fancy (i.e it does not use scalafix) but gets the job done for small libs |
with the Kinesis alternatives, I've logged issues in those projects |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: