/*
 * Copyright 2015 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.internal.progress;

import org.gradle.api.Task;
import org.gradle.api.invocation.Gradle;

public final class OperationIdGenerator {

    public static Object generateId(Task task) {
        return generateId(task.getProject().getGradle()) + "-" + task.getPath();
    }

     public static Object generateId(String operationName, Gradle gradle) {
        return generateId(gradle) + "-" + operationName;
    }

    public static Object generateId(Gradle gradle) {
        return gradle == null ? null : String.valueOf(System.identityHashCode(gradle));
    }

}

@@ -722,327 +722,959 @@
 e;%0A%0A
-public final class OperationIdGenerator %7B%0A%0A    public static Object generateId(Task task) %7B%0A        return generateId(task.getProject().getGradle()) + %22-%22 + task.getPath();%0A    %7D%0A%0A     public static Object generateId(String operationName, Gradle gradle) %7B%0A        return generateId(gradle) + %22-%22 + operationName;%0A    %7D%0A
+/**%0A * Generates operation ids used by the progress event infrastructure.%0A */%0Apublic final class OperationIdGenerator %7B%0A%0A    /**%0A     * Generates an operation id for the given task.%0A     *%0A     * @param task the task operation%0A     * @return the operation id%0A     */%0A    public static Object generateId(Task task) %7B%0A        return generateId(task.getProject().getGradle()) + %22-%22 + task.getPath();%0A    %7D%0A%0A    /**%0A     * Generates an operation id for the given build operation.%0A     *%0A     * @param operationName the name of the operation%0A     * @param gradle te Gradle instance to which the build operation belongs%0A     * @return the operation id%0A     */%0A    public static Object generateId(String operationName, Gradle gradle) %7B%0A        return generateId(gradle) + %22-%22 + operationName;%0A    %7D%0A%0A    /**%0A     * Generates a operation id for the given Gradle instance.%0A     *%0A     * @param gradle the Gradle instance%0A     * @return the operation id%0A     */
 %0A   

Add Javadoc