JPS Plugin

The JPS build plugin is responsible for building a Spoofax language specification or Spoofax-enabled project. It’s loaded in a separate process by IntelliJ IDEA when the user executes the Make action.

Initialization

When the plugin is loaded, the static members of the JpsPlugin class are initialized. This loads the Guice dependency injector.

Bindings

The Guice bindings for the plugin can be found in the JpsSpoofaxModule and JpsSpoofaxMetaModule classes. See Bindings for more information on how to use Guice bindings.

Deserialization

The JPS plugin has an internal representation of the project, its modules, files, settings, facets, SDK, and so on, in the JpsModel class.

When the JPS plugin is run, IntelliJ creates a JPS model that reflects the IntelliJ project structure. However, IntelliJ has no knowledge of any special extensions and settings that we have applied to the IntelliJ project. We need to update the JPS model with our own information where needed. This is done through the deserializers returned from the JpsSpoofaxModelSerializerExtension class.

Gathering build targets

A build target is a single compilation unit. JPS now gathers all build targets that can apply to the model, and orders them according to their dependencies.

The BuilderService advertises which build target types we have implemented. Each BuildTargetType<T> implementation then decides which build targets we have. Usually every module that we can compile gets its own BuildTarget<T>.

Building

Our BuilderService also advertised which target builders we have. Every TargetBuilder<T, U> has a build() method that’s executed for every appropriate build target.