Search in sources :

Example 1 with BuildOperationQueue

use of org.gradle.internal.operations.BuildOperationQueue in project gradle by gradle.

the class ArStaticLibraryArchiver method execute.

@Override
public WorkResult execute(final StaticLibraryArchiverSpec spec) {
    deletePreviousOutput(spec);
    List<String> args = argsTransformer.transform(spec);
    invocationContext.getArgAction().execute(args);
    final CommandLineToolInvocation invocation = invocationContext.createInvocation("archiving " + spec.getOutputFile().getName(), args, spec.getOperationLogger());
    buildOperationProcessor.run(commandLineToolInvocationWorker, new Action<BuildOperationQueue<CommandLineToolInvocation>>() {

        @Override
        public void execute(BuildOperationQueue<CommandLineToolInvocation> buildQueue) {
            buildQueue.setLogLocation(spec.getOperationLogger().getLogLocation());
            buildQueue.add(invocation);
        }
    });
    return new SimpleWorkResult(true);
}
Also used : CommandLineToolInvocation(org.gradle.nativeplatform.toolchain.internal.CommandLineToolInvocation) BuildOperationQueue(org.gradle.internal.operations.BuildOperationQueue) SimpleWorkResult(org.gradle.api.internal.tasks.SimpleWorkResult)

Example 2 with BuildOperationQueue

use of org.gradle.internal.operations.BuildOperationQueue in project gradle by gradle.

the class LinkExeLinker method execute.

@Override
public WorkResult execute(final LinkerSpec spec) {
    LinkerSpec transformedSpec = specTransformer.transform(spec);
    List<String> args = argsTransformer.transform(transformedSpec);
    invocationContext.getArgAction().execute(args);
    new VisualCppOptionsFileArgsWriter(spec.getTempDir()).execute(args);
    final CommandLineToolInvocation invocation = invocationContext.createInvocation("linking " + spec.getOutputFile().getName(), args, spec.getOperationLogger());
    buildOperationProcessor.run(commandLineToolInvocationWorker, new Action<BuildOperationQueue<CommandLineToolInvocation>>() {

        @Override
        public void execute(BuildOperationQueue<CommandLineToolInvocation> buildQueue) {
            buildQueue.setLogLocation(spec.getOperationLogger().getLogLocation());
            buildQueue.add(invocation);
        }
    });
    return new SimpleWorkResult(true);
}
Also used : SharedLibraryLinkerSpec(org.gradle.nativeplatform.internal.SharedLibraryLinkerSpec) LinkerSpec(org.gradle.nativeplatform.internal.LinkerSpec) BuildOperationQueue(org.gradle.internal.operations.BuildOperationQueue) SimpleWorkResult(org.gradle.api.internal.tasks.SimpleWorkResult)

Example 3 with BuildOperationQueue

use of org.gradle.internal.operations.BuildOperationQueue in project gradle by gradle.

the class GccLinker method execute.

@Override
public WorkResult execute(final LinkerSpec spec) {
    List<String> args = argsTransformer.transform(spec);
    invocationContext.getArgAction().execute(args);
    if (useCommandFile) {
        new GccOptionsFileArgsWriter(spec.getTempDir()).execute(args);
    }
    final CommandLineToolInvocation invocation = invocationContext.createInvocation("linking " + spec.getOutputFile().getName(), args, spec.getOperationLogger());
    buildOperationProcessor.run(commandLineToolInvocationWorker, new Action<BuildOperationQueue<CommandLineToolInvocation>>() {

        @Override
        public void execute(BuildOperationQueue<CommandLineToolInvocation> buildQueue) {
            buildQueue.setLogLocation(spec.getOperationLogger().getLogLocation());
            buildQueue.add(invocation);
        }
    });
    return new SimpleWorkResult(true);
}
Also used : CommandLineToolInvocation(org.gradle.nativeplatform.toolchain.internal.CommandLineToolInvocation) BuildOperationQueue(org.gradle.internal.operations.BuildOperationQueue) SimpleWorkResult(org.gradle.api.internal.tasks.SimpleWorkResult)

Example 4 with BuildOperationQueue

use of org.gradle.internal.operations.BuildOperationQueue in project gradle by gradle.

the class DefaultTestReport method generateFiles.

private void generateFiles(AllTestResults model, final TestResultsProvider resultsProvider, File reportDir) {
    try {
        HtmlReportRenderer htmlRenderer = new HtmlReportRenderer();
        htmlRenderer.render(model, new ReportRenderer<AllTestResults, HtmlReportBuilder>() {

            @Override
            public void render(final AllTestResults model, final HtmlReportBuilder output) throws IOException {
                buildOperationProcessor.run(new Action<BuildOperationQueue<HtmlReportFileGenerator<? extends CompositeTestResults>>>() {

                    @Override
                    public void execute(BuildOperationQueue<HtmlReportFileGenerator<? extends CompositeTestResults>> queue) {
                        queue.add(generator("index.html", model, new OverviewPageRenderer(), output));
                        for (PackageTestResults packageResults : model.getPackages()) {
                            queue.add(generator(packageResults.getBaseUrl(), packageResults, new PackagePageRenderer(), output));
                            for (ClassTestResults classResults : packageResults.getClasses()) {
                                queue.add(generator(classResults.getBaseUrl(), classResults, new ClassPageRenderer(resultsProvider), output));
                            }
                        }
                    }
                });
            }
        }, reportDir);
    } catch (Exception e) {
        throw new GradleException(String.format("Could not generate test report to '%s'.", reportDir), e);
    }
}
Also used : Action(org.gradle.api.Action) BuildOperationQueue(org.gradle.internal.operations.BuildOperationQueue) IOException(java.io.IOException) IOException(java.io.IOException) GradleException(org.gradle.api.GradleException) HtmlReportBuilder(org.gradle.reporting.HtmlReportBuilder) GradleException(org.gradle.api.GradleException) HtmlReportRenderer(org.gradle.reporting.HtmlReportRenderer)

Example 5 with BuildOperationQueue

use of org.gradle.internal.operations.BuildOperationQueue in project gradle by gradle.

the class ArStaticLibraryArchiver method newInvocationAction.

@Override
protected Action<BuildOperationQueue<CommandLineToolInvocation>> newInvocationAction(final StaticLibraryArchiverSpec spec, List<String> args) {
    final CommandLineToolInvocation invocation = newInvocation("archiving " + spec.getOutputFile().getName(), spec.getOutputFile().getParentFile(), args, spec.getOperationLogger());
    return new Action<BuildOperationQueue<CommandLineToolInvocation>>() {

        @Override
        public void execute(BuildOperationQueue<CommandLineToolInvocation> buildQueue) {
            buildQueue.setLogLocation(spec.getOperationLogger().getLogLocation());
            buildQueue.add(invocation);
        }
    };
}
Also used : Action(org.gradle.api.Action) CommandLineToolInvocation(org.gradle.nativeplatform.toolchain.internal.CommandLineToolInvocation) BuildOperationQueue(org.gradle.internal.operations.BuildOperationQueue)

Aggregations

BuildOperationQueue (org.gradle.internal.operations.BuildOperationQueue)15 Action (org.gradle.api.Action)10 CommandLineToolInvocation (org.gradle.nativeplatform.toolchain.internal.CommandLineToolInvocation)9 File (java.io.File)5 SimpleWorkResult (org.gradle.api.internal.tasks.SimpleWorkResult)5 IOException (java.io.IOException)2 GradleException (org.gradle.api.GradleException)2 BuildOperationContext (org.gradle.internal.operations.BuildOperationContext)2 RunnableBuildOperation (org.gradle.internal.operations.RunnableBuildOperation)2 HtmlReportBuilder (org.gradle.reporting.HtmlReportBuilder)2 HtmlReportRenderer (org.gradle.reporting.HtmlReportRenderer)2 FilenameFilter (java.io.FilenameFilter)1 Transformer (org.gradle.api.Transformer)1 Timer (org.gradle.internal.time.Timer)1 LinkerSpec (org.gradle.nativeplatform.internal.LinkerSpec)1 SharedLibraryLinkerSpec (org.gradle.nativeplatform.internal.SharedLibraryLinkerSpec)1 StaticLibraryArchiverSpec (org.gradle.nativeplatform.internal.StaticLibraryArchiverSpec)1 ArgsTransformer (org.gradle.nativeplatform.toolchain.internal.ArgsTransformer)1