public File getFile() { if (file == null) { file = artifactSource.create(); artifactSource = null; } return file; }
public <T> T useCache(String operationDisplayName, Factory<? extends T> factory) { if (lockOptions != null && lockOptions.getMode() == FileLockManager.LockMode.Shared) { throw new UnsupportedOperationException("Not implemented yet."); } takeOwnership(operationDisplayName); boolean wasStarted = false; try { wasStarted = onStartWork(); return factory.create(); } finally { lock.lock(); try { try { if (wasStarted) { onEndWork(); } } finally { releaseOwnership(); } } finally { lock.unlock(); } } }
public <T> T longRunningOperation(String operationDisplayName, Factory<? extends T> action) { boolean wasEnded = startLongRunningOperation(operationDisplayName); try { return action.create(); } finally { finishLongRunningOperation(wasEnded); } }
public static <T> T whileDisabled(Factory<T> factory) { ENABLED.set(false); try { return factory.create(); } finally { ENABLED.set(true); } }
protected MavenPublishAction createDeployTask( File pomFile, LocalMavenRepositoryLocator mavenRepositoryLocator, MavenArtifactRepository artifactRepository) { GradleWagonMavenDeployAction deployTask = new GradleWagonMavenDeployAction(pomFile, artifactRepository, repositoryTransportFactory); deployTask.setLocalMavenRepositoryLocation(temporaryDirFactory.create()); deployTask.setRepositories(createMavenRemoteRepository(artifactRepository), null); return deployTask; }
public void apply(Project project) { RepositoryHandler repositories = artifactPublicationServicesFactory.create().getRepositoryHandler(); PublicationContainer publications = instantiator.newInstance(DefaultPublicationContainer.class, instantiator); project .getExtensions() .create( PublishingExtension.NAME, DefaultPublishingExtension.class, repositories, publications); }
public void processTestClass(TestClassRunInfo testClass) { if (processor == null) { processor = factory.create(); processor.startProcessing(resultProcessor); } processor.processTestClass(testClass); testCount++; if (testCount == restartEvery) { endBatch(); } }
private <T> T runWithOpenedCache(Factory<T> factory) { if (isOpen) { delegateCache.open(); try { return factory.create(); } finally { delegateCache.close(); } } else { throw new CacheOpenException("Cannot run operation on cache that has not been opened."); } }
private FileInfo copyIntoCache( Factory<File> baseDirFactory, File source, long lastModified, long length, HashValue hashValue) { File baseDir = baseDirFactory.create(); File cachedFile = new File(baseDir, hashValue.asCompactString() + '/' + source.getName()); if (!cachedFile.isFile()) { // Has previously been added to the cache directory GFileUtils.copyFile(source, cachedFile); } FileInfo fileInfo = new FileInfo(lastModified, length, hashValue, cachedFile); cachedFiles.put(source, fileInfo); return fileInfo; }
RemoteTestClassProcessor forkProcess() { WorkerProcessBuilder builder = workerFactory.create(); builder.setBaseName("Gradle Test Executor"); builder.applicationClasspath(classPath); builder.setLoadApplicationInSystemClassLoader(true); builder.worker(new TestWorker(processorFactory)); options.copyTo(builder.getJavaCommand()); buildConfigAction.execute(builder); workerProcess = builder.build(); workerProcess.start(); ObjectConnection connection = workerProcess.getConnection(); connection.useParameterSerializer(TestEventSerializer.create()); connection.addIncoming(TestResultProcessor.class, resultProcessor); RemoteTestClassProcessor remoteProcessor = connection.addOutgoing(RemoteTestClassProcessor.class); connection.connect(); remoteProcessor.startProcessing(); return remoteProcessor; }
public Class<? extends Plugin> resolve() { ClassPath classPath = classPathFactory.create(); Factory<? extends ClassLoader> loader = parent.loader(classPath); PluginRegistry pluginRegistry = new DefaultPluginRegistry(loader, instantiator); return pluginRegistry.getTypeForId(pluginId.toString()); }
private File getTmpDir() { return tmpDirSource.create(); }
public <T> T readFile(Factory<? extends T> action) throws LockTimeoutException, FileIntegrityViolationException { assertOpenAndIntegral(); return action.create(); }
public <T> T readFile(Factory<? extends T> action) throws LockTimeoutException { return action.create(); }
public <T> T longRunningOperation(String operationDisplayName, Factory<? extends T> action) { return action.create(); }
public <T> T useCache(String operationDisplayName, Factory<? extends T> action) { // The contract of useCache() means we have to provide some basic synchronization. synchronized (this) { return action.create(); } }