use of org.gradle.internal.classpath.ClassPath in project gradle by gradle.
the class DefaultToolingImplementationLoader method createImplementationClassLoader.
private ClassLoader createImplementationClassLoader(Distribution distribution, ProgressLoggerFactory progressLoggerFactory, InternalBuildProgressListener progressListener, ConnectionParameters connectionParameters, BuildCancellationToken cancellationToken) {
ClassPath implementationClasspath = distribution.getToolingImplementationClasspath(progressLoggerFactory, progressListener, connectionParameters, cancellationToken);
LOGGER.debug("Using tooling provider classpath: {}", implementationClasspath);
FilteringClassLoader.Spec filterSpec = new FilteringClassLoader.Spec();
filterSpec.allowPackage("org.gradle.tooling.internal.protocol");
filterSpec.allowClass(JavaVersion.class);
FilteringClassLoader filteringClassLoader = new FilteringClassLoader(classLoader, filterSpec);
return new VisitableURLClassLoader("tooling-implementation-loader", filteringClassLoader, implementationClasspath);
}
use of org.gradle.internal.classpath.ClassPath in project gradle by gradle.
the class WorkerProcessClassPathProvider method findClassPath.
@Override
public ClassPath findClassPath(String name) {
if (name.equals("WORKER_MAIN")) {
synchronized (lock) {
if (workerClassPath == null) {
PersistentCache workerClassPathCache = cacheRepository.cache("workerMain").withLockOptions(LockOptionsBuilder.mode(FileLockManager.LockMode.Exclusive)).withInitializer(new CacheInitializer()).open();
try {
workerClassPath = DefaultClassPath.of(jarFile(workerClassPathCache));
} finally {
workerClassPathCache.close();
}
}
LOGGER.debug("Using worker process classpath: {}", workerClassPath);
return workerClassPath;
}
}
// Gradle core plus worker implementation classes
if (name.equals("CORE_WORKER_RUNTIME")) {
ClassPath classpath = ClassPath.EMPTY;
classpath = classpath.plus(moduleRegistry.getModule("gradle-core").getAllRequiredModulesClasspath());
// If a real Gradle installation is used, the following modules will be force-loaded anyway by gradle-core through the getClassPath("GRADLE_EXTENSIONS") call in the DefaultClassLoaderRegistry constructor
// See also: DynamicModulesClassPathProvider.GRADLE_EXTENSION_MODULES
classpath = classpath.plus(moduleRegistry.getModule("gradle-dependency-management").getAllRequiredModulesClasspath());
classpath = classpath.plus(moduleRegistry.getModule("gradle-plugin-use").getAllRequiredModulesClasspath());
classpath = classpath.plus(moduleRegistry.getModule("gradle-workers").getAllRequiredModulesClasspath());
return classpath;
}
// Just the minimal stuff necessary for the worker infrastructure
if (name.equals("MINIMUM_WORKER_RUNTIME")) {
ClassPath classpath = ClassPath.EMPTY;
for (String module : RUNTIME_MODULES) {
classpath = classpath.plus(moduleRegistry.getModule(module).getImplementationClasspath());
}
for (String externalModule : RUNTIME_EXTERNAL_MODULES) {
classpath = classpath.plus(moduleRegistry.getExternalModule(externalModule).getImplementationClasspath());
}
classpath = optimizeForClassloading(classpath);
return classpath;
}
return null;
}
use of org.gradle.internal.classpath.ClassPath in project gradle by gradle.
the class WorkerProcessClassPathProvider method optimizeForClassloading.
private static ClassPath optimizeForClassloading(ClassPath classpath) {
ClassPath optimizedForLoading = ClassPath.EMPTY;
List<File> optimizedFiles = Lists.newArrayListWithCapacity(WORKER_OPTIMIZED_LOADING_ORDER.length);
List<File> remainder = Lists.newArrayList(classpath.getAsFiles());
for (String module : WORKER_OPTIMIZED_LOADING_ORDER) {
Iterator<File> asFiles = remainder.iterator();
while (asFiles.hasNext()) {
File file = asFiles.next();
if (file.getName().startsWith(module)) {
optimizedFiles.add(file);
asFiles.remove();
}
}
if (remainder.isEmpty()) {
break;
}
}
classpath = optimizedForLoading.plus(optimizedFiles).plus(remainder);
return classpath;
}
use of org.gradle.internal.classpath.ClassPath in project gradle by gradle.
the class DefaultDependenciesAccessors method executeWork.
private void executeWork(UnitOfWork work) {
ExecutionEngine.Result result = engine.createRequest(work).execute();
ExecutionResult er = result.getExecutionResult().get();
GeneratedAccessors accessors = (GeneratedAccessors) er.getOutput();
ClassPath generatedClasses = DefaultClassPath.of(accessors.classesDir);
sources = sources.plus(DefaultClassPath.of(accessors.sourcesDir));
classes = classes.plus(generatedClasses);
classLoaderScope.export(generatedClasses);
}
use of org.gradle.internal.classpath.ClassPath in project gradle by gradle.
the class DependencyClassPathProvider method localGroovy.
private ClassPath localGroovy() {
Set<String> groovyModules = ImmutableSet.of("groovy-ant", "groovy-astbuilder", "groovy-console", "groovy-datetime", "groovy-dateutil", "groovy-groovydoc", "groovy-json", "groovy-nio", "groovy-sql", "groovy-templates", "groovy-test", "groovy-xml", "javaparser-core");
ClassPath groovy = moduleRegistry.getExternalModule("groovy").getClasspath();
for (String groovyModule : groovyModules) {
groovy = groovy.plus(moduleRegistry.getExternalModule(groovyModule).getClasspath());
}
return groovy;
}
Aggregations