use of org.gradle.language.ComponentWithOutputs in project gradle by gradle.
the class NativeBasePlugin method addLifecycleTasks.
private void addLifecycleTasks(final TaskContainer tasks, final SoftwareComponentContainer components) {
components.withType(ComponentWithBinaries.class, new Action<ComponentWithBinaries>() {
@Override
public void execute(final ComponentWithBinaries component) {
// Register each child of each component
component.getBinaries().whenElementKnown(new Action<SoftwareComponent>() {
@Override
public void execute(SoftwareComponent binary) {
components.add(binary);
}
});
if (component instanceof ProductionComponent) {
// Add an assemble task for each binary and also wire the development binary in to the `assemble` task
component.getBinaries().whenElementFinalized(ComponentWithOutputs.class, new Action<ComponentWithOutputs>() {
@Override
public void execute(ComponentWithOutputs binary) {
// Determine which output to produce at development time.
FileCollection outputs = binary.getOutputs();
Names names = ((ComponentWithNames) binary).getNames();
Task lifecycleTask = tasks.create(names.getTaskName("assemble"));
lifecycleTask.dependsOn(outputs);
if (binary == ((ProductionComponent) component).getDevelopmentBinary().get()) {
tasks.getByName(LifecycleBasePlugin.ASSEMBLE_TASK_NAME).dependsOn(outputs);
}
}
});
}
}
});
}
Aggregations