Difference between revisions of "Supported Compilers"

(Name menu sidebars as such)
(Remove obsolete information)
 
Line 1: Line 1:
{{Outdated}}
+
{{FijiMenu}}All components of the Fiji project are built using OpenJDK 8.
{{FijiMenu}}There are three different compilers we try to support:
 
 
 
# OpenJDK6 Javac
 
# Oracle Java SE 6 Javac
 
# Eclipse JDT Core
 
 
 
We do our best to ensure that all code in Fiji can be compiled with any of these three options. For more details, see the sections below.
 
 
 
== MiniMaven: the Fiji Build System ==
 
 
 
The primary way to build Fiji, in whole or in part, is the [[Fiji Build System]] (a.k.a. [[MiniMaven]]). It is a custom build system for Fiji that uses the '''[http://openjdk.java.net/projects/jdk6/ OpenJDK6] Javac compiler''', using Maven's <code>pom.xml</code> files.
 
 
 
Reasons why we created MiniMaven, instead of simply requiring Maven:
 
# '''Performance.''' When Maven first runs, it downloads many dependencies which are not strictly necessary for building the Fiji codebase. MiniMaven is minimalistic and hence more time- and bandwidth efficient than Maven is.
 
# '''Convenience.''' Fiji's <code>Build.sh</code> script bootstraps everything, so there is no need to install another external tool beyond your Java Runtime Environment, or learn how to use the Maven command line tool (though if you already know Maven, you can use it; see below).
 
# '''Correctness.''' To avoid various Javac bugs, MiniMaven uses a [https://github.com/fiji/fiji/tree/master/src-plugins/javac customized version of javac], which is [https://github.com/fiji/fiji/commits/master/src-plugins/javac described in the commit history]. Suffice to say that much blood, sweat and tears have been shed to ensure that MiniMaven can successfully build all the components of Fiji.
 
 
 
To build Fiji as a whole using MiniMaven, simply invoke the <code>Build.sh</code> script at the top level.
 
 
 
To build a particular component of Fiji using MiniMaven, invoke the <code>Build.sh</code> script on the target JAR you wish to build.
 
 
 
E.g., to build VIB-lib (assuming the JAR already exists):
 
$ ./Build.sh jars/VIB-lib*.jar
 
 
 
To force a clean rebuild, use the <code>-rebuild</code> suffix with no space:
 
$ ./Build.sh jars/VIB-lib-2.0.0-SNAPSHOT.jar-rebuild
 
 
 
Alternately, you can build the code using Maven; see below for details.
 
 
 
== Command-line Maven ==
 
 
 
All of Fiji is structured as [http://maven.apache.org/ Maven] projects, meaning you can use Maven's standard <code>mvn</code> command line tool to build all or part of the system.
 
 
 
When building with Maven on the command line, it will use your default installed JDK (unless you tell it otherwise). For example:
 
 
 
$ mvn --version
 
Apache Maven 2.2.1 (rdebian-6)
 
Java version: 1.6.0_26
 
Java home: /usr/lib/jvm/java-6-sun-1.6.0.26/jre
 
Default locale: en_US, platform encoding: UTF-8
 
OS name: "linux" version: "3.0.0-17-server" arch: "amd64" Family: "unix"
 
 
 
$ java -version
 
java version "1.6.0_26"
 
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
 
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
 
 
 
On many systems, such as in the case above, the default installed JDK is '''[http://www.oracle.com/technetwork/java/javase/overview/index-jsp-136246.html Oracle's Java SE 6] platform'''. As such, we try to ensure that Fiji builds completely using Oracle's release of Javac, since it is so common.
 
 
 
To build a Maven-based component of Fiji from the command line, simply run <code>mvn</code> from that component's toplevel directory.
 
 
 
E.g., to build VIB-lib:
 
$ cd src-plugins/VIB-lib
 
$ mvn
 
 
 
Or to force a complete rebuild:
 
$ mvn clean install
 
 
 
Maven automatically runs any unit tests associated with the project upon build; to suppress this behavior, and thus improve build times, use:
 
$ mvn -DskipTests
 
 
 
== The Eclipse JDT compiler ==
 
 
 
[[wikipedia:Eclipse %28software%29|Eclipse]] is a powerful IDE for developing code. One advantage of the Maven project structure mentioned above is automatic support for development within Eclipse via the [http://www.eclipse.org/m2e/ m2e plugin]. See the [[Using Maven with Eclipse]] page for instructions in developing a Maven-based project (such as ImgLib2) within Eclipse.
 
 
 
It is important to understand that Eclipse uses a ''completely different'' compiler than Javac, part of '''Eclipse's [http://www.eclipse.org/jdt/core/ JDT Core]''' component. This incremental compiler is fast and powerful, and allows the Eclipse IDE to work its magic, but it has idiosyncrasies and bugs distinct from Javac (both OpenJDK6 and Oracle Java SE 6).
 
 
 
The main take-home message regarding Eclipse is: ''just because it compiles in Eclipse, does not mean it will compile with Javac'' (and vice versa, though the Eclipse compiler tends to be more lenient than Javac is).
 
 
 
== Jenkins continuous integration system ==
 
 
 
To detect build failures more reliably, we have a [[Jenkins]] server (installed on an Ubuntu Linux 64-bit server) that automatically builds various projects in different ways. These automated builds help to detect problems with both the OpenJDK6 compiler as well as the Oracle Java SE 6 one.
 
 
 
=== Jobs that use MiniMaven ===
 
 
 
The following jobs use MiniMaven, and will test compilation with OpenJDK6:
 
 
 
# [http://jenkins.imagej.net/job/Fiji-minimal/ Fiji-minimal] - Verifies that Fiji builds successfully with *no* submodules initialized. Runs automatically after each push to {{GitHub|repo=fiji|label=Fiji's remote Git repository}}.
 
# [http://jenkins.imagej.net/job/Fiji-daily/ Fiji-daily] - Verifies that Fiji builds successfully with *all* submodules initialized, once a day.
 
 
 
=== Jobs that use command-line Maven ===
 
 
 
The following jobs use command-line Maven, and will test compilation with Oracle Java SE 6:
 
 
 
# [http://jenkins.imagej.net/job/Fiji/ Fiji] - Verifies that Fiji builds successfully. Runs automatically after each push to {{GitHub|repo=fiji|label=Fiji's remote Git repository}}.
 
# [http://jenkins.imagej.net/job/ImgLib2/ ImgLib2] - Verifies that ImgLib2 builds successfully. Runs automatically after each push to {{GitHub|org=imglib|repo=imglib2|label=ImgLib2's remote Git repository}}.
 
# [http://jenkins.imagej.net/job/ImageJ/ ImageJ] - Verifies that ImageJ2 builds successfully. Runs automatically after each push to {{GitHub|repo=imagej|label=ImageJ's remote Git repository}}.
 
 
 
== Fixing build problems ==
 
 
 
If you receive an email from Jenkins about a build failure, please take a look at the console output. If it looks related to code that you changed, try to find a fix or workaround so that all the different build mechanisms can continue to function. Broadly, the steps are as follows:
 
 
 
# Use the commands given above to replicate the problem on your system.
 
# Experiment with code changes to make the problem go away.
 
# Push your changes, with an explanation of what you did and why needed to do it. In many cases it is wise to provide a comment in the code ([https://github.com/imagej/imglib/commit/5748a1be here] is an example) to educate others on the issue, so that no one inadvertently removes your fix.
 
# After sufficient time elapses, verify that the Jenkins build is working again.
 
 
 
If you need help, please write to [http://groups.google.com/group/fiji-devel fiji-devel] for assistance!
 
  
 
[[Category:Development]]
 
[[Category:Development]]
 
[[Category:Fiji]]
 
[[Category:Fiji]]

Latest revision as of 09:12, 9 July 2019

Fiji-icon.png Fiji Is Just ImageJ
Overview
Using Fiji
Featured Fiji Projects
Fiji Publications
Links
Developing Fiji
Building Fiji from source
Developing Fiji
Contribution requirements

All components of the Fiji project are built using OpenJDK 8.