// Currently need to force everything to be configured
gradle.getServices().get(ProjectConfigurer.class).configureHierarchy(gradle.getRootProject());
}
ToolingModelBuilderRegistry builderRegistry = getToolingModelBuilderRegistry(gradle);
ToolingModelBuilder builder;
try {
builder = builderRegistry.getBuilder(modelName);
} catch (UnknownModelException e) {
throw (InternalUnsupportedModelException)new InternalUnsupportedModelException().initCause(e);
}
Object result;
if (builder instanceof ProjectSensitiveToolingModelBuilder) {
result = ((ProjectSensitiveToolingModelBuilder) builder).buildAll(modelName, gradle.getDefaultProject(), true);
} else {
result = builder.buildAll(modelName, gradle.getDefaultProject());
}
PayloadSerializer payloadSerializer = gradle.getServices().get(PayloadSerializer.class);
return new BuildActionResult(payloadSerializer.serialize(result), null);
}