Search in sources :

Example 11 with BuildOperationQueue

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

the class LibExeStaticLibraryArchiver method execute.

@Override
public WorkResult execute(final StaticLibraryArchiverSpec spec) {
    final StaticLibraryArchiverSpec transformedSpec = specTransformer.transform(spec);
    final List<String> args = argsTransformer.transform(transformedSpec);
    invocationContext.getArgAction().execute(args);
    new VisualCppOptionsFileArgsWriter(spec.getTempDir()).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 : StaticLibraryArchiverSpec(org.gradle.nativeplatform.internal.StaticLibraryArchiverSpec) CommandLineToolInvocation(org.gradle.nativeplatform.toolchain.internal.CommandLineToolInvocation) BuildOperationQueue(org.gradle.internal.operations.BuildOperationQueue) SimpleWorkResult(org.gradle.api.internal.tasks.SimpleWorkResult)

Example 12 with BuildOperationQueue

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

the class NativeCompiler method execute.

@Override
public WorkResult execute(final T spec) {
    final T transformedSpec = specTransformer.transform(spec);
    final List<String> genericArgs = getArguments(transformedSpec);
    final File objectDir = transformedSpec.getObjectFileDir();
    buildOperationProcessor.run(commandLineToolInvocationWorker, new Action<BuildOperationQueue<CommandLineToolInvocation>>() {

        @Override
        public void execute(BuildOperationQueue<CommandLineToolInvocation> buildQueue) {
            buildQueue.setLogLocation(spec.getOperationLogger().getLogLocation());
            for (File sourceFile : transformedSpec.getSourceFiles()) {
                CommandLineToolInvocation perFileInvocation = createPerFileInvocation(genericArgs, sourceFile, objectDir, spec);
                buildQueue.add(perFileInvocation);
            }
        }
    });
    return new SimpleWorkResult(!transformedSpec.getSourceFiles().isEmpty());
}
Also used : BuildOperationQueue(org.gradle.internal.operations.BuildOperationQueue) SimpleWorkResult(org.gradle.api.internal.tasks.SimpleWorkResult) File(java.io.File)

Example 13 with BuildOperationQueue

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

the class Binary2JUnitXmlReportGenerator method generate.

public void generate() {
    Timer clock = Time.startTimer();
    buildOperationExecutor.run(new RunnableBuildOperation() {

        @Override
        public void run(BuildOperationContext context) {
            File[] oldXmlFiles = testResultsDir.listFiles(new FilenameFilter() {

                @Override
                public boolean accept(File dir, String name) {
                    return name.startsWith("TEST") && name.endsWith(".xml");
                }
            });
            for (File oldXmlFile : oldXmlFiles) {
                GFileUtils.deleteQuietly(oldXmlFile);
            }
        }

        @Override
        public BuildOperationDescriptor.Builder description() {
            return BuildOperationDescriptor.displayName("Delete old JUnit XML results");
        }
    });
    buildOperationExecutor.runAll(new Action<BuildOperationQueue<JUnitXmlReportFileGenerator>>() {

        @Override
        public void execute(final BuildOperationQueue<JUnitXmlReportFileGenerator> queue) {
            testResultsProvider.visitClasses(new Action<TestClassResult>() {

                public void execute(final TestClassResult result) {
                    final File reportFile = new File(testResultsDir, getReportFileName(result));
                    queue.add(new JUnitXmlReportFileGenerator(result, reportFile, xmlWriter));
                }
            });
        }
    });
    LOG.info("Finished generating test XML results ({}) into: {}", clock.getElapsed(), testResultsDir);
}
Also used : BuildOperationContext(org.gradle.internal.operations.BuildOperationContext) Action(org.gradle.api.Action) BuildOperationQueue(org.gradle.internal.operations.BuildOperationQueue) FilenameFilter(java.io.FilenameFilter) Timer(org.gradle.internal.time.Timer) RunnableBuildOperation(org.gradle.internal.operations.RunnableBuildOperation) File(java.io.File)

Example 14 with BuildOperationQueue

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

the class SwiftLinker method newInvocationAction.

@Override
protected Action<BuildOperationQueue<CommandLineToolInvocation>> newInvocationAction(final LinkerSpec spec, List<String> args) {
    final CommandLineToolInvocation invocation = newInvocation("linking " + 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)

Example 15 with BuildOperationQueue

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

the class GccLinker method newInvocationAction.

@Override
protected Action<BuildOperationQueue<CommandLineToolInvocation>> newInvocationAction(final LinkerSpec spec, List<String> args) {
    final CommandLineToolInvocation invocation = newInvocation("linking " + spec.getOutputFile().getName(), 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