How to configure external build with scala

I was able to configure External Build with scala plugin (v.0.7.41). Here are my steps:

1. Open Settings -> Compiler and select "Use external build". Close the dialog
Screen Shot 2012-12-19 at 6.24.53 PM.png

2. Open Project Structure -> Global Libraries and create a library with scala-library.jar and scala-compiler.jar files. Right now scala plugin has these names hardcoded and will fail if you use different names.
Screen Shot 2012-12-19 at 6.23.51 PM.png

3. Open Project Structure -> Facets and in every scala facet select the library created in step #2 as Compiler Library.
Screen Shot 2012-12-19 at 6.26.17 PM.png

4. Stop FSC if you have it running. There is and icon in the status bar. Click and select Stop.
Screen Shot 2012-12-19 at 6.28.14 PM.png
5. Build -> Make

0
13 comments

Not for me. When I try to compile anything I get Unknown source file errors. eg:

: Error: Unknown source file: /mnt/ssd/si/vimana.dev/servers/si-infra/src/main/scala/com/mongodb/ErrorInterceptingDB.scala
java.lang.RuntimeException: Unknown source file: /mnt/ssd/si/vimana.dev/servers/si-infra/src/main/scala/com/mongodb/ErrorInterceptingDB.scala

0

Is that from an external hard drive?

0

No, its my SSD. Its internal. However the directory containing the idea project is soft linked to the SSD (on lunix).

0

step #2 is not required if you use plugin >= 0.7.49

0

does it work when you don't have soft links in your project?

0

FSC vs External build & Zinc

I just run full rebuild several times on a project that consits of 28 modules. Production code is mostly java with several scala files. Tests written in scala and java.

FSC

cold 2 min 46 sec
warm 2 min 21 sec
warm 2 min 16 sec

External build & Zinc

cold 2 min 2 sec
warm 1 min 27 sec
warm 1 min 25 sec

Conclusion

Warm external builder with zinc is 50 sec faster than warm FSC on one of our projects.
1 min 25 sec (zinc) vs 2 min 16 sec (FSC)

The first process in the list is external compiler with zinc
processes.png

0

Interesting results on a single module 100% scala liftweb 2.4 project

Leda IU-123.95, plugin 0.7.61, java 6, scala 2.9.1, macosx 10.8.2

I did Build -> Rebuild Project several times. The first run is cold, 2nd and 3rd could be considered warm runs (VM should optimize/compile some compiler code already).

FSC

cold 1m 50 sec
warm 1m 7 sec
warm 1m 3 sec

External build & Zinc

cold 2 min 12 sec
warm 1 min 33 sec
warm 1 min 28 sec
warm 1 min 26 sec

Looks like on as single module project (only scala code) doing Rebuild is faster with FSC in IDEA.

0

The problem with links is fixed in the latest plugin builds.

0

Probably you are using "compile independent modules in parallel" option?

Best regards,
Alexander Podkhalyuzin.

0

No, I don't use "compile independent modules in parallel" option. It doesn't work in my case. When I open a project with ~ 20 java modules with tests written in scala IDEA fails to resolve dependencies between these modules correctly.

0
Avatar
Stefan Endrullis

I have a single module proejct consisting of Scala and some Java files and I discovered the same. FSC seems to be much faster than the new compiler system (around factor 2-3), especially when you have only minor changes in your code. To get sure about this I made a small test. I compiled by project with both compilers. Here are the results:

Cold run:
FSC: 3:15
New compiler: 3:35

Warm run when only a single line of code has changed (the for test I used exactly the same line of code and made the same change):
FSC: 8s
New compiler: 21s

I don't really care about the cold run, since I do it only once in a month.  But what I care about are warm runs, because they are executed more than 100 times a day and they majorly influence the time to test and debug code.
Is this difference between FSC and the new compiler supposed to be?
Did I have to set certain compiler options to increase the speed?
I already set the same parameters for both compilers (Xmx, max heap size) but it didn't change anything.
The option "Run compiler server (in external build mode)" is checked.  Does this mean IDEA uses nailgun to compile the project?

0

Hi Stefan, we'll check that soon.

0

Please sign in to leave a comment.