Menu

Gradle Build System

Relevant source files

This document covers the Gradle build system configuration and automation used in the OwnLang project. This includes the Gradle wrapper setup, build task execution, and continuous integration configuration. For information about the multi-project structure and module dependencies, see Multi-Project Structure. For details about JAR packaging and distribution artifacts, see Distribution and Deployment.

Gradle Wrapper Configuration

The OwnLang project uses the Gradle Wrapper to ensure consistent build environments across different development machines and CI systems. The wrapper is configured to use Gradle version 8.10.2 and provides both Unix and Windows execution scripts.

The wrapper configuration specifies the Gradle distribution URL and local storage paths for the wrapper files. The distribution is downloaded automatically on first execution if not already cached locally.

Sources: gradle/wrapper/gradle-wrapper.properties1-7 gradlew1-235 gradlew.bat1-90

Build Task Execution

The primary build task for OwnLang is shadowJar, which creates an executable JAR file containing all dependencies. This task is provided by the Shadow plugin and produces the final distributable artifact.

The shadowJar task produces OwnLang.jar as the main executable artifact, which can be executed using java -jar OwnLang.jar with various command-line options for running OwnLang programs.

Sources: README.md139

Continuous Integration Setup

The project uses GitHub Actions for automated building and testing across multiple Java versions. The CI configuration ensures compatibility with both Java 17 and Java 21, which are the current LTS versions.

The workflow is configured to run on pushes and pull requests to the latest branch, ensuring that all code changes are automatically validated before integration.

Sources: .github/workflows/gradle.yml1-27

Gradle Wrapper Implementation

The Gradle wrapper consists of shell and batch scripts that bootstrap the Gradle build system without requiring a pre-installed Gradle distribution. The wrapper automatically downloads and caches the specified Gradle version.

ComponentPurposePlatform
gradlewUnix shell script wrapperLinux, macOS, Unix-like
gradlew.batWindows batch script wrapperWindows
gradle-wrapper.jarBootstrap JAR with wrapper logicCross-platform
gradle-wrapper.propertiesConfiguration and version specificationCross-platform

The wrapper scripts detect the Java installation, set up the classpath, and execute the GradleWrapperMain class from the wrapper JAR. Default JVM options are configured as -Xmx64m -Xms64m to provide a minimal memory footprint for the wrapper process.

The wrapper ensures reproducible builds by using the exact Gradle version specified in the properties file, eliminating version conflicts between different development environments.

Sources: gradlew88-89 gradlew.bat36 gradle/wrapper/gradle-wrapper.properties4