当前位置: 首页>>代码示例>>Java>>正文


Java DefaultServiceRegistry类代码示例

本文整理汇总了Java中org.gradle.internal.service.DefaultServiceRegistry的典型用法代码示例。如果您正苦于以下问题:Java DefaultServiceRegistry类的具体用法?Java DefaultServiceRegistry怎么用?Java DefaultServiceRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DefaultServiceRegistry类属于org.gradle.internal.service包,在下文中一共展示了DefaultServiceRegistry类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.gradle.internal.service.DefaultServiceRegistry; //导入依赖的package包/类
@Override
public void execute(final WorkerProcessContext workerProcessContext) {
    LOGGER.info("{} started executing tests.", workerProcessContext.getDisplayName());

    completed = new CountDownLatch(1);

    System.setProperty(WORKER_ID_SYS_PROPERTY, workerProcessContext.getWorkerId().toString());

    DefaultServiceRegistry testServices = new TestFrameworkServiceRegistry(workerProcessContext);
    startReceivingTests(workerProcessContext, testServices);

    try {
        try {
            completed.await();
        } catch (InterruptedException e) {
            throw new UncheckedException(e);
        }
    } finally {
        LOGGER.info("{} finished executing tests.", workerProcessContext.getDisplayName());
        // Clean out any security manager the tests might have installed
        System.setSecurityManager(null);
        testServices.close();
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:25,代码来源:TestWorker.java

示例2: execute

import org.gradle.internal.service.DefaultServiceRegistry; //导入依赖的package包/类
public void execute(final WorkerProcessContext workerProcessContext) {
    LOGGER.info("{} started executing tests.", workerProcessContext.getDisplayName());

    completed = new CountDownLatch(1);

    System.setProperty(WORKER_ID_SYS_PROPERTY, workerProcessContext.getWorkerId().toString());

    DefaultServiceRegistry testServices = new TestFrameworkServiceRegistry(workerProcessContext);
    startReceivingTests(workerProcessContext, testServices);

    try {
        try {
            completed.await();
        } catch (InterruptedException e) {
            throw new UncheckedException(e);
        }
    } finally {
        LOGGER.info("{} finished executing tests.", workerProcessContext.getDisplayName());
        // Clean out any security manager the tests might have installed
        System.setSecurityManager(null);
        testServices.close();
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:24,代码来源:TestWorker.java

示例3: 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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:DefaultDependencyManagementServices.java

示例4: 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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DaemonClientFactory.java

示例5: 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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DaemonClientFactory.java

示例6: 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]));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DaemonClientFactory.java

示例7: 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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:63,代码来源:DefaultScriptPluginFactory.java

示例8: init

import org.gradle.internal.service.DefaultServiceRegistry; //导入依赖的package包/类
/**
 * Performs the wiring for the given Gradle {@link Project}.
 *
 * @param project
 */
public static void init(final Project project) {

    final Path srcdepsYamlPath = project.getRootDir().toPath().resolve("srcdeps.yaml");

    Gradle gradle = project.getGradle();
    if (!(gradle instanceof GradleInternal)) {
        throw new RuntimeException(String.format("Expected %s, but found %s", GradleInternal.class.getName(),
                gradle.getClass().getName()));
    }

    ServiceRegistry services = ((GradleInternal) gradle).getServices();
    if (!(services instanceof DefaultServiceRegistry)) {
        throw new RuntimeException(String.format("Expected %s, but found %s",
                DefaultServiceRegistry.class.getName(), services.getClass().getName()));
    }

    ArtifactRepository repo = project.getRepositories()
            .findByName(org.gradle.api.artifacts.ArtifactRepositoryContainer.DEFAULT_MAVEN_LOCAL_REPO_NAME);
    if (!(repo instanceof MavenArtifactRepository)) {
        throw new RuntimeException(
                String.format("Expected %s, but found %s", MavenArtifactRepository.class.getName(), repo));
    }
    final MavenLocalRepository localRepository = new MavenLocalRepository(Paths.get(((MavenArtifactRepository) repo).getUrl()));

    final Path scrdepsDir = localRepository.getRootDirectory().getParent().resolve("srcdeps");
    final PathLocker<SrcVersion> pathLocker = new PathLocker<>();
    final BuildDirectoriesManager buildDirectoriesManager = new BuildDirectoriesManager(scrdepsDir, pathLocker);

    ClassLoader classloader = Wiring.class.getClassLoader();
    final Module spaceModule = new SpaceModule(new URLClassSpace(classloader));
    Module wrappedWiremodule = new Module() {
        @Override
        public void configure(Binder binder) {

            spaceModule.configure(binder);

            binder.bind(Path.class).annotatedWith(Names.named(ConfigurationService.SRCDEPS_YAML_PATH))
                    .toInstance(srcdepsYamlPath);
            binder.bind(MavenLocalRepository.class).toInstance(localRepository);
            binder.bind(new TypeLiteral<PathLocker<SrcVersion>>() {
            }).toInstance(pathLocker);
            binder.bind(BuildDirectoriesManager.class).toInstance(buildDirectoriesManager);
        }
    };
    final Module wireModule = new WireModule(wrappedWiremodule);
    injector = Guice.createInjector(wireModule);
}
 
开发者ID:srcdeps,项目名称:srcdeps-gradle-plugin,代码行数:53,代码来源:Wiring.java

示例9: 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();
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:53,代码来源:DefaultScriptPluginFactory.java

示例10: 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();
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:61,代码来源:DefaultScriptPluginFactory.java


注:本文中的org.gradle.internal.service.DefaultServiceRegistry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。