Package org.gradle.internal.classpath

Examples of org.gradle.internal.classpath.ClassPath


        this.moduleRegistry = moduleRegistry;
    }

    public ClassPath findClassPath(String name) {
        if (name.equals("GRADLE_RUNTIME")) {
            ClassPath classpath = new DefaultClassPath();
            for (Module module : moduleRegistry.getModule("gradle-launcher").getAllRequiredModules()) {
                classpath = classpath.plus(module.getClasspath());
            }
            return classpath;
        }
        if (name.equals("GRADLE_CORE")) {
            return moduleRegistry.getModule("gradle-core").getImplementationClasspath();
        }
        if (name.equals("GRADLE_BASE_SERVICES")) {
            return moduleRegistry.getModule("gradle-base-services").getImplementationClasspath();
        }
        if (name.equals("COMMONS_CLI")) {
            return moduleRegistry.getExternalModule("commons-cli").getClasspath();
        }
        if (name.equals("ANT")) {
            ClassPath classpath = new DefaultClassPath();
            classpath = classpath.plus(moduleRegistry.getExternalModule("ant").getClasspath());
            classpath = classpath.plus(moduleRegistry.getExternalModule("ant-launcher").getClasspath());
            return classpath;
        }
        if (name.equals("GROOVY")) {
            return moduleRegistry.getExternalModule("groovy-all").getClasspath();
        }
View Full Code Here


    }

    public ClassPath findClassPath(String name) {
        if (name.equals("WORKER_PROCESS")) {
            // TODO - split out a logging project and use its classpath, instead of hardcoding logging dependencies here
            ClassPath classpath = new DefaultClassPath();
            classpath = classpath.plus(moduleRegistry.getModule("gradle-base-services").getImplementationClasspath());
            classpath = classpath.plus(moduleRegistry.getModule("gradle-core").getImplementationClasspath());
            classpath = classpath.plus(moduleRegistry.getModule("gradle-cli").getImplementationClasspath());
            classpath = classpath.plus(moduleRegistry.getModule("gradle-native").getImplementationClasspath());
            classpath = classpath.plus(moduleRegistry.getModule("gradle-messaging").getImplementationClasspath());
            classpath = classpath.plus(moduleRegistry.getExternalModule("slf4j-api").getClasspath());
            classpath = classpath.plus(moduleRegistry.getExternalModule("logback-classic").getClasspath());
            classpath = classpath.plus(moduleRegistry.getExternalModule("logback-core").getClasspath());
            classpath = classpath.plus(moduleRegistry.getExternalModule("jul-to-slf4j").getClasspath());
            classpath = classpath.plus(moduleRegistry.getExternalModule("guava-jdk5").getClasspath());
            return classpath;
        }
        if (name.equals("WORKER_MAIN")) {
            synchronized (lock) {
                if (workerClassPath == null) {
View Full Code Here

        this.classLoaderScope = classLoaderScope;
        this.cacheRepository = cacheRepository;
    }

    public ClassLoaderScope buildAndCreateClassLoader(StartParameter startParameter) {
        ClassPath classpath = createBuildSourceClasspath(startParameter);
        ClassLoaderScope childScope = classLoaderScope.createChild();
        childScope.export(classpath);
        childScope.lock();
        return childScope;
    }
View Full Code Here

    public DefaultClassLoaderRegistry(ClassPathRegistry classPathRegistry, ClassLoaderFactory classLoaderFactory) {
        ClassLoader runtimeClassLoader = getClass().getClassLoader();

        apiOnlyClassLoader = restrictToGradleApi(classLoaderFactory, runtimeClassLoader);

        ClassPath pluginsClassPath = classPathRegistry.getClassPath("GRADLE_EXTENSIONS");
        extensionsClassLoader = new MutableURLClassLoader(runtimeClassLoader, pluginsClassPath);

        this.apiAndPluginsClassLoader = restrictToGradleApi(classLoaderFactory, extensionsClassLoader);
    }
View Full Code Here

    public CachingToolingImplementationLoader(ToolingImplementationLoader loader) {
        this.loader = loader;
    }

    public ConsumerConnection create(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, ConnectionParameters connectionParameters, BuildCancellationToken cancellationToken) {
        ClassPath classpath = distribution.getToolingImplementationClasspath(progressLoggerFactory, connectionParameters.getGradleUserHomeDir(), cancellationToken);

        ConsumerConnection connection = connections.get(classpath);
        if (connection == null) {
            connection = loader.create(distribution, progressLoggerFactory, connectionParameters, cancellationToken);
            connections.put(classpath, connection);
View Full Code Here

            throw new GradleConnectionException(String.format("Could not create an instance of Tooling API implementation using the specified %s.", distribution.getDisplayName()), t);
        }
    }

    private ClassLoader createImplementationClassLoader(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, File userHomeDir, BuildCancellationToken cancellationToken) {
        ClassPath implementationClasspath = distribution.getToolingImplementationClasspath(progressLoggerFactory, userHomeDir, cancellationToken);
        LOGGER.debug("Using tooling provider classpath: {}", implementationClasspath);
        // On IBM JVM 5, ClassLoader.getResources() uses a combination of findResources() and getParent() and traverses the hierarchy rather than just calling getResources()
        // Wrap our real classloader in one that hides the parent.
        // TODO - move this into FilteringClassLoader
        MultiParentClassLoader parentObfuscatingClassLoader = new MultiParentClassLoader(classLoader);
        FilteringClassLoader filteringClassLoader = new FilteringClassLoader(parentObfuscatingClassLoader);
        filteringClassLoader.allowPackage("org.gradle.tooling.internal.protocol");
        return new MutableURLClassLoader(filteringClassLoader, implementationClasspath.getAsURLArray());
    }
View Full Code Here

    }

    private void runNoExit(String mainClassName, String[] args) throws Exception {
        ClassPathRegistry classPathRegistry = new DefaultClassPathRegistry(new DefaultClassPathProvider(new DefaultModuleRegistry()));
        ClassLoaderFactory classLoaderFactory = new DefaultClassLoaderFactory();
        ClassPath antClasspath = classPathRegistry.getClassPath("ANT");
        ClassPath runtimeClasspath = classPathRegistry.getClassPath("GRADLE_RUNTIME");
        ClassLoader antClassLoader = classLoaderFactory.createIsolatedClassLoader(antClasspath);
        ClassLoader runtimeClassLoader = new MutableURLClassLoader(antClassLoader, runtimeClasspath);
        Thread.currentThread().setContextClassLoader(runtimeClassLoader);
        Class<?> mainClass = runtimeClassLoader.loadClass(mainClassName);
        Object entryPoint = mainClass.newInstance();
View Full Code Here

    }

    public ClassPath findClassPath(String name) {
        if (name.equals("GRADLE_EXTENSIONS")) {
            Set<Module> coreModules = moduleRegistry.getModule("gradle-core").getAllRequiredModules();
            ClassPath classpath = new DefaultClassPath();
            for (String moduleName : Arrays.asList("gradle-dependency-management", "gradle-plugin-use")) {
                for (Module module : moduleRegistry.getModule(moduleName).getAllRequiredModules()) {
                    if (!coreModules.contains(module)) {
                        classpath = classpath.plus(module.getClasspath());
                    }
                }
            }
            for (Module pluginModule : pluginModuleRegistry.getPluginModules()) {
                classpath = classpath.plus(pluginModule.getClasspath());
            }
            return classpath;
        }

        return null;
View Full Code Here

        this.pluginModuleRegistry = pluginModuleRegistry;
    }

    public ClassPath findClassPath(String name) {
        if (name.equals(GRADLE_API.name())) {
            ClassPath classpath = new DefaultClassPath();
            for (String moduleName : Arrays.asList("gradle-core", "gradle-dependency-management", "gradle-plugin-use", "gradle-tooling-api")) {
                for (Module module : moduleRegistry.getModule(moduleName).getAllRequiredModules()) {
                    classpath = classpath.plus(module.getClasspath());
                }
            }
            for (Module pluginModule : pluginModuleRegistry.getPluginModules()) {
                classpath = classpath.plus(pluginModule.getClasspath());
            }
            return classpath;
        }
        if (name.equals(LOCAL_GROOVY.name())) {
            return moduleRegistry.getExternalModule("groovy-all").getClasspath();
View Full Code Here

                } else {
                    PluginUseMetaData metaData = response.getResponse();
                    if (metaData.legacy) {
                        handleLegacy(metaData, result);
                    } else {
                        ClassPath classPath = resolvePluginDependencies(metaData);
                        PluginResolution resolution = new ClassPathPluginResolution(pluginRequest.getId(), parentScope, Factories.constant(classPath), pluginInspector);
                        result.found(getDescription(), resolution);
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.gradle.internal.classpath.ClassPath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.