public WorkResult copy(Closure closure) { FileCopyAction copyAction = new FileCopyAction(instantiator, resolver); CopySpecInternal copySpec = copyAction.getCopySpec(); copySpec.from(this); ConfigureUtil.configure(closure, copySpec); return copyAction.copy(); }
public ArtifactRepository createRepository(Object userDescription) { if (userDescription instanceof ArtifactRepository) { return (ArtifactRepository) userDescription; } if (userDescription instanceof String) { MavenArtifactRepository repository = createMavenRepository(); repository.setUrl(userDescription); return repository; } else if (userDescription instanceof Map) { Map<String, ?> userDescriptionMap = (Map<String, ?>) userDescription; MavenArtifactRepository repository = createMavenRepository(); ConfigureUtil.configureByMap(userDescriptionMap, repository); return repository; } DependencyResolver result; if (userDescription instanceof DependencyResolver) { result = (DependencyResolver) userDescription; } else { throw new InvalidUserDataException( String.format("Cannot create a DependencyResolver instance from %s", userDescription)); } return new CustomResolverArtifactRepository( result, progressLoggerFactory, localCacheManager, downloadingCacheManager); }
/** * Configures the manifest for this JAR archive. * * <p>The given closure is executed to configure the manifest. The {@link * org.gradle.api.java.archives.Manifest} is passed to the closure as its delegate. * * @param configureClosure The closure. * @return This. */ public Jar manifest(Closure<?> configureClosure) { if (getManifest() == null) { manifest = new DefaultManifest(((ProjectInternal) getProject()).getFileResolver()); } ConfigureUtil.configure(configureClosure, getManifest()); return this; }
@Override public Object invokeMethod(String name, Object... arguments) throws groovy.lang.MissingMethodException { if (isConfigureMethod(name, arguments)) { return ConfigureUtil.configure((Closure) arguments[0], getByName(name)); } else { return super.invokeMethod(name, arguments); } }
public DefaultConfigurableFileTree( Map<String, ?> args, FileResolver resolver, TaskResolver taskResolver, Instantiator instantiator) { this.resolver = resolver != null ? resolver : new IdentityFileResolver(); ConfigureUtil.configureByMap(args, this); buildDependency = new DefaultTaskDependency(taskResolver); this.instantiator = instantiator; }
public CopySpec from(Object sourcePath, Closure c) { if (c == null) { from(sourcePath); return this; } else { CopySpecImpl child = addChild(); child.from(sourcePath); ConfigureUtil.configure(c, child); return child; } }
public CopySpecImpl into(Object destPath, Closure configureClosure) { if (configureClosure == null) { into(destPath); return this; } else { CopySpecImpl child = addChild(); child.into(destPath); ConfigureUtil.configure(configureClosure, child); return child; } }
private TestFramework useTestFramework( TestFramework testFramework, Closure testFrameworkConfigure) { if (testFramework == null) { throw new IllegalArgumentException("testFramework is null!"); } this.testFramework = testFramework; if (testFrameworkConfigure != null) { ConfigureUtil.configure(testFrameworkConfigure, this.testFramework.getOptions()); } return this.testFramework; }
public ArtifactRepository createRepository(Object userDescription) { if (userDescription instanceof ArtifactRepository) { return (ArtifactRepository) userDescription; } if (userDescription instanceof String) { MavenArtifactRepository repository = createMavenRepository(); repository.setUrl(userDescription); return repository; } else if (userDescription instanceof Map) { Map<String, ?> userDescriptionMap = (Map<String, ?>) userDescription; MavenArtifactRepository repository = createMavenRepository(); ConfigureUtil.configureByMap(userDescriptionMap, repository); return repository; } if (userDescription instanceof DependencyResolver) { return legacyDependencyResolverRepositoryFactory.createRepository( (DependencyResolver) userDescription); } throw new InvalidUserDataException( String.format("Cannot create a DependencyResolver instance from %s", userDescription)); }
public DefaultCppSourceSet source(Closure closure) { ConfigureUtil.configure(closure, source); return this; }
public void repositories(Closure configureClosure) { ConfigureUtil.configure(configureClosure, repositoryHandler); }
public DefaultCppSourceSet exportedHeaders(Closure closure) { ConfigureUtil.configure(closure, exportedHeaders); return this; }
/** * Adds content to this JAR archive's META-INF directory. * * <p>The given closure is executed to configure a {@code CopySpec}. The {@link * org.gradle.api.file.CopySpec} is passed to the closure as its delegate. * * @param configureClosure The closure. * @return The created {@code CopySpec} */ public CopySpec metaInf(Closure<?> configureClosure) { return ConfigureUtil.configure(configureClosure, getMetaInf()); }
public void dependencies(Closure configureClosure) { ConfigureUtil.configure(configureClosure, dependencyHandler); }
/** * Enables advanced configuration like tinkering with the output XML or affecting the way that the * contents of an existing .classpath file is merged with Gradle build information. The object * passed to the whenMerged{} and beforeMerged{} closures is of type {@link Classpath}. * * <p>See {@link EclipseProject} for an example. */ public void file(Closure closure) { ConfigureUtil.configure(closure, file); }
/** * Allows configuring the logging of the test execution, for example log eagerly the standard * output, etc. * * <pre autoTested=''> * apply plugin: 'java' * * //makes the standard streams (err and out) visible at console when running tests * test.testLogging { * showStandardStreams = true * } * </pre> * * @param closure configure closure */ public void testLogging(Closure closure) { ConfigureUtil.configure(closure, testLogging); }
/** * Configured the credentials to be used when cloning the repo. This will be passed a {@link * PasswordCredentials} instance. * * @param closure the configuration closure */ @SuppressWarnings("rawtypes") public void credentials(Closure closure) { ConfigureUtil.configure(closure, getCredentials()); }
public T getByName(String name, Closure configureClosure) throws UnknownDomainObjectException { T t = getByName(name); ConfigureUtil.configure(configureClosure, t); return t; }
public void layout(String layoutName, Closure config) { layout(layoutName); ConfigureUtil.configure(config, layout); }
public void execute(Object o) { ConfigureUtil.configure(cl, o); }
public TestFrameworkOptions options(Closure testFrameworkConfigure) { TestFrameworkOptions options = getTestFramework().getOptions(); ConfigureUtil.configure(testFrameworkConfigure, testFramework.getOptions()); return options; }