in grails-forge-core/src/main/java/org/grails/forge/application/ContextFactory.java [47:75]
public FeatureContext createFeatureContext(AvailableFeatures availableFeatures,
List<String> selectedFeatures,
ApplicationType applicationType,
Options options,
@Nullable OperatingSystem operatingSystem) {
final Set<Feature> features = Collections.newSetFromMap(new IdentityHashMap<>(8));
for (String name: selectedFeatures) {
Feature feature = availableFeatures.findFeature(name).orElse(null);
if (feature != null) {
features.add(feature);
} else {
throw new IllegalArgumentException("The requested feature does not exist: " + name);
}
}
Options newOptions = options
.withTestFramework(determineTestFramework(options.getTestFramework()))
.withGormImpl(determineGormImpl(options.getGormImpl()))
.withServletImpl(determineServletImpl(options.getServletImpl()));
availableFeatures.getAllFeatures()
.filter(f -> f instanceof DefaultFeature)
.filter(f -> ((DefaultFeature) f).shouldApply(applicationType, newOptions, features))
.forEach(features::add);
featureValidator.validatePreProcessing(newOptions, applicationType, features);
return new FeatureContext(newOptions, applicationType, operatingSystem, features);
}