本文整理汇总了Java中org.gradle.internal.service.DefaultServiceRegistry.add方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultServiceRegistry.add方法的具体用法?Java DefaultServiceRegistry.add怎么用?Java DefaultServiceRegistry.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.internal.service.DefaultServiceRegistry
的用法示例。
在下文中一共展示了DefaultServiceRegistry.add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.gradle.internal.service.DefaultServiceRegistry; //导入方法依赖的package包/类
public DependencyResolutionServices create(FileResolver fileResolver, DependencyMetaDataProvider dependencyMetaDataProvider, ProjectFinder projectFinder, DomainObjectContext domainObjectContext) {
DefaultServiceRegistry services = new DefaultServiceRegistry(parent);
services.add(FileResolver.class, fileResolver);
services.add(DependencyMetaDataProvider.class, dependencyMetaDataProvider);
services.add(ProjectFinder.class, projectFinder);
services.add(DomainObjectContext.class, domainObjectContext);
services.addProvider(new DependencyResolutionScopeServices());
return services.get(DependencyResolutionServices.class);
}
示例2: createBuildClientServices
import org.gradle.internal.service.DefaultServiceRegistry; //导入方法依赖的package包/类
/**
* Creates the services for a {@link DaemonClient} that can be used to run builds.
*/
public ServiceRegistry createBuildClientServices(OutputEventListener loggingReceiver, DaemonParameters daemonParameters, InputStream stdin) {
DefaultServiceRegistry loggingServices = new DefaultServiceRegistry(sharedServices);
loggingServices.add(OutputEventListener.class, loggingReceiver);
return new DaemonClientServices(loggingServices, daemonParameters, stdin);
}
示例3: createSingleUseDaemonClientServices
import org.gradle.internal.service.DefaultServiceRegistry; //导入方法依赖的package包/类
/**
* Creates the services for a {@link DaemonClient} that can be used to run a build in a single-use daemon.
*/
public ServiceRegistry createSingleUseDaemonClientServices(OutputEventListener loggingReceiver, DaemonParameters daemonParameters, InputStream stdin) {
DefaultServiceRegistry loggingServices = new DefaultServiceRegistry(sharedServices);
loggingServices.add(OutputEventListener.class, loggingReceiver);
return new SingleUseDaemonClientServices(loggingServices, daemonParameters, stdin);
}
示例4: createStopDaemonServices
import org.gradle.internal.service.DefaultServiceRegistry; //导入方法依赖的package包/类
/**
* Creates the services for a {@link DaemonStopClient} that can be used to stop builds.
*/
public ServiceRegistry createStopDaemonServices(OutputEventListener loggingReceiver, DaemonParameters daemonParameters) {
DefaultServiceRegistry loggingServices = new DefaultServiceRegistry(sharedServices);
loggingServices.add(OutputEventListener.class, loggingReceiver);
return new DaemonClientServices(loggingServices, daemonParameters, new ByteArrayInputStream(new byte[0]));
}
示例5: apply
import org.gradle.internal.service.DefaultServiceRegistry; //导入方法依赖的package包/类
public void apply(final Object target) {
final DefaultServiceRegistry services = new DefaultServiceRegistry() {
Factory<PatternSet> createPatternSetFactory() {
return fileLookup.getFileResolver().getPatternSetFactory();
}
};
services.add(ScriptPluginFactory.class, DefaultScriptPluginFactory.this);
services.add(ScriptHandlerFactory.class, scriptHandlerFactory);
services.add(ClassLoaderScope.class, targetScope);
services.add(LoggingManagerInternal.class, loggingManagerFactory.create());
services.add(Instantiator.class, instantiator);
services.add(ScriptHandler.class, scriptHandler);
services.add(FileLookup.class, fileLookup);
services.add(DirectoryFileTreeFactory.class, directoryFileTreeFactory);
services.add(ModelRuleSourceDetector.class, modelRuleSourceDetector);
services.add(PluginRepositoryRegistry.class, pluginRepositoryRegistry);
services.add(PluginRepositoryFactory.class, pluginRepositoryFactory);
final ScriptTarget initialPassScriptTarget = initialPassTarget(target);
ScriptCompiler compiler = scriptCompilerFactory.createCompiler(scriptSource);
// Pass 1, extract plugin requests and plugin repositories and execute buildscript {}, ignoring (i.e. not even compiling) anything else
Class<? extends BasicScript> scriptType = initialPassScriptTarget.getScriptClass();
InitialPassStatementTransformer initialPassStatementTransformer = new InitialPassStatementTransformer(scriptSource, initialPassScriptTarget, documentationRegistry);
SubsetScriptTransformer initialTransformer = new SubsetScriptTransformer(initialPassStatementTransformer);
String id = INTERNER.intern("cp_" + initialPassScriptTarget.getId());
CompileOperation<PluginRequests> initialOperation = new FactoryBackedCompileOperation<PluginRequests>(id, initialTransformer, initialPassStatementTransformer, pluginRequestsSerializer);
ScriptRunner<? extends BasicScript, PluginRequests> initialRunner = compiler.compile(scriptType, initialOperation, baseScope.getExportClassLoader(), Actions.doNothing());
initialRunner.run(target, services);
PluginRequests pluginRequests = initialRunner.getData();
PluginManagerInternal pluginManager = initialPassScriptTarget.getPluginManager();
pluginRequestApplicator.applyPlugins(pluginRequests, scriptHandler, pluginManager, targetScope);
// Pass 2, compile everything except buildscript {}, pluginRepositories{}, and plugin requests, then run
final ScriptTarget scriptTarget = secondPassTarget(target);
scriptType = scriptTarget.getScriptClass();
BuildScriptTransformer buildScriptTransformer = new BuildScriptTransformer(scriptSource, scriptTarget);
String operationId = scriptTarget.getId();
CompileOperation<BuildScriptData> operation = new FactoryBackedCompileOperation<BuildScriptData>(operationId, buildScriptTransformer, buildScriptTransformer, buildScriptDataSerializer);
final ScriptRunner<? extends BasicScript, BuildScriptData> runner = compiler.compile(scriptType, operation, targetScope.getLocalClassLoader(), ClosureCreationInterceptingVerifier.INSTANCE);
if (scriptTarget.getSupportsMethodInheritance() && runner.getHasMethods()) {
scriptTarget.attachScript(runner.getScript());
}
if (!runner.getRunDoesSomething()) {
return;
}
Runnable buildScriptRunner = new Runnable() {
public void run() {
runner.run(target, services);
}
};
boolean hasImperativeStatements = runner.getData().getHasImperativeStatements();
scriptTarget.addConfiguration(buildScriptRunner, !hasImperativeStatements);
}
示例6: apply
import org.gradle.internal.service.DefaultServiceRegistry; //导入方法依赖的package包/类
public void apply(final Object target) {
DefaultServiceRegistry services = new DefaultServiceRegistry();
services.add(ScriptPluginFactory.class, DefaultScriptPluginFactory.this);
services.add(ScriptHandlerFactory.class, scriptHandlerFactory);
services.add(ClassLoaderScope.class, targetScope);
services.add(LoggingManagerInternal.class, loggingManagerFactory.create());
services.add(Instantiator.class, instantiator);
services.add(ScriptHandler.class, scriptHandler);
services.add(FileLookup.class, fileLookup);
ScriptSource withImports = importsReader.withImports(scriptSource);
PluginDependenciesService pluginDependenciesService = new PluginDependenciesService(getSource());
services.add(PluginDependenciesService.class, pluginDependenciesService);
ScriptCompiler compiler = scriptCompilerFactory.createCompiler(withImports);
compiler.setClassloader(baseScope.getExportClassLoader());
boolean supportsPluginsBlock = ProjectScript.class.isAssignableFrom(scriptType);
String onPluginBlockError = supportsPluginsBlock ? null : "Only Project build scripts can contain plugins {} blocks";
PluginsAndBuildscriptTransformer scriptBlockTransformer = new PluginsAndBuildscriptTransformer(classpathClosureName, onPluginBlockError, documentationRegistry);
StatementExtractingScriptTransformer classpathScriptTransformer = new StatementExtractingScriptTransformer(classpathClosureName, scriptBlockTransformer);
compiler.setTransformer(classpathScriptTransformer);
ScriptRunner<? extends BasicScript> classPathScriptRunner = compiler.compile(scriptType);
classPathScriptRunner.getScript().init(target, services);
classPathScriptRunner.run();
List<PluginRequest> pluginRequests = pluginDependenciesService.getRequests();
PluginAware pluginAware = target instanceof PluginAware ? (PluginAware) target : null;
pluginRequestApplicator.applyPlugins(pluginRequests, scriptHandler, pluginAware, targetScope);
compiler.setClassloader(targetScope.getLocalClassLoader());
BuildScriptTransformer transformer = new BuildScriptTransformer("no_" + classpathScriptTransformer.getId(), classpathScriptTransformer.invert(), scriptSource);
compiler.setTransformer(transformer);
// TODO - find a less tangled way of getting this in here, see the verifier impl for why it's needed
compiler.setVerifier(new ClosureCreationInterceptingVerifier());
ScriptRunner<? extends BasicScript> runner = compiler.compile(scriptType);
BasicScript script = runner.getScript();
script.init(target, services);
if (ownerScript && target instanceof ScriptAware) {
((ScriptAware) target).setScript(script);
}
runner.run();
}
示例7: apply
import org.gradle.internal.service.DefaultServiceRegistry; //导入方法依赖的package包/类
public void apply(final Object target) {
DefaultServiceRegistry services = new DefaultServiceRegistry();
services.add(ScriptPluginFactory.class, DefaultScriptPluginFactory.this);
services.add(ScriptHandlerFactory.class, scriptHandlerFactory);
services.add(ClassLoaderScope.class, classLoaderScope);
services.add(LoggingManagerInternal.class, loggingManagerFactory.create());
services.add(Instantiator.class, instantiator);
services.add(ScriptHandler.class, scriptHandler);
services.add(FileLookup.class, fileLookup);
ScriptSource withImports = importsReader.withImports(scriptSource);
List<PluginRequest> pluginRequests = new LinkedList<PluginRequest>();
if (target instanceof PluginAware) {
services.add(PluginHandler.class, new DefaultPluginHandler(pluginRequests));
} else {
services.add(PluginHandler.class, new NonPluggableTargetPluginHandler(target));
}
ScriptCompiler compiler = scriptCompilerFactory.createCompiler(withImports);
compiler.setClassloader(classLoaderScope.getBase().getChildClassLoader());
PluginsAndBuildscriptTransformer scriptBlockTransformer = new PluginsAndBuildscriptTransformer(classpathClosureName);
StatementExtractingScriptTransformer classpathScriptTransformer = new StatementExtractingScriptTransformer(classpathClosureName, scriptBlockTransformer);
compiler.setTransformer(classpathScriptTransformer);
ScriptRunner<? extends BasicScript> classPathScriptRunner = compiler.compile(scriptType);
classPathScriptRunner.getScript().init(target, services);
classPathScriptRunner.run();
Configuration classpathConfiguration = scriptHandler.getConfigurations().getByName(ScriptHandler.CLASSPATH_CONFIGURATION);
Set<File> files = classpathConfiguration.getFiles();
ClassPath classPath = new DefaultClassPath(files);
ClassLoader exportedClassLoader = classLoaderScope.export(classPath);
if (!pluginRequests.isEmpty()) {
PluginResolver pluginResolver = pluginResolverFactory.createPluginResolver(exportedClassLoader);
@SuppressWarnings("ConstantConditions")
PluginResolutionApplicator resolutionApplicator = new PluginResolutionApplicator((PluginAware) target, classLoaderScope);
PluginRequestApplicator requestApplicator = new PluginRequestApplicator(pluginResolver, resolutionApplicator);
requestApplicator.applyPlugin(pluginRequests);
}
classLoaderScope.lock();
compiler.setClassloader(classLoaderScope.getScopeClassLoader());
compiler.setTransformer(new BuildScriptTransformer("no_" + classpathScriptTransformer.getId(), classpathScriptTransformer.invert()));
ScriptRunner<? extends BasicScript> runner = compiler.compile(scriptType);
BasicScript script = runner.getScript();
script.init(target, services);
if (target instanceof ScriptAware) {
((ScriptAware) target).setScript(script);
}
runner.run();
}