use of org.gradle.internal.classpath.ClassPath in project gradle by gradle.
the class DefaultScriptHandler method defineConfiguration.
private void defineConfiguration() {
// Defer creation and resolution of configuration until required. Short-circuit when script does not require classpath
if (configContainer == null) {
configContainer = dependencyResolutionServices.getConfigurationContainer();
}
if (dependencyHandler == null) {
dependencyHandler = dependencyResolutionServices.getDependencyHandler();
}
if (classpathConfiguration == null) {
classpathConfiguration = configContainer.create(CLASSPATH_CONFIGURATION);
// should ideally reuse the `JvmEcosystemUtilities` but this code is too low level
// and this service is therefore not available!
AttributeContainer attributes = classpathConfiguration.getAttributes();
attributes.attribute(Usage.USAGE_ATTRIBUTE, instantiator.named(Usage.class, Usage.JAVA_RUNTIME));
attributes.attribute(Category.CATEGORY_ATTRIBUTE, instantiator.named(Category.class, Category.LIBRARY));
attributes.attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, instantiator.named(LibraryElements.class, LibraryElements.JAR));
attributes.attribute(Bundling.BUNDLING_ATTRIBUTE, instantiator.named(Bundling.class, Bundling.EXTERNAL));
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, Integer.parseInt(JavaVersion.current().getMajorVersion()));
attributes.attribute(GradlePluginApiVersion.GRADLE_PLUGIN_API_VERSION_ATTRIBUTE, instantiator.named(GradlePluginApiVersion.class, GradleVersion.current().getVersion()));
classpathConfiguration.getDependencyConstraints().add(dependencyHandler.getConstraints().create(Log4jBannedVersion.LOG4J2_CORE_COORDINATES, constraint -> constraint.version(version -> {
version.require(Log4jBannedVersion.LOG4J2_CORE_REQUIRED_VERSION);
version.reject(Log4jBannedVersion.LOG4J2_CORE_VULNERABLE_VERSION_RANGE);
})));
}
}
use of org.gradle.internal.classpath.ClassPath in project gradle by gradle.
the class BuildTreePreparingProjectsPreparer method buildBuildSrcAndLockClassloader.
private void buildBuildSrcAndLockClassloader(GradleInternal gradle, ClassLoaderScope baseProjectClassLoaderScope) {
ClassPath buildSrcClassPath = buildSourceBuilder.buildAndGetClassPath(gradle);
baseProjectClassLoaderScope.export(buildSrcClassPath).lock();
}
Aggregations