Package org.gradle.internal.classpath

Examples of org.gradle.internal.classpath.DefaultClassPath


        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


        private final Set<Module> modules;
        private final ClassPath classpath;

        public DefaultModule(String name, Set<File> implementationClasspath, Set<File> runtimeClasspath, Set<Module> modules) {
            this.name = name;
            this.implementationClasspath = new DefaultClassPath(implementationClasspath);
            this.runtimeClasspath = new DefaultClassPath(runtimeClasspath);
            this.modules = modules;
            Set<File> classpath = new LinkedHashSet<File>();
            classpath.addAll(implementationClasspath);
            classpath.addAll(runtimeClasspath);
            this.classpath = new DefaultClassPath(classpath);
        }
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) {
                    workerClassPathCache = cacheRepository
                            .cache("workerMain")
                            .withInitializer(new CacheInitializer())
                            .open();
                    workerClassPath = new DefaultClassPath(jarFile(workerClassPathCache));
                }
                LOGGER.debug("Using worker process classpath: {}", workerClassPath);
                return workerClassPath;
            }
        }
View Full Code Here

        try {
            markerFile.createNewFile();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
        return new DefaultClassPath(classpath);
    }
View Full Code Here

        assert startParameter.getCurrentDir() != null && startParameter.getBuildFile() == null;

        LOGGER.debug("Starting to build the build sources.");
        if (!startParameter.getCurrentDir().isDirectory()) {
            LOGGER.debug("Gradle source dir does not exist. We leave.");
            return new DefaultClassPath();
        }
        LOGGER.info("================================================" + " Start building buildSrc");

        // If we were not the most recent version of Gradle to build the buildSrc dir, then do a clean build
        // Otherwise, just to a regular build
View Full Code Here

        if (new File(scriptCacheDir, EMPTY_SCRIPT_MARKER_FILE_NAME).isFile()) {
            return emptyScriptGenerator.generate(scriptBaseClass);
        }

        try {
            ClassLoader loader = this.classLoaderCache.get(classLoader, new DefaultClassPath(scriptCacheDir), null);
            return loader.loadClass(source.getClassName()).asSubclass(scriptBaseClass);
        } catch (Exception e) {
            File expectedClassFile = new File(scriptCacheDir, source.getClassName() + ".class");
            if (!expectedClassFile.exists()) {
                throw new GradleException(String.format("Could not load compiled classes for %s from cache. Expected class file %s does not exist.", source.getDisplayName(), expectedClassFile.getAbsolutePath()), e);
View Full Code Here

            for (File file : libDir.listFiles()) {
                if (file.getName().endsWith(".jar")) {
                    files.add(file);
                }
            }
            return new DefaultClassPath(files);
        }
View Full Code Here

    public void initializeJdkTools() {
        // Add in tools.jar to the systemClassloader parent
        File toolsJar = Jvm.current().getToolsJar();
        if (toolsJar != null) {
            final ClassLoader systemClassLoaderParent = ClassLoader.getSystemClassLoader().getParent();
            ClasspathUtil.addUrl((URLClassLoader) systemClassLoaderParent, new DefaultClassPath(toolsJar).getAsURLs());
        }
    }
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

TOP

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

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.