LPhy and LPhyBEAST are developed based on Java 17, which is the latest long-term support (LTS) version. The LPhy extension mechanism is implemented using the Service Provider Interface (SPI) and the Java Platform Module System (JPMS).
They are the Gradle projects, which benefit from Gradle’s human-readable and fast build, as well as the unified development environment settings in IntelliJ. The dependency management in Gradle through the maven central repository makes this critical job much easier for developers. All LPhy related projects are now published to the Maven linguaphylo group.
First, to be an extension developer, you should be aware that there are 3 groups of projects, which are using very different technologies:
1. LPhy and LPhy extensions.
This group is using the latest technologies, such as Java 17, JPMS, and the standardised extension mechanism using SPI.
2. BEAST 2 and its packages.
This group is currently using Java 1.8, so it is not using JPMS. The extension mechanism was developed by BEAST 2 core developers.
3. LPhyBEAST and its extensions.
This group contains the mapping Java classes between LPhy group and BEAST 2 group. LPhy does not have any inference engines at the moment, so that LPhyBEAST takes the role to convert LPhy model specification and data block into BEAST 2 XML.
It requires an integration between two different systems. This group still uses Java 17, but not JPMS. The extension mechanism is similar to the BEAST 2 group, and LPhyBEAST and its extensions are released as BEAST 2 packages. Therefore, they can be installed and managed by BEAST 2 Package Manager. However, to be able to trigger SPI, the corresponding LPhy libraries have to be loaded into Java classpath.
Gradle is not only a build system (c.f. ANT), but also contains dependency management, structuring project, and other advanced features. When you are developing a project including extensions from these 3 groups, we recommend you use Gradle. An model example is available online.
If you do not want migrate your existing BEAST 2 project to a Gradle project, the alternative solution is to create a Gradle project only containing LPhy and LPhyBEAST parts, and release your LPhyBEAST code as the 2nd BEAST 2 package separated from your previous BEAST 2 package.
What should an extension developer know
Writing a BEAST 2 Package, if you are working on a LPhyBEAST extension.
Starting to develop an extension
Writing a user tutorial
We strongly recommend the developers to create a corresponding user tutorial to explain the model and demonstrate how to make an analysis. This post gives you several tips how to write a LPhyBEAST tutorial. More details and examples are also available in the Tutorials page.