// tag::extraProperties[]
plugins {
    id("java-library")
}

val springVersion = "3.1.0.RELEASE"
extra["springVersion"] = springVersion
val emailNotification = "build@master.org"
extra["emailNotification"] = emailNotification

sourceSets.all { extra["purpose"] = null }

sourceSets {
    main {
        extra["purpose"] = "production"
    }
    test {
        extra["purpose"] = "test"
    }
    create("plugin") {
        extra["purpose"] = "production"
    }
}

tasks.register("printProperties") {
    val springVersion = springVersion
    val emailNotification = emailNotification
    val productionSourceSets = provider {
        sourceSets.matching { it.extra["purpose"] == "production" }.map { it.name }
    }
    doLast {
        println(springVersion)
        println(emailNotification)
        productionSourceSets.get().forEach { println(it) }
    }
}
// end::extraProperties[]
