/*
 * Copyright 2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

open class Greeting : DefaultTask() {
    // Configurable by the user
    @get:Input
    val message: Property<String> = project.objects.property()

    // Read-only property calculated from the message
    @get:Internal
    val fullMessage: Provider<String> = message.map { "$it from Gradle" }

    @TaskAction
    fun printMessage() {
        logger.quiet(fullMessage.get())
    }
}

tasks.create<Greeting>("greeting") {
    message.set("Hi")
}

/*
 * Copyright 2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

open class Greeting : DefaultTask() {
    // Configurable by the user
    @get:Input
    val message: Property<String> = project.objects.property()

    // Read-only property calculated from the message
    @get:Internal
    val fullMessage: Provider<String> = message.map { it + " from Gradle" }

    @TaskAction
    fun printMessage() {
        logger.quiet(fullMessage.get())
    }
}

task<Greeting>("greeting") {
    message.set("Hi")
}

Align Kotlin example of `propertyAndProvider` sample with Groovy
Align Kotlin example of `propertyAndProvider` sample with Groovy

Signed-off-by: Mike Kobit <6b5be85140a72f835339fc5384eb248e653d0103@gmail.com>

robinverduijn/gradle,robinverduijn/gradle,blindpirate/gradle,robinverduijn/gradle,lsmaira/gradle,gradle/gradle,lsmaira/gradle,gradle/gradle,robinverduijn/gradle,blindpirate/gradle,blindpirate/gradle,gradle/gradle,gradle/gradle,robinverduijn/gradle,lsmaira/gradle,lsmaira/gradle,lsmaira/gradle,lsmaira/gradle,blindpirate/gradle,gradle/gradle,robinverduijn/gradle,blindpirate/gradle,lsmaira/gradle,lsmaira/gradle,gradle/gradle,robinverduijn/gradle,robinverduijn/gradle,gradle/gradle,blindpirate/gradle,blindpirate/gradle,gradle/gradle,robinverduijn/gradle,blindpirate/gradle,gradle/gradle,blindpirate/gradle,robinverduijn/gradle,blindpirate/gradle,robinverduijn/gradle,lsmaira/gradle,gradle/gradle,lsmaira/gradle