Search in sources :

Example 1 with BuildOperationDetails

use of org.gradle.internal.progress.BuildOperationDetails in project gradle by gradle.

the class InProcessWorkerFactory method getWorker.

@Override
public Worker getWorker(Class<? extends WorkerProtocol> workerImplementationClass, File workingDir, final DaemonForkOptions forkOptions) {
    return new Worker() {

        @Override
        public <T extends WorkSpec> DefaultWorkResult execute(WorkerAction<T> action, T spec) {
            return execute(action, spec, buildOperationWorkerRegistry.getCurrent(), buildOperationExecutor.getCurrentOperation());
        }

        @Override
        public <T extends WorkSpec> DefaultWorkResult execute(final WorkerAction<T> action, final T spec, Operation parentWorkerOperation, BuildOperationExecutor.Operation parentBuildOperation) {
            BuildOperationWorkerRegistry.Completion workerLease = parentWorkerOperation.operationStart();
            BuildOperationDetails buildOperation = BuildOperationDetails.displayName(action.getDisplayName()).parent(parentBuildOperation).build();
            try {
                return buildOperationExecutor.run(buildOperation, new Transformer<DefaultWorkResult, BuildOperationContext>() {

                    @Override
                    public DefaultWorkResult transform(BuildOperationContext buildOperationContext) {
                        return executeInWorkerClassLoader(action, spec, forkOptions);
                    }
                });
            } finally {
                workerLease.operationFinish();
            }
        }
    };
}
Also used : BuildOperationDetails(org.gradle.internal.progress.BuildOperationDetails) BuildOperationContext(org.gradle.internal.operations.BuildOperationContext) BuildOperationWorkerRegistry(org.gradle.internal.operations.BuildOperationWorkerRegistry) Operation(org.gradle.internal.operations.BuildOperationWorkerRegistry.Operation)

Example 2 with BuildOperationDetails

use of org.gradle.internal.progress.BuildOperationDetails in project gradle by gradle.

the class WorkerDaemonClient method execute.

@Override
public <T extends WorkSpec> DefaultWorkResult execute(final WorkerAction<T> action, final T spec, Operation parentWorkerOperation, BuildOperationExecutor.Operation parentBuildOperation) {
    Completion workerLease = parentWorkerOperation.operationStart();
    BuildOperationDetails buildOperation = BuildOperationDetails.displayName(action.getDisplayName()).parent(parentBuildOperation).build();
    try {
        return buildOperationExecutor.run(buildOperation, new Transformer<DefaultWorkResult, BuildOperationContext>() {

            @Override
            public DefaultWorkResult transform(BuildOperationContext buildOperationContext) {
                uses++;
                return workerDaemonProcess.execute(action, spec);
            }
        });
    } finally {
        workerLease.operationFinish();
    }
}
Also used : BuildOperationDetails(org.gradle.internal.progress.BuildOperationDetails) BuildOperationContext(org.gradle.internal.operations.BuildOperationContext) Completion(org.gradle.internal.operations.BuildOperationWorkerRegistry.Completion)

Example 3 with BuildOperationDetails

use of org.gradle.internal.progress.BuildOperationDetails in project gradle by gradle.

the class InitScriptHandler method executeScripts.

public void executeScripts(final GradleInternal gradle) {
    final List<File> initScripts = gradle.getStartParameter().getAllInitScripts();
    if (initScripts.isEmpty()) {
        return;
    }
    BuildOperationDetails operationDetails = BuildOperationDetails.displayName("Run init scripts").progressDisplayName("init scripts").build();
    buildOperationExecutor.run(operationDetails, new Action<BuildOperationContext>() {

        @Override
        public void execute(BuildOperationContext buildOperationContext) {
            for (File script : initScripts) {
                processor.process(new UriScriptSource("initialization script", script), gradle);
            }
        }
    });
}
Also used : BuildOperationDetails(org.gradle.internal.progress.BuildOperationDetails) BuildOperationContext(org.gradle.internal.operations.BuildOperationContext) UriScriptSource(org.gradle.groovy.scripts.UriScriptSource) File(java.io.File)

Example 4 with BuildOperationDetails

use of org.gradle.internal.progress.BuildOperationDetails in project gradle by gradle.

the class BuildOperationExternalResource method createBuildOperationDetails.

private BuildOperationDetails createBuildOperationDetails() {
    ExternalResourceMetaData metaData = getMetaData();
    DownloadBuildOperationDescriptor downloadBuildOperationDescriptor = new DownloadBuildOperationDescriptor(metaData.getLocation(), metaData.getContentLength(), metaData.getContentType());
    BuildOperationDetails buildOperationDetails = BuildOperationDetails.displayName("Download " + metaData.getLocation().toString()).parent(buildOperationExecutor.getCurrentOperation()).operationDescriptor(downloadBuildOperationDescriptor).build();
    return buildOperationDetails;
}
Also used : DownloadBuildOperationDescriptor(org.gradle.internal.resource.transfer.DownloadBuildOperationDescriptor) BuildOperationDetails(org.gradle.internal.progress.BuildOperationDetails) ExternalResourceMetaData(org.gradle.internal.resource.metadata.ExternalResourceMetaData)

Aggregations

BuildOperationDetails (org.gradle.internal.progress.BuildOperationDetails)4 BuildOperationContext (org.gradle.internal.operations.BuildOperationContext)3 File (java.io.File)1 UriScriptSource (org.gradle.groovy.scripts.UriScriptSource)1 BuildOperationWorkerRegistry (org.gradle.internal.operations.BuildOperationWorkerRegistry)1 Completion (org.gradle.internal.operations.BuildOperationWorkerRegistry.Completion)1 Operation (org.gradle.internal.operations.BuildOperationWorkerRegistry.Operation)1 ExternalResourceMetaData (org.gradle.internal.resource.metadata.ExternalResourceMetaData)1 DownloadBuildOperationDescriptor (org.gradle.internal.resource.transfer.DownloadBuildOperationDescriptor)1