Skip to content

rodm/teamcity-gradle-init-scripts-plugin

Repository files navigation

Gradle Init Scripts plugin

A TeamCity plugin that provides support for reusing Gradle init scripts between build configurations.

Build Status Version Downloads

Features

  • Upload Gradle initialization scripts to a project

  • Apply an init script to a build step using the Gradle build runner

  • Apply an init script to a build configuration as a Build Feature

  • Shows the build configurations and templates using the script

  • Reports missing scripts, unused scripts and invalid configurations on the Server Health page

  • Supports saving scripts to the Versioned Settings VCS repository

Example Scripts

Example scripts can be found in the scripts directory.

Installation

  • Download the plugin from {uri-jetbrains-plugin}[JetBrains TeamCity Plugin Repository].

  • Go to the plugin list of your TeamCity installation at <TeamCity URL>/admin/admin.html?item=plugins and click on the link Upload plugin zip to install the downloaded plugin file.

  • Restart TeamCity.

Using the plugin

  • Edit a project, on the Gradle Init Scripts page upload an init script.

  • Edit a build configuration and either configure an init script for a build step using the Gradle runner or add the Build Feature, Gradle Init Script, and select the init script to use.

Kotlin DSL

The plugin extends the Kotlin DSL to support applying a Gradle init script to a Gradle build step or to each Gradle build step in build configuration via a build feature.

Gradle build step

The example below shows applying an init script to a Gradle build step.

    steps {
        gradle {
            tasks = "clean build"
            enableStacktrace = true
            jdkHome = "%env.JDK_18%"
            initScriptName = "init-script.gradle"
        }
    }

Gradle build feature

The example below shows applying an init script as a build feature.

    features {
        gradleInitScript {
            scriptName = "init-script.gradle"
        }
    }

Compatibility

The plugin is compatible with TeamCity 2018.1 and later and requires the build agent to be running with Java 8.

License

This plugin is available under the Apache License, Version 2.0.