Java Code Examples for org.gradle.api.tasks.WorkResult#getDidWork()

The following examples show how to use org.gradle.api.tasks.WorkResult#getDidWork() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SyncCopyActionDecorator.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
 
Example 2
Source File: SyncCopyActionDecorator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
 
Example 3
Source File: NativeCompiler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public WorkResult execute(T spec) {
    boolean didWork = false;
    boolean windowsPathLimitation = OperatingSystem.current().isWindows();

    String objectFileExtension = OperatingSystem.current().isWindows() ? ".obj" : ".o";
    for (File sourceFile : spec.getSourceFiles()) {
        String objectFileName = FilenameUtils.removeExtension(sourceFile.getName()) + objectFileExtension;
        WorkResult result = commandLineTool.inWorkDirectory(spec.getObjectFileDir())
                .withArguments(new SingleSourceCompileArgTransformer<T>(sourceFile,
                                        objectFileName,
                                        new ShortCircuitArgsTransformer(argsTransfomer),
                                        windowsPathLimitation,
                                        false))
                .execute(spec);
        didWork = didWork || result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
 
Example 4
Source File: SyncCopyActionDecorator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
 
Example 5
Source File: SyncCopyActionDecorator.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public WorkResult execute(final CopyActionProcessingStream stream) {
    final Set<RelativePath> visited = new HashSet<RelativePath>();

    WorkResult didWork = delegate.execute(new CopyActionProcessingStream() {
        public void process(final CopyActionProcessingStreamAction action) {
            stream.process(new CopyActionProcessingStreamAction() {
                public void processFile(FileCopyDetailsInternal details) {
                    visited.add(details.getRelativePath());
                    action.processFile(details);
                }
            });
        }
    });

    SyncCopyActionDecoratorFileVisitor fileVisitor = new SyncCopyActionDecoratorFileVisitor(visited);

    MinimalFileTree walker = new DirectoryFileTree(baseDestDir).postfix();
    walker.visit(fileVisitor);
    visited.clear();

    return new SimpleWorkResult(didWork.getDidWork() || fileVisitor.didWork);
}
 
Example 6
Source File: NativeCompiler.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public WorkResult execute(T spec) {
    boolean didWork = false;
    boolean windowsPathLimitation = OperatingSystem.current().isWindows();

    String objectFileExtension = OperatingSystem.current().isWindows() ? ".obj" : ".o";
    for (File sourceFile : spec.getSourceFiles()) {
        String objectFileName = FilenameUtils.removeExtension(sourceFile.getName()) + objectFileExtension;
        WorkResult result = commandLineTool.inWorkDirectory(spec.getObjectFileDir())
                .withArguments(new SingleSourceCompileArgTransformer<T>(sourceFile,
                                        objectFileName,
                                        new ShortCircuitArgsTransformer(argsTransfomer),
                                        windowsPathLimitation,
                                        false))
                .execute(spec);
        didWork = didWork || result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
 
Example 7
Source File: Assembler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public WorkResult execute(AssembleSpec spec) {
    boolean didWork = false;
    CommandLineTool<AssembleSpec> commandLineAssembler = commandLineTool.inWorkDirectory(spec.getObjectFileDir());
    for (File sourceFile : spec.getSourceFiles()) {
        WorkResult result = commandLineAssembler.withArguments(new AssemblerArgsTransformer(sourceFile)).execute(spec);
        didWork = didWork || result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
 
Example 8
Source File: NativeCompiler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public WorkResult execute(T spec) {
    boolean didWork = false;
    for (File sourceFile : spec.getSourceFiles()) {
        String objectFileName = FilenameUtils.removeExtension(sourceFile.getName()) + ".obj";
        WorkResult result = commandLineTool.inWorkDirectory(spec.getObjectFileDir())
                .withArguments(new SingleSourceCompileArgTransformer<T>(sourceFile,
                                                                        objectFileName,
                                                                        new ShortCircuitArgsTransformer<T>(argsTransFormer),
                                                                        true,
                                                                        true))
                .execute(spec);
        didWork = didWork || result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
 
Example 9
Source File: CleanCompilingNativeCompiler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected WorkResult doIncrementalCompile(IncrementalCompileProcessor processor, NativeCompileSpec spec) {
    processor.processSourceFiles(spec.getSourceFiles());
    boolean deleted = cleanPreviousOutputs(spec);
    WorkResult compileResult = delegateCompiler.execute(spec);
    if (deleted && !compileResult.getDidWork()) {
        return new SimpleWorkResult(deleted);
    }
    return compileResult;
}
 
Example 10
Source File: WindowsResourceCompiler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public WorkResult execute(WindowsResourceCompileSpec spec) {
    boolean didWork = false;
    boolean windowsPathLimitation = OperatingSystem.current().isWindows();
    CommandLineTool<WindowsResourceCompileSpec> commandLineAssembler = commandLineTool.inWorkDirectory(spec.getObjectFileDir());
    for (File sourceFile : spec.getSourceFiles()) {
        WorkResult result = commandLineAssembler.withArguments(new RcCompilerArgsTransformer(sourceFile, windowsPathLimitation)).execute(spec);
        didWork |= result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
 
Example 11
Source File: IncrementalNativeCompiler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected WorkResult doCleanIncrementalCompile(NativeCompileSpec spec) {
    boolean deleted = cleanPreviousOutputs(spec);
    WorkResult compileResult = delegateCompiler.execute(spec);
    if (deleted && !compileResult.getDidWork()) {
        return new SimpleWorkResult(deleted);
    }
    return compileResult;
}
 
Example 12
Source File: Assembler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public WorkResult execute(AssembleSpec spec) {
    boolean didWork = false;
    CommandLineTool<AssembleSpec> commandLineAssembler = commandLineTool.inWorkDirectory(spec.getObjectFileDir());
    for (File sourceFile : spec.getSourceFiles()) {
        ArgsTransformer<AssembleSpec> arguments = new AssembleSpecToArgsList(sourceFile, spec.getObjectFileDir(), outputFileSuffix);
        arguments = new PostTransformActionArgsTransformer<AssembleSpec>(arguments, argsAction);
        WorkResult result = commandLineAssembler.withArguments(arguments).execute(spec);
        didWork = didWork || result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
 
Example 13
Source File: Assembler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public WorkResult execute(AssembleSpec spec) {
    boolean didWork = false;
    CommandLineTool<AssembleSpec> commandLineAssembler = commandLineTool.inWorkDirectory(spec.getObjectFileDir());
    for (File sourceFile : spec.getSourceFiles()) {
        ArgsTransformer<AssembleSpec> arguments = new AssembleSpecToArgsList(sourceFile, spec.getObjectFileDir(), outputFileSuffix);
        arguments = new PostTransformActionArgsTransformer<AssembleSpec>(arguments, argsAction);
        WorkResult result = commandLineAssembler.withArguments(arguments).execute(spec);
        didWork = didWork || result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
 
Example 14
Source File: WindowsResourceCompiler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public WorkResult execute(WindowsResourceCompileSpec spec) {
    boolean didWork = false;
    boolean windowsPathLimitation = OperatingSystem.current().isWindows();
    CommandLineTool<WindowsResourceCompileSpec> commandLineAssembler = commandLineTool.inWorkDirectory(spec.getObjectFileDir());
    for (File sourceFile : spec.getSourceFiles()) {
        WorkResult result = commandLineAssembler.withArguments(new RcCompilerArgsTransformer(sourceFile, windowsPathLimitation)).execute(spec);
        didWork |= result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
 
Example 15
Source File: Assembler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public WorkResult execute(AssembleSpec spec) {
    boolean didWork = false;
    CommandLineTool<AssembleSpec> commandLineAssembler = commandLineTool.inWorkDirectory(spec.getObjectFileDir());
    for (File sourceFile : spec.getSourceFiles()) {
        WorkResult result = commandLineAssembler.withArguments(new AssemblerArgsTransformer(sourceFile)).execute(spec);
        didWork = didWork || result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
 
Example 16
Source File: NativeCompiler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public WorkResult execute(T spec) {
    boolean didWork = false;
    for (File sourceFile : spec.getSourceFiles()) {
        String objectFileName = FilenameUtils.removeExtension(sourceFile.getName()) + ".obj";
        WorkResult result = commandLineTool.inWorkDirectory(spec.getObjectFileDir())
                .withArguments(new SingleSourceCompileArgTransformer<T>(sourceFile,
                                                                        objectFileName,
                                                                        new ShortCircuitArgsTransformer<T>(argsTransFormer),
                                                                        true,
                                                                        true))
                .execute(spec);
        didWork = didWork || result.getDidWork();
    }
    return new SimpleWorkResult(didWork);
}
 
Example 17
Source File: CleanCompilingNativeCompiler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected WorkResult doIncrementalCompile(IncrementalCompileProcessor processor, NativeCompileSpec spec) {
    processor.processSourceFiles(spec.getSourceFiles());
    boolean deleted = cleanPreviousOutputs(spec);
    WorkResult compileResult = delegateCompiler.execute(spec);
    if (deleted && !compileResult.getDidWork()) {
        return new SimpleWorkResult(deleted);
    }
    return compileResult;
}
 
Example 18
Source File: IncrementalNativeCompiler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected WorkResult doCleanIncrementalCompile(NativeCompileSpec spec) {
    boolean deleted = cleanPreviousOutputs(spec);
    WorkResult compileResult = delegateCompiler.execute(spec);
    if (deleted && !compileResult.getDidWork()) {
        return new SimpleWorkResult(deleted);
    }
    return compileResult;
}