rodm / gradle-teamcity-dsl-plugin

Gradle plugin for generating TeamCity settings from a Kotlin DSL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gradle TeamCity DSL plugin

The plugin provides a task to generate TeamCity settings in XML format from a Kotlin DSL.

Build Status Build Status

Using the plugin

The plugin is published on the Gradle Plugin Portal and can be applied to a build as follows.

    buildscript {
      repositories {
        maven {
          url "https://plugins.gradle.org/m2/"
        }
      }
      dependencies {
        classpath "com.github.rodm:gradle-teamcity-dsl-plugin:0.6"
      }
    }

    apply plugin: "com.github.rodm.teamcity-dsl"

or using the plugins configuration block

    plugins {
      id "com.github.rodm.teamcity-dsl" version "0.6"
    }

The plugin requires a repository to be configured that allows the TeamCity DSL plugins to be downloaded. In example below the property teamcityServer needs to be defined with the hostname of the machine running the TeamCity Server.

    repositories {
        maven {
            url "http://${teamcityServer}:8111/app/dsl-plugins-repository"
        }
    }

This plugin requires Java 8, Gradle 4.0 and TeamCity 10.x or later

Extension Properties

The following properties are defined in the teamcityConfig configuration block.

  • teamcityVersion : The version of the TeamCity DSL libraries to use. Defaults to '10.0.5'.

  • format : The format of the DSL, currently only kotlin is supported.

  • baseDir : The directory containing the Kotlin DSL projects and files. Defaults to '.teamcity'.

  • destDir : The directory the settings in XML format are written to. Defaults to '${buildDir}/generated-configs'.

Example

    teamcityConfig {
        teamcityVersion = '10.0.5'
        format = 'kotlin'
        baseDir = project.file('src/teamcity')
        destDir = project.file('config/projects')
    }

Tasks

  • generateConfiguration : Runs the generator to create the TeamCity settings.

If the TeamCity settings contain an error or invalid configuration the task will output an exception, and a list of the problems will be output to the file dsl_exception.xml in the directory destDir.

Samples

The samples directory contains an example that shows the minimal setup to use this plugin. A Maven repository is required for the plugin to download the Kotlin DSL plugins from a TeamCity 10 server, the example uses a Gradle property 'teamcity.server' for the hostname.

About

Gradle plugin for generating TeamCity settings from a Kotlin DSL

License:Apache License 2.0


Languages

Language:Java 71.8%Language:Groovy 28.2%