Java Code Examples for org.gradle.api.internal.file.TemporaryFileProvider

The following examples show how to use org.gradle.api.internal.file.TemporaryFileProvider. These examples are extracted from open source projects. 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
public SftpTransport(String name,
                     PasswordCredentials credentials,
                     ProgressLoggerFactory progressLoggerFactory,
                     TemporaryFileProvider temporaryFileProvider,
                     CachedExternalResourceIndex<String> cachedExternalResourceIndex,
                     BuildCommencedTimeProvider timeProvider,
                     SftpClientFactory sftpClientFactory,
                     CacheLockingManager cacheLockingManager) {
    super(name);
    SftpResourceAccessor accessor = new SftpResourceAccessor(sftpClientFactory, credentials);
    SftpResourceUploader uploader = new SftpResourceUploader(sftpClientFactory, credentials);
    ProgressLoggingExternalResourceAccessor loggingAccessor = new ProgressLoggingExternalResourceAccessor(accessor, progressLoggerFactory);
    resourceAccessor = new DefaultCacheAwareExternalResourceAccessor(loggingAccessor, cachedExternalResourceIndex, timeProvider, temporaryFileProvider, cacheLockingManager);
    repository = new DefaultExternalResourceRepository(
            name,
            accessor,
            new ProgressLoggingExternalResourceUploader(uploader, progressLoggerFactory),
            new SftpResourceLister(sftpClientFactory, credentials)
    );
}
 
Example 2
public HttpTransport(String name, PasswordCredentials credentials,
                     ProgressLoggerFactory progressLoggerFactory,
                     TemporaryFileProvider temporaryFileProvider,
                     CachedExternalResourceIndex<String> cachedExternalResourceIndex,
                     BuildCommencedTimeProvider timeProvider,
                     CacheLockingManager cacheLockingManager) {
    super(name);
    HttpClientHelper http = new HttpClientHelper(new DefaultHttpSettings(credentials));
    HttpResourceAccessor accessor = new HttpResourceAccessor(http);
    HttpResourceUploader uploader = new HttpResourceUploader(http);
    ProgressLoggingExternalResourceAccessor loggingAccessor = new ProgressLoggingExternalResourceAccessor(accessor, progressLoggerFactory);
    resourceAccessor = new DefaultCacheAwareExternalResourceAccessor(loggingAccessor, cachedExternalResourceIndex, timeProvider, temporaryFileProvider, cacheLockingManager);
    repository = new DefaultExternalResourceRepository(
            name,
            accessor,
            new ProgressLoggingExternalResourceUploader(uploader, progressLoggerFactory),
            new HttpResourceLister(accessor)
    );
}
 
Example 3
public FileCollectionBackedArchiveTextResource(final FileOperations fileOperations,
                                               final TemporaryFileProvider tempFileProvider,
                                               final FileCollection fileCollection,
                                               final String path, Charset charset) {
    super(tempFileProvider, new LazilyInitializedFileTree() {
        @Override
        public FileTree createDelegate() {
            File archiveFile = fileCollection.getSingleFile();
            String fileExtension = Files.getFileExtension(archiveFile.getName());
            FileTree archiveContents = fileExtension.equals("jar") || fileExtension.equals("zip")
                    ? fileOperations.zipTree(archiveFile) : fileOperations.tarTree(archiveFile);
            PatternSet patternSet = new PatternSet();
            patternSet.include(path);
            return archiveContents.matching(patternSet);
        }
        public TaskDependency getBuildDependencies() {
            return fileCollection.getBuildDependencies();
        }
    }, charset);
}
 
Example 4
public SftpTransport(String name,
                     PasswordCredentials credentials,
                     ProgressLoggerFactory progressLoggerFactory,
                     TemporaryFileProvider temporaryFileProvider,
                     CachedExternalResourceIndex<String> cachedExternalResourceIndex,
                     BuildCommencedTimeProvider timeProvider,
                     SftpClientFactory sftpClientFactory,
                     CacheLockingManager cacheLockingManager) {
    super(name);
    SftpResourceAccessor accessor = new SftpResourceAccessor(sftpClientFactory, credentials);
    SftpResourceUploader uploader = new SftpResourceUploader(sftpClientFactory, credentials);
    ProgressLoggingExternalResourceAccessor loggingAccessor = new ProgressLoggingExternalResourceAccessor(accessor, progressLoggerFactory);
    resourceAccessor = new DefaultCacheAwareExternalResourceAccessor(loggingAccessor, cachedExternalResourceIndex, timeProvider, temporaryFileProvider, cacheLockingManager);
    repository = new DefaultExternalResourceRepository(
            name,
            accessor,
            new ProgressLoggingExternalResourceUploader(uploader, progressLoggerFactory),
            new SftpResourceLister(sftpClientFactory, credentials)
    );
}
 
Example 5
public HttpTransport(String name, PasswordCredentials credentials,
                     ProgressLoggerFactory progressLoggerFactory,
                     TemporaryFileProvider temporaryFileProvider,
                     CachedExternalResourceIndex<String> cachedExternalResourceIndex,
                     BuildCommencedTimeProvider timeProvider,
                     CacheLockingManager cacheLockingManager) {
    super(name);
    HttpClientHelper http = new HttpClientHelper(new DefaultHttpSettings(credentials));
    HttpResourceAccessor accessor = new HttpResourceAccessor(http);
    HttpResourceUploader uploader = new HttpResourceUploader(http);
    ProgressLoggingExternalResourceAccessor loggingAccessor = new ProgressLoggingExternalResourceAccessor(accessor, progressLoggerFactory);
    resourceAccessor = new DefaultCacheAwareExternalResourceAccessor(loggingAccessor, cachedExternalResourceIndex, timeProvider, temporaryFileProvider, cacheLockingManager);
    repository = new DefaultExternalResourceRepository(
            name,
            accessor,
            new ProgressLoggingExternalResourceUploader(uploader, progressLoggerFactory),
            new HttpResourceLister(accessor)
    );
}
 
Example 6
public FileCollectionBackedArchiveTextResource(final FileOperations fileOperations,
                                               final TemporaryFileProvider tempFileProvider,
                                               final FileCollection fileCollection,
                                               final String path, Charset charset) {
    super(tempFileProvider, new LazilyInitializedFileTree() {
        @Override
        public FileTree createDelegate() {
            File archiveFile = fileCollection.getSingleFile();
            String fileExtension = Files.getFileExtension(archiveFile.getName());
            FileTree archiveContents = fileExtension.equals("jar") || fileExtension.equals("zip")
                    ? fileOperations.zipTree(archiveFile) : fileOperations.tarTree(archiveFile);
            PatternSet patternSet = new PatternSet();
            patternSet.include(path);
            return archiveContents.matching(patternSet);
        }
        public TaskDependency getBuildDependencies() {
            return fileCollection.getBuildDependencies();
        }
    }, charset);
}
 
Example 7
public RepositoryTransportFactory(ProgressLoggerFactory progressLoggerFactory,
                                  TemporaryFileProvider temporaryFileProvider,
                                  CachedExternalResourceIndex<String> cachedExternalResourceIndex,
                                  BuildCommencedTimeProvider timeProvider,
                                  SftpClientFactory sftpClientFactory,
                                  CacheLockingManager cacheLockingManager) {
    this.progressLoggerFactory = progressLoggerFactory;
    this.temporaryFileProvider = temporaryFileProvider;
    this.cachedExternalResourceIndex = cachedExternalResourceIndex;
    this.timeProvider = timeProvider;
    this.sftpClientFactory = sftpClientFactory;
    this.cacheLockingManager = cacheLockingManager;
}
 
Example 8
RepositoryTransportFactory createRepositoryTransportFactory(ProgressLoggerFactory progressLoggerFactory,
                                                            TemporaryFileProvider temporaryFileProvider,
                                                            ByUrlCachedExternalResourceIndex externalResourceIndex,
                                                            BuildCommencedTimeProvider buildCommencedTimeProvider,
                                                            SftpClientFactory sftpClientFactory,
                                                            CacheLockingManager cacheLockingManager) {
    return new RepositoryTransportFactory(
            progressLoggerFactory,
            temporaryFileProvider,
            externalResourceIndex,
            buildCommencedTimeProvider,
            sftpClientFactory,
            cacheLockingManager
    );
}
 
Example 9
public DefaultCacheAwareExternalResourceAccessor(ExternalResourceAccessor delegate, CachedExternalResourceIndex<String> cachedExternalResourceIndex, BuildCommencedTimeProvider timeProvider, TemporaryFileProvider temporaryFileProvider, CacheLockingManager cacheLockingManager) {
    this.delegate = delegate;
    this.cachedExternalResourceIndex = cachedExternalResourceIndex;
    this.timeProvider = timeProvider;
    this.temporaryFileProvider = temporaryFileProvider;
    this.cacheLockingManager = cacheLockingManager;
}
 
Example 10
public File prepareProjectDir(File projectDir) {
    if (projectDir == null) {
        TemporaryFileProvider temporaryFileProvider = new TmpDirTemporaryFileProvider();
        projectDir = temporaryFileProvider.createTemporaryDirectory("gradle", "projectDir");
        // TODO deleteOnExit won't clean up non-empty directories (and it leaks memory for long-running processes).
        projectDir.deleteOnExit();
    } else {
        projectDir = GFileUtils.canonicalise(projectDir);
    }
    return projectDir;
}
 
Example 11
public HttpTransport(String name, PasswordCredentials credentials, RepositoryArtifactCache repositoryCacheManager,
                     ProgressLoggerFactory progressLoggerFactory, TemporaryFileProvider temporaryFileProvider,
                     CachedExternalResourceIndex<String> cachedExternalResourceIndex, BuildCommencedTimeProvider timeProvider) {
    this.name = name;
    this.repositoryCacheManager = repositoryCacheManager;
    repository = createRepository(credentials, progressLoggerFactory, temporaryFileProvider, cachedExternalResourceIndex, timeProvider);
}
 
Example 12
private ExternalResourceRepository createRepository(PasswordCredentials credentials, ProgressLoggerFactory progressLoggerFactory,
                                                    TemporaryFileProvider temporaryFileProvider, CachedExternalResourceIndex<String> cachedExternalResourceIndex, BuildCommencedTimeProvider timeProvider) {
    HttpClientHelper http = new HttpClientHelper(new DefaultHttpSettings(credentials));
    HttpResourceAccessor accessor = new HttpResourceAccessor(http);
    HttpResourceUploader uploader = new HttpResourceUploader(http);
    ProgressLoggingExternalResourceAccessor loggingAccessor = new ProgressLoggingExternalResourceAccessor(accessor, progressLoggerFactory);
    return new DefaultExternalResourceRepository(
            name,
            accessor,
            new ProgressLoggingExternalResourceUploader(uploader, progressLoggerFactory),
            new HttpResourceLister(accessor),
            temporaryFileProvider,
            new DefaultCacheAwareExternalResourceAccessor(loggingAccessor, cachedExternalResourceIndex, timeProvider)
    );
}
 
Example 13
public DefaultExternalResourceRepository(String name, ExternalResourceAccessor accessor, ExternalResourceUploader uploader,
                                         ExternalResourceLister lister, TemporaryFileProvider temporaryFileProvider,
                                         CacheAwareExternalResourceAccessor cacheAwareAccessor) {
    this.name = name;
    this.accessor = accessor;
    this.uploader = uploader;
    this.lister = lister;
    this.temporaryFileProvider = temporaryFileProvider;
    this.cacheAwareAccessor = cacheAwareAccessor;
}
 
Example 14
public DownloadingRepositoryCacheManager(String name, FileStore<ModuleVersionArtifactMetaData> fileStore,
                                         TemporaryFileProvider temporaryFileProvider, CacheLockingManager cacheLockingManager) {
    super(name);
    this.fileStore = fileStore;
    this.temporaryFileProvider = temporaryFileProvider;
    this.cacheLockingManager = cacheLockingManager;
}
 
Example 15
public RepositoryTransportFactory(ProgressLoggerFactory progressLoggerFactory,
                                  RepositoryArtifactCache localCacheManager,
                                  RepositoryArtifactCache downloadingCacheManager,
                                  TemporaryFileProvider temporaryFileProvider,
                                  CachedExternalResourceIndex<String> cachedExternalResourceIndex,
                                  BuildCommencedTimeProvider timeProvider) {
    this.progressLoggerFactory = progressLoggerFactory;
    this.localCacheManager = localCacheManager;
    this.downloadingCacheManager = downloadingCacheManager;
    this.temporaryFileProvider = temporaryFileProvider;
    this.cachedExternalResourceIndex = cachedExternalResourceIndex;
    this.timeProvider = timeProvider;
}
 
Example 16
public DownloadingRepositoryArtifactCache(FileStore<ModuleVersionArtifactMetaData> fileStore, CachedExternalResourceIndex<String> artifactUrlCachedResolutionIndex,
                                          TemporaryFileProvider temporaryFileProvider, CacheLockingManager cacheLockingManager) {
    this.fileStore = fileStore;
    this.artifactUrlCachedResolutionIndex = artifactUrlCachedResolutionIndex;
    this.temporaryFileProvider = temporaryFileProvider;
    this.cacheLockingManager = cacheLockingManager;
}
 
Example 17
DownloadingRepositoryArtifactCache createDownloadingRepositoryArtifactCache(ArtifactIdentifierFileStore artifactIdentifierFileStore, ByUrlCachedExternalResourceIndex externalResourceIndex,
                                                                            TemporaryFileProvider temporaryFileProvider, CacheLockingManager cacheLockingManager) {
    return new DownloadingRepositoryArtifactCache(artifactIdentifierFileStore,
            externalResourceIndex,
            temporaryFileProvider,
            cacheLockingManager);
}
 
Example 18
RepositoryTransportFactory createRepositoryTransportFactory(ProgressLoggerFactory progressLoggerFactory, LocalFileRepositoryArtifactCache localFileRepositoryArtifactCache,
                                                            DownloadingRepositoryArtifactCache downloadingRepositoryArtifactCache, TemporaryFileProvider temporaryFileProvider,
                                                            ByUrlCachedExternalResourceIndex externalResourceIndex, BuildCommencedTimeProvider buildCommencedTimeProvider) {
    return new RepositoryTransportFactory(
            progressLoggerFactory,
            localFileRepositoryArtifactCache,
            downloadingRepositoryArtifactCache,
            temporaryFileProvider,
            externalResourceIndex,
            buildCommencedTimeProvider
    );
}
 
Example 19
LegacyDependencyResolverRepositoryFactory createCustomerResolverRepositoryFactory(ProgressLoggerFactory progressLoggerFactory, ArtifactIdentifierFileStore artifactIdentifierFileStore,
                                                                                  TemporaryFileProvider temporaryFileProvider, CacheLockingManager cacheLockingManager) {
    return new CustomIvyResolverRepositoryFactory(
            progressLoggerFactory,
            new LocalFileRepositoryCacheManager("local"),
            new DownloadingRepositoryCacheManager(
                    "downloading",
                    artifactIdentifierFileStore,
                    temporaryFileProvider,
                    cacheLockingManager
            )
    );
}
 
Example 20
public File prepareProjectDir(File projectDir) {
    if (projectDir == null) {
        TemporaryFileProvider temporaryFileProvider = new TmpDirTemporaryFileProvider();
        projectDir = temporaryFileProvider.createTemporaryDirectory("gradle", "projectDir");
        // TODO deleteOnExit won't clean up non-empty directories (and it leaks memory for long-running processes).
        projectDir.deleteOnExit();
    } else {
        projectDir = GFileUtils.canonicalise(projectDir);
    }
    return projectDir;
}
 
Example 21
public GroovyCompile() {
    ProjectInternal projectInternal = (ProjectInternal) getProject();
    IsolatedAntBuilder antBuilder = getServices().get(IsolatedAntBuilder.class);
    ClassPathRegistry classPathRegistry = getServices().get(ClassPathRegistry.class);
    Factory<AntBuilder> antBuilderFactory = getServices().getFactory(AntBuilder.class);
    JavaCompilerFactory inProcessCompilerFactory = new InProcessJavaCompilerFactory();
    tempFileProvider = projectInternal.getServices().get(TemporaryFileProvider.class);
    CompilerDaemonManager compilerDaemonManager = getServices().get(CompilerDaemonManager.class);
    InProcessCompilerDaemonFactory inProcessCompilerDaemonFactory = getServices().get(InProcessCompilerDaemonFactory.class);
    DefaultJavaCompilerFactory javaCompilerFactory = new DefaultJavaCompilerFactory(projectInternal, antBuilderFactory, inProcessCompilerFactory, compilerDaemonManager);
    GroovyCompilerFactory groovyCompilerFactory = new GroovyCompilerFactory(projectInternal, antBuilder, classPathRegistry, javaCompilerFactory, compilerDaemonManager, inProcessCompilerDaemonFactory);
    Compiler<GroovyJavaJointCompileSpec> delegatingCompiler = new DelegatingGroovyCompiler(groovyCompilerFactory);
    compiler = new CleaningGroovyCompiler(delegatingCompiler, getOutputs());
}
 
Example 22
Source Project: gradle-plugins   Source File: CompressFileOperationsImpl.java    License: MIT License 5 votes vote down vote up
public CompressFileOperationsImpl(ProjectInternal project) {
    fileOperations = project.getFileOperations();

    temporaryFileProvider = project.getServices().get(TemporaryFileProvider.class);
    fileHasher = project.getServices().get(FileHasher.class);
    fileSystem = project.getServices().get(FileSystem.class);
    directoryFileTreeFactory = project.getServices().get(DirectoryFileTreeFactory.class);
    patternSetFactory = project.getServices().getFactory(PatternSet.class);
}
 
Example 23
Source Project: gradle-plugins   Source File: CompressFileOperationsImpl.java    License: MIT License 5 votes vote down vote up
public CompressFileOperationsImpl(ProjectInternal project) {
    fileOperations = project.getFileOperations();

    temporaryFileProvider = project.getServices().get(TemporaryFileProvider.class);
    fileHasher = project.getServices().get(FileHasher.class);
    fileSystem = project.getServices().get(FileSystem.class);
    directoryFileTreeFactory = project.getServices().get(DirectoryFileTreeFactory.class);
    patternSetFactory = project.getServices().getFactory(PatternSet.class);
}
 
Example 24
public RepositoryTransportFactory(ProgressLoggerFactory progressLoggerFactory,
                                  TemporaryFileProvider temporaryFileProvider,
                                  CachedExternalResourceIndex<String> cachedExternalResourceIndex,
                                  BuildCommencedTimeProvider timeProvider,
                                  SftpClientFactory sftpClientFactory,
                                  CacheLockingManager cacheLockingManager) {
    this.progressLoggerFactory = progressLoggerFactory;
    this.temporaryFileProvider = temporaryFileProvider;
    this.cachedExternalResourceIndex = cachedExternalResourceIndex;
    this.timeProvider = timeProvider;
    this.sftpClientFactory = sftpClientFactory;
    this.cacheLockingManager = cacheLockingManager;
}
 
Example 25
RepositoryTransportFactory createRepositoryTransportFactory(ProgressLoggerFactory progressLoggerFactory,
                                                            TemporaryFileProvider temporaryFileProvider,
                                                            ByUrlCachedExternalResourceIndex externalResourceIndex,
                                                            BuildCommencedTimeProvider buildCommencedTimeProvider,
                                                            SftpClientFactory sftpClientFactory,
                                                            CacheLockingManager cacheLockingManager) {
    return new RepositoryTransportFactory(
            progressLoggerFactory,
            temporaryFileProvider,
            externalResourceIndex,
            buildCommencedTimeProvider,
            sftpClientFactory,
            cacheLockingManager
    );
}
 
Example 26
public DefaultCacheAwareExternalResourceAccessor(ExternalResourceAccessor delegate, CachedExternalResourceIndex<String> cachedExternalResourceIndex, BuildCommencedTimeProvider timeProvider, TemporaryFileProvider temporaryFileProvider, CacheLockingManager cacheLockingManager) {
    this.delegate = delegate;
    this.cachedExternalResourceIndex = cachedExternalResourceIndex;
    this.timeProvider = timeProvider;
    this.temporaryFileProvider = temporaryFileProvider;
    this.cacheLockingManager = cacheLockingManager;
}
 
Example 27
public File prepareProjectDir(File projectDir) {
    if (projectDir == null) {
        TemporaryFileProvider temporaryFileProvider = new TmpDirTemporaryFileProvider();
        projectDir = temporaryFileProvider.createTemporaryDirectory("gradle", "projectDir");
        // TODO deleteOnExit won't clean up non-empty directories (and it leaks memory for long-running processes).
        projectDir.deleteOnExit();
    } else {
        projectDir = GFileUtils.canonicalise(projectDir);
    }
    return projectDir;
}
 
Example 28
public HttpTransport(String name, PasswordCredentials credentials, RepositoryArtifactCache repositoryCacheManager,
                     ProgressLoggerFactory progressLoggerFactory, TemporaryFileProvider temporaryFileProvider,
                     CachedExternalResourceIndex<String> cachedExternalResourceIndex, BuildCommencedTimeProvider timeProvider) {
    this.name = name;
    this.repositoryCacheManager = repositoryCacheManager;
    repository = createRepository(credentials, progressLoggerFactory, temporaryFileProvider, cachedExternalResourceIndex, timeProvider);
}
 
Example 29
private ExternalResourceRepository createRepository(PasswordCredentials credentials, ProgressLoggerFactory progressLoggerFactory,
                                                    TemporaryFileProvider temporaryFileProvider, CachedExternalResourceIndex<String> cachedExternalResourceIndex, BuildCommencedTimeProvider timeProvider) {
    HttpClientHelper http = new HttpClientHelper(new DefaultHttpSettings(credentials));
    HttpResourceAccessor accessor = new HttpResourceAccessor(http);
    HttpResourceUploader uploader = new HttpResourceUploader(http);
    ProgressLoggingExternalResourceAccessor loggingAccessor = new ProgressLoggingExternalResourceAccessor(accessor, progressLoggerFactory);
    return new DefaultExternalResourceRepository(
            name,
            accessor,
            new ProgressLoggingExternalResourceUploader(uploader, progressLoggerFactory),
            new HttpResourceLister(accessor),
            temporaryFileProvider,
            new DefaultCacheAwareExternalResourceAccessor(loggingAccessor, cachedExternalResourceIndex, timeProvider)
    );
}
 
Example 30
public DefaultExternalResourceRepository(String name, ExternalResourceAccessor accessor, ExternalResourceUploader uploader,
                                         ExternalResourceLister lister, TemporaryFileProvider temporaryFileProvider,
                                         CacheAwareExternalResourceAccessor cacheAwareAccessor) {
    this.name = name;
    this.accessor = accessor;
    this.uploader = uploader;
    this.lister = lister;
    this.temporaryFileProvider = temporaryFileProvider;
    this.cacheAwareAccessor = cacheAwareAccessor;
}