Search in sources :

Example 1 with VersionCatalogBuilderInternal

use of org.gradle.internal.management.VersionCatalogBuilderInternal in project gradle by gradle.

the class DefaultDependenciesAccessors method generateAccessors.

@Override
public void generateAccessors(List<VersionCatalogBuilder> builders, ClassLoaderScope classLoaderScope, Settings settings) {
    try {
        this.classLoaderScope = classLoaderScope;
        // this is used in tests only, shouldn't happen in real context
        this.models.clear();
        for (VersionCatalogBuilder builder : builders) {
            DefaultVersionCatalog model = ((VersionCatalogBuilderInternal) builder).build();
            models.add(model);
        }
        if (models.stream().anyMatch(DefaultVersionCatalog::isNotEmpty)) {
            for (DefaultVersionCatalog model : models) {
                if (model.isNotEmpty()) {
                    writeDependenciesAccessors(model);
                }
            }
        }
        if (featurePreviews.isFeatureEnabled(FeaturePreviews.Feature.TYPESAFE_PROJECT_ACCESSORS)) {
            IncubationLogger.incubatingFeatureUsed("Type-safe project accessors");
            writeProjectAccessors(((SettingsInternal) settings).getProjectRegistry());
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : VersionCatalogBuilder(org.gradle.api.initialization.dsl.VersionCatalogBuilder) VersionCatalogBuilderInternal(org.gradle.internal.management.VersionCatalogBuilderInternal) InvalidUserDataException(org.gradle.api.InvalidUserDataException)

Aggregations

InvalidUserDataException (org.gradle.api.InvalidUserDataException)1 VersionCatalogBuilder (org.gradle.api.initialization.dsl.VersionCatalogBuilder)1 VersionCatalogBuilderInternal (org.gradle.internal.management.VersionCatalogBuilderInternal)1