Skip to content

PRL-PRG/r-compile-server

Repository files navigation

R compile-Server

Setup (development)

Clone the repository

git clone --recursive [email protected]:PRL-PRG/r-compile-server.git

or

git clone --recursive https://github.com/PRL-PRG/r-compile-server.git

This shall clone also the submodules. If you forgot to clone the submodules, you can run

git submodule update --init --recursive

From dev container

To quickly get started with development, you can use the project's Dev Container. We strongly recommend using IntelliJ.

To run the IntelliJ inside the dev container:

Manually

If the dev container is too slow, you can also setup on the host machine. To do so, must install the following dependencies:

  • Java 22 and Maven 3

Commands

  • Run make setup to initialize the dependencies
    • It installs GNU-R in external/R.
  • Run make setup-git to install Git Hooks. The commit hook formats, the pre-push hook runs tests and static analyses.
  • Build with make or mvn package
  • Test (no static analyses) with make test or mvn test
  • Test and static anaylses with make check or mvn verify
  • Format with make format or mvn spotless:apply. This requires to have npm installed.

Troubleshooting

  • Problem: In Maven, Could not find or initialize a local git repository. A repository is required
    • This happens if you downloaded a ZIP instead of git clone-ing. The solution is to run git init. Note that you won't be able to push changes or create a PR since it's not a proper git repo.
  • Problem: In Maven, Fatal error compiling: invalid target release: 22
    • Solution: ensure you have a Java 22 JDK installed, then run JAVA_HOME=<path to JDK 22> mvn …
      • e.g. if using IntelliJ on macOS, openJDK 22, set JAVA_HOME=~/Library/Java/JavaVirtualMachines/openjdk-22/Contents/Home
      • In the devcontainer, JAVA_HOME=/usr/lib/jvm/jdk
  • Problem: some R symbols are not visible when JIT-compiling.
    • Solution: make sure that external/R is up-to-date with git submodule update --init --recursive and check if it is the right branch, RSH-4-3-2.

If you have a different issue than the above, report it on GitHub.

Development Notes

In this project, all values are considered non-null unless specified as @Nullable.

To enforce this, every package must have a package-info.json with the following code:

@ParametersAreNonnullByDefault
@FieldsAreNonNullByDefault
@ReturnTypesAreNonNullByDefault
package org.prlprg.<package-name>;

import org.prlprg.util.FieldsAreNonNullByDefault;
import org.prlprg.util.ReturnTypesAreNonNullByDefault;

import javax.annotation.ParametersAreNonnullByDefault;

In IntelliJ you can simply copy package-info.json from any package into the new one and it will automatically change the package path.