use of org.gradle.initialization.DependenciesAccessors in project gradle by gradle.
the class BuildTreePreparingProjectsPreparer method generateDependenciesAccessorsAndAssignPluginVersions.
private void generateDependenciesAccessorsAndAssignPluginVersions(ServiceRegistry services, SettingsInternal settings, ClassLoaderScope classLoaderScope) {
DependenciesAccessors accessors = services.get(DependenciesAccessors.class);
DependencyResolutionManagementInternal dm = services.get(DependencyResolutionManagementInternal.class);
dm.getDefaultLibrariesExtensionName().finalizeValue();
String defaultLibrary = dm.getDefaultLibrariesExtensionName().get();
File dependenciesFile = new File(settings.getSettingsDir(), "gradle/libs.versions.toml");
if (dependenciesFile.exists()) {
dm.versionCatalogs(catalogs -> {
VersionCatalogBuilder builder = catalogs.findByName(defaultLibrary);
if (builder == null) {
builder = catalogs.create(defaultLibrary);
}
builder.from(services.get(FileCollectionFactory.class).fixed(dependenciesFile));
});
}
accessors.generateAccessors(dm.getDependenciesModelBuilders(), classLoaderScope, settings);
}
Aggregations