8375: trying to build Scala plugin

Hi

I've installed build 8375 and the plugin dev kit available for the same build. I have the trunk sources for the Scala plugin and would like to try to build it.

I'm getting an error in two Scala plugin source files
org.jetbrains.plugins.scala.highlighter.ScalaEditorHighlighter: package not found for import (editor.ex)
import com.intellij.openapi.editor.ex.util.LayerDescriptor;
import com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter;

org.jetbrains.plugins.scala.lang.lexer.ScalaLexer: XmlLexer not found
import com.intellij.lexer.XmlLexer;

I thought maybe the Scala plugin trunk is using a newer build of IDEA (one that hasn't been released), OTOH, when I opened the project, it had references to IDEA-8187, which would be an older build.

I realize the Scala plugin is not a main priority for your team, still, if I could build it I may be able to help (or get others from the Scala community interested).


Thanks!
Patrick

11 comments
Comment actions Permalink

Patrick Wright wrote:

Hi

I've installed build 8375 and the plugin dev kit available for the same build. I have the trunk sources for the Scala plugin and would like to try to build it.

I'm getting an error in two Scala plugin source files
org.jetbrains.plugins.scala.highlighter.ScalaEditorHighlighter: package not found for import (editor.ex)
import com.intellij.openapi.editor.ex.util.LayerDescriptor;
import com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter;

org.jetbrains.plugins.scala.lang.lexer.ScalaLexer: XmlLexer not found
import com.intellij.lexer.XmlLexer;

I thought maybe the Scala plugin trunk is using a newer build of IDEA (one that hasn't been released), OTOH, when I opened the project, it had references to IDEA-8187, which would be an older build.

I realize the Scala plugin is not a main priority for your team, still, if I could build it I may be able to help (or get others from the Scala community interested).


Thanks!
Patrick


Add idea.jar to IntelliJ IDEA SDK or libraries

0
Comment actions Permalink

Thanks, that works, the references are resolved.

Two other questions:

1) both modules have a reference to a library called SCALA--what should this include? The reference only appears in Scala.iml and nowhere else.

2) what is the correct way to build the plugin? scala-core builds, but when I try to build the "Scala" module it can't find the compiled files from scala-core (I've checked, they are there).


Thanks!
Patrick

0
Comment actions Permalink

Answering my own question (for now)--not sure if I can build the project from IDEA itself at this point, but was able to build (with a couple of compile errors) by
- in $PROJECT_HOME/src, update scala.properties with the correct paths
- from the same directory, run ant (or ant rebuild.all, use ant -p to see all targets)


I get two compile errors (for the record, shown below), but will keep checking back as the source progresses. Am using Scala 2.7.1 final.

Looks like you all have been working pretty hard on this!

Thanks
Patrick



/home/patrick/dev/scala-plugin/scala_core/src/org/jetbrains/plugins/scala/lang/psi/ScalaFile.scala:26: error: error overriding method findChildByClass in trait ScalaPsiElement of type [ T >]]>: scala.this.Null <: psi.this.ScalaPsiElement](scala.this.Predef.Class[T])T;
method findChildByClass in class PsiFileImpl of type [ ]]> T](lang.this.Class[T])T has weaker access privileges; it should be public
class ScalaFile (viewProvider: FileViewProvider) extends PsiFileBase (viewProvider, ScalaFileType.SCALA_FILE_TYPE.getLanguage())
^


/home/patrick/dev/scala-plugin/scala_core/src/org/jetbrains/plugins/scala/lang/psi/ScalaPsiElementImpl.scala:16: error: error overriding method findChildByClass in trait ScalaPsiElement of type [ T >]]>: scala.this.Null <: psi.this.ScalaPsiElement](scala.this.Predef.Class[T])T;
method findChildByClass in class PsiElementBase of type [ ]]> T](lang.this.Class[T])T has weaker access privileges; it should be public
class ScalaPsiElementImpl ( node : ASTNode ) extends ASTWrapperPsiElement( node )
^

0
Comment actions Permalink

FYI, one more note, the build operations from Ant are available in the Build menu (under "Generate various scala packages (...)". These only work if you have fixed the paths in src/scala.properties first, though.


Patrick

0
Comment actions Permalink

Just updated from SVN again, and it compiles clean.

Whoever is working on this is a coding machine. Amazing how fast updates are being made.


Cheers!
Patrick

0
Comment actions Permalink

Hi Patrick,
would you care to write up a step-by-step plugin compilation tutorial? Including which versions you use etc. Would be very much appreciated.

0
Comment actions Permalink

Since part of the Scala plugin is written in Scala, it requires itself for a full build inside Idea.

Instead, you can build the plugin using ant:

1. Install the plugin dev package.
2. Get the plugin src from svn
3. Edit the scala.properties file in the src directory. idea.lib is the lib dir in the Idea install. project.lib is classes/production/Scala inside your Scala project directory (the directory containing the src directory)
4. Run ant in the src directory to build the default plugin.

That should leave you with a zip file containing the plugin in you Scala project directory.

0
Comment actions Permalink

A couple of notes (since I hadn't built plugins before this):

- after running the build process, you'll have a new Scala.zip in your scala-plugin directory (where the sources from the plugin are), while you are running Ant from scala-plugin/src.
- you need to unpack the Scala.zip in your IntelliJ plugins directory. For me, on Unix, this is at /home/patrick/.IntelliJIdea80/config/plugins. I end up with

>ls -R /home/patrick/.IntelliJIdea80/config/plugins/Scala/
/home/patrick/.IntelliJIdea80/config/plugins/Scala/:
lib

/home/patrick/.IntelliJIdea80/config/plugins/Scala/lib:
Scala.jar scala-library.jar

After rebuilding the plugin, I always restart IDEA to pick up the changes.

If you want to follow development of the plugin, update often--I often see more than one decent-sized changeset checked in every day.


HTH (and if I got any of that wrong, let me know)
Patrick

0
Comment actions Permalink

Thank you for your explanations. Running ant in the src directory did the trick. If anyone else has problems building the plugin, let us know!

0
Comment actions Permalink

The plugin is now available directly from the plugin manager.

Not sure how often Jetbrains will update it though..

0
Comment actions Permalink

Hello,

As you could see, we started to upload last version to repository and created special forum concerned to Scala plugin. It would be better to discuss all further questions there. We plan to upload new version every Friday.

Ilya

0

Please sign in to leave a comment.