Search in sources :

Example 1 with StreamHasher

use of org.gradle.internal.hash.StreamHasher in project gradle by gradle.

the class DefaultScript method init.

@Override
public void init(final Object target, ServiceRegistry services) {
    super.init(target, services);
    this.__scriptServices = services;
    loggingManager = services.get(LoggingManager.class);
    Instantiator instantiator = services.get(Instantiator.class);
    FileLookup fileLookup = services.get(FileLookup.class);
    ExecFactory execFactory = services.get(ExecFactory.class);
    DirectoryFileTreeFactory directoryFileTreeFactory = services.get(DirectoryFileTreeFactory.class);
    StreamHasher streamHasher = services.get(StreamHasher.class);
    FileHasher fileHasher = services.get(FileHasher.class);
    if (target instanceof FileOperations) {
        fileOperations = (FileOperations) target;
    } else {
        File sourceFile = getScriptSource().getResource().getLocation().getFile();
        if (sourceFile != null) {
            fileOperations = new DefaultFileOperations(fileLookup.getFileResolver(sourceFile.getParentFile()), null, null, instantiator, fileLookup, directoryFileTreeFactory, streamHasher, fileHasher, execFactory);
        } else {
            fileOperations = new DefaultFileOperations(fileLookup.getFileResolver(), null, null, instantiator, fileLookup, directoryFileTreeFactory, streamHasher, fileHasher, execFactory);
        }
    }
    processOperations = (ProcessOperations) fileOperations;
    providerFactory = services.get(ProviderFactory.class);
}
Also used : ExecFactory(org.gradle.process.internal.ExecFactory) FileHasher(org.gradle.internal.hash.FileHasher) DefaultFileOperations(org.gradle.api.internal.file.DefaultFileOperations) DirectoryFileTreeFactory(org.gradle.api.internal.file.collections.DirectoryFileTreeFactory) ProviderFactory(org.gradle.api.provider.ProviderFactory) LoggingManager(org.gradle.api.logging.LoggingManager) FileOperations(org.gradle.api.internal.file.FileOperations) DefaultFileOperations(org.gradle.api.internal.file.DefaultFileOperations) Instantiator(org.gradle.internal.reflect.Instantiator) StreamHasher(org.gradle.internal.hash.StreamHasher) FileLookup(org.gradle.api.internal.file.FileLookup) File(java.io.File)

Aggregations

File (java.io.File)1 DefaultFileOperations (org.gradle.api.internal.file.DefaultFileOperations)1 FileLookup (org.gradle.api.internal.file.FileLookup)1 FileOperations (org.gradle.api.internal.file.FileOperations)1 DirectoryFileTreeFactory (org.gradle.api.internal.file.collections.DirectoryFileTreeFactory)1 LoggingManager (org.gradle.api.logging.LoggingManager)1 ProviderFactory (org.gradle.api.provider.ProviderFactory)1 FileHasher (org.gradle.internal.hash.FileHasher)1 StreamHasher (org.gradle.internal.hash.StreamHasher)1 Instantiator (org.gradle.internal.reflect.Instantiator)1 ExecFactory (org.gradle.process.internal.ExecFactory)1