/*
 * Copyright 2007 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.
 */

package org.gradle.api.internal;

import groovy.lang.Closure;
import org.gradle.api.DefaultTask;
import org.gradle.api.Task;
import org.gradle.api.tasks.Internal;

import java.util.concurrent.Callable;

public abstract class ConventionTask extends DefaultTask implements IConventionAware {
    private final ConventionMapping conventionMapping;

    protected ConventionTask() {
        conventionMapping = new ConventionAwareHelper(this, getProject().getConvention());
    }

    public Task conventionMapping(String property, Callable<?> mapping) {
        conventionMapping.map(property, mapping);
        return this;
    }

    public Task conventionMapping(String property, Closure mapping) {
        conventionMapping.map(property, mapping);
        return this;
    }

    @Override
    @Internal
    public ConventionMapping getConventionMapping() {
        return conventionMapping;
    }
}

@@ -916,14 +916,8 @@
 ate 
-final 
 Conv
@@ -954,139 +954,8 @@
 g;%0A%0A
-    protected ConventionTask() %7B%0A        conventionMapping = new ConventionAwareHelper(this, getProject().getConvention());%0A    %7D%0A%0A
     
@@ -1024,33 +1024,36 @@
 ping) %7B%0A        
-c
+getC
 onventionMapping
@@ -1044,32 +1044,34 @@
 onventionMapping
+()
 .map(property, m
@@ -1185,17 +1185,20 @@
         
-c
+getC
 onventio
@@ -1205,16 +1205,18 @@
 nMapping
+()
 .map(pro
@@ -1288,16 +1288,16 @@
 nternal%0A
-
     publ
@@ -1338,24 +1338,170 @@
 Mapping() %7B%0A
+        if (conventionMapping == null) %7B%0A            conventionMapping = new ConventionAwareHelper(this, getProject().getConvention());%0A        %7D%0A
         retu

Create convention mapping lazily