Commit f541e17c authored by Thomas Dupriez's avatar Thomas Dupriez

README updated

parent a5df90b3
# SBT:
1. To install sbt:
* Installing sbt on Mac: http://www.scala-sbt.org/0.13/tutorial/Installing-sbt-on-Mac.html
* Installing sbt on Windows: http://www.scala-sbt.org/0.13/tutorial/Installing-sbt-on-Windows.html
* Installing sbt on Linux: http://www.scala-sbt.org/0.13/tutorial/Installing-sbt-on-Linux.html
* Installing sbt manually: http://www.scala-sbt.org/0.13/tutorial/Manual-Installation.html
# To compile:
* cd project folder
* make
2. To use sbt, place yourself at the root of the project (where there is the build.sbt file) and enter "sbt" in the command line. It will start sbt. Then enter "compile" to compile the files that changed since the last compiling, or "run" to do the same job than "compile" + run the project.
# ARCHITECTURE:
* The code has to be in the "java" (for java code) and "scala" (for scala code) folders, located in src/main/java and src/main/scala respectively.
* Each group has two dedicated folders, one in the java folder and one in the scala folder. There are minimal examples of files in both folders.
* Each group has a "package". A package is an annotation ("package [package_name];" in java | "package [package_name]" in scala) that has to be put at the beginning of your files, to indicate in which package they are. A package defines a scope of visibility for the code. It means that different files from the same package are able to see each other. In order to "see" the code from a different package, a file has to "import" the said package ("import [package_name].*;" for java files | "import [package_name]._" for scala files).
* Each group has a Main class located in its scala folder (it's not in the java one because sbt wasn't able to detect these main classes nicely). When using the "run" command in sbt, you will have to choose which main class you want to use for the execution. These classes are there for test purposes only, they should disappear from the final software. Their purpose is to allow the different groups to test their code by executing it without involving other groups in the process.
* One thing to note is that these test main classes are in the scala groups folders for sbt to see them, not to prevent groups from using java. Groups may even code entirely in java if they want to. In this case, the scala main class can be defined to only call a java function defined by the group, containing the actual main code.
* There is a GlobalMain class, in the core group folder, which is intended to be the final main class of the project.
* The "resources" folder that is on the same level of the scala and java folders should contains things like images and so on as far as I understand it.
* The "target" folders located throughout the project contains in particular the compiled files that sbt generates. I can't think of any reason you could have to interact with them.
# TO USE LIBRARIES:
## Library dependencies can be added in two ways:
1. unmanaged dependencies are jars dropped into the lib directory
2. managed dependencies are configured in the build definition (build.sbt) and downloaded automatically from repositories
# SCALA/JAVA INTEROPERABILITY:
* An example can be found in the scalaJava_interopExample package (which shows how the code from both the java and scala folder from the scalaJava_interopExample package can cooperate). Just run the project using the ScalaMain_InteropExample Class
* An interesting document on the subject: http://www.codecommit.com/blog/java/interop-between-java-and-scala
PS: The compilation being done by a makefile, the <package>; import of java are not implicit. Intellij IDEA put them, but Eclipse does not, so add them manually please.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment