if (type == InternalBuildEnvironment.class) {
//we don't really need to launch the daemon to acquire information needed for BuildEnvironment
if (tasks != null) {
throw new IllegalArgumentException("Cannot run tasks and fetch the build environment model.");
}
return new DefaultBuildEnvironment(
GradleVersion.current().getVersion(),
params.daemonParams.getEffectiveJavaHome(),
params.daemonParams.getEffectiveJvmArgs());
}