Setting up composite builds in IntelliJ

This is a tutorial on setting up IntelliJ in such a way that it treats OPENRNDR, ORX and your template based work as a single inter-dependent project. This is useful in cases in which you want to make changes to OPENRND and ORX and be able to see their effect in your work immediately. Here immediately means without having to go through the process of running gradle publishToMavenLocal -Prelease.version=0.4.0-SNAPSHOT. Composite projects are also convenient when you work with the debugger and want to set breakpoints inside OPENRNDR or ORX.

Step 1: clone repositories

mkdir composite
cd composite
git clone https://github.com/openrndr/openrndr
git clone https://github.com/openrndr/orx
git clone https://github.com/openrndr/openrndr-template

Note here that I make folder called composite here, this will function as the top-level project in IntelliJ IDEA. You can pick whatever name you like for it.

Step 2: start IntelliJ IDEA

From terminal (but possible in other ways too), start IntelliJ. IntelliJ will treat our compsite folder as a project. You probably need to install IntelliJ command-line tools for this work.

idea

Step 3: Import gradle projects

For each of the modules openrndr , openrndr-template , and orx locate the build.gradle or build.gradle.kts files and use “Import Gradle Project” on them.

Step 4: Configure composite builds

  • Open the Gradle view on the right.
  • Right click on openrndr-template and open “Composite Build Configuration”. Check both openrndr and orx .
  • Right click on orx and open “Composite Build Configuration”, check only openrndr

composite-04

Step 5: Fix openrndr-template

I suspect this is an IntelliJ bug. In build.gradle.kts we have to change the line
runtimeOnly(openrndr("gl3")) to implementation(openrndr("gl3")) otherwise the GL3 back-end cannot be resolved (for reasons unclear to me)

Step 6: Fix run configuration

When IntelliJ launches programs it will set the CWD to composite, so you will have to change the working directory to composite/openrndr-template

That’s it. You should be able to run the template program while linking against the OPENRNDR and ORX versions in your composite project.

2 Likes

Idea for the second part of this tutorial: How to contribute to OPENRNDR :slight_smile:

It would include forking openrndr, orx and openrndr-template, cloning those instead of the official, creating a branch to prepare a pull request, making changes, maybe a demo, tests, pushing your changes, sending a PR, then deleting the branches, and how to keep your local repo up to date, how to avoid messy PRs… (or links to some docs about these issues)

1 Like

After upgrading to IntelliJ 2020.1 I noticed that composite builds do not work so well anymore.

I will try to find some time to report it in IJ bugtracker, but the number of known bugs that touch composite gradle builds is a bit overwhelming though.