Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 1.18 KB

README.md

File metadata and controls

56 lines (40 loc) · 1.18 KB

PropertiesLoader Gradle plugin

This simple plugin allows you to load properties (such as API keys) from .properties files into project extras.

Usage

First of all, load plugin in your root project's build.gradle file:

plugins {
    id "io.github.fobo66.propertiesloader" version "1.0"
}

For Kotlin DSL:

plugins {
    id("io.github.fobo66.propertiesloader") version "1.0"
}

Then you need to specify .properties files for the plugin:

propertiesLoader {
    propertiesFiles.from(project.file("api.properties"))
}

Given api.properties has the following content:

testkey=CHANGE_ME

Then you can access testkey via project extras in your tasks. In Groovy DSL:

ext.testkey
// or for task context
project.ext.testkey

For Kotlin DSL:

val testkey : String by extra
// or for task context
val testkey = project.extensions.extraProperties.get("testkey")

Examples

To see an example of how to use this plugin, see functional tests. There are all the needed properties defined in test cases in build.gradle "files".