org.gradle.groovy.scripts.internal.CompileOperation Maven / Gradle / Ivy
Show all versions of gradle-api Show documentation
/*
* 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.groovy.scripts.internal;
import org.gradle.groovy.scripts.Transformer;
import org.gradle.internal.serialize.Serializer;
/**
* A stateful “backing” for a compilation operation.
*
* The compilation may extract data from the source under compilation, made available after compilation by {@link #getExtractedData()}.
* The exposed transformer typically gathers the data while transforming.
*
* As these objects are stateful, they can only be used for a single compile operation.
*
* @param the type of data extracted by this operation
*/
public interface CompileOperation {
/**
* A unique id for this operations.
*
* Used to distinguish between the classes compiled from the same script with different transformers, so should be a valid java identifier.
*/
String getId();
/**
* The stage of this compile operation.
* This is exposed by {@link org.gradle.internal.scripts.CompileScriptBuildOperationType.Details#getStage()}.
* */
String getStage();
Transformer getTransformer();
/**
* The data extracted from the script. Note that this method may be called without the transformer ever being invoked, in this case of an empty script.
*/
T getExtractedData();
Serializer getDataSerializer();
}