To set up a development environment, we designed a Visual Studio Code Dev Container that includes all the necessary tooling and Visual Studio Code (VS Code) extensions that you need to work on this project. We use this dev container to build the project from both VS Code and the command-line.
To inspect the development environment container image configuration and build descriptors,
refer to the contents of the .devcontainer
directory:
- .devcontainer/devcontainer.json: development container creation and access directives (reference).
- .devcontainer/Dockerfile: dev container image build descriptor (reference).
For more information about creating containerized development environments, refer to Create a development container.
If you don't have a container runtime engine on your local host, but you have one available on a remote host, you can connect to the remote host and use that container runtime. For more information, refer to Develop on a remote Docker host.
To setup a development environment you need:
- A POSIX-compliant shell
- An OCI-compatible container runtime. Tested with Docker for Linux 20.10.21
- Visual Studio Code, if you need to modify any part of this set of software components. Other editors and IDEs might work fine.
To ensure that things work as expected, we developed a comprehensive integration test suite that uses containerized instances of Mosquitto (an open-source MQTT broker) and the Cloud Pub/Sub emulator to simulate a runtime environment.
You can run the test suite either from Visual Studio Code, or from the command-line, after cloning this repository.
To run tests from Visual Studio Code:
- Open the root directory of this repository with Visual Studio Code as a workspace. Visual Studio should prompt you to start the Dev Container.
- Open the
Java Projects
panel or open the JUnit test file fromsrc/test/java
. - Click on the play icon near the test or the test suite that you want to run.
To run tests from the command-line, do the following:
-
Open a POSIX-compliant shell.
-
Change your working directory to the root directory of this repository.
-
Run the build process:
scripts/build.sh
This project runs two code linters:
- super-linter (actually, a collection of linters)
- Spotless
Both run as part of the build process.
To automatically fix linting errors that Spotless finds, do the following:
-
Open a POSIX-compliant shell.
-
Change your working directory to the root directory of this repository.
-
Run the build process:
scripts/build.sh --fix-linting-errors
super-linter
doesn't support automatically fixing errors.
All the linters have their configuration stored in the config/lint
directory.
Additionally, some linters shipped within super-linter
also take the
EditorConfig configuration file into account.
For more information about the build process, refer to Build and release processes