Mohsen Moradi
Mohsen Moradi

Reputation: 1

Compile Akka actor files using scalac command

I wrote a sample compiler plugin for Scala. I tested it on two following sample files:

scalac -Xplugin: Test.jar *.scala

A:

     package pkg {
             class A {
                 def compute(): Int = 42
              }
        }

B:

    import pkg._
          class B {
          def fun(): Unit = {
              new A().compute()
          }
       }

I need to test this plugin on Akka scala files(https://github.com/akka/akka/tree/v2.6.10/akka-actor/src/main/scala/akka), but it shows thousands of errors because it can not compile the Akka files. In another word, how can I compile Akka actor files with this command:

scalac *.scala

Upvotes: 0

Views: 50

Answers (1)

andreaTP
andreaTP

Reputation: 116

To compile the Akka project directly with scalac you have to add all of the options sbt injects and somehow provide the additional sources that sbt generates at build time(e.g. the Version and more).

You can still easily inject a compiler plugin re-using the sbt build. You can take inspiration on how it is done here for Scala 3 plugin, or, similarly, here for a Scala 2 one.

Upvotes: 1

Related Questions