use of org.gradle.StartParameter in project gradle by gradle.
the class BuildOutcomeReportingBuildActionRunner method run.
@Override
public Result run(BuildAction action, BuildTreeLifecycleController buildController) {
StartParameter startParameter = action.getStartParameter();
TaskExecutionStatisticsEventAdapter taskStatisticsCollector = new TaskExecutionStatisticsEventAdapter();
listenerManager.addListener(taskStatisticsCollector);
BuildLogger buildLogger = buildLoggerFactory.create(Logging.getLogger(BuildLogger.class), startParameter, buildStartedTime, buildRequestMetaData);
// Register as a 'logger' to support this being replaced by build logic.
buildController.beforeBuild(gradle -> gradle.useLogger(buildLogger));
Result result = delegate.run(action, buildController);
buildLogger.logResult(result.getBuildFailure());
new TaskExecutionStatisticsReporter(styledTextOutputFactory).buildFinished(taskStatisticsCollector.getStatistics());
return result;
}
use of org.gradle.StartParameter in project gradle by gradle.
the class DefaultBuildLifecycleControllerFactory method newInstance.
@Override
public BuildLifecycleController newInstance(BuildDefinition buildDefinition, BuildScopeServices buildScopeServices) {
StartParameter startParameter = buildDefinition.getStartParameter();
final ListenerManager listenerManager = buildScopeServices.get(ListenerManager.class);
for (Action<ListenerManager> action : buildScopeServices.getAll(BuildScopeListenerManagerAction.class)) {
action.execute(listenerManager);
}
ScriptUsageLocationReporter usageLocationReporter = new ScriptUsageLocationReporter();
listenerManager.addListener(usageLocationReporter);
ShowStacktrace showStacktrace = startParameter.getShowStacktrace();
switch(showStacktrace) {
case ALWAYS:
case ALWAYS_FULL:
LoggingDeprecatedFeatureHandler.setTraceLoggingEnabled(true);
break;
default:
LoggingDeprecatedFeatureHandler.setTraceLoggingEnabled(false);
}
DeprecationLogger.init(usageLocationReporter, startParameter.getWarningMode(), buildScopeServices.get(BuildOperationProgressEventEmitter.class));
@SuppressWarnings("deprecation") File customSettingsFile = startParameter.getSettingsFile();
if (customSettingsFile != null) {
DeprecationLogger.deprecateAction("Specifying custom settings file location").willBeRemovedInGradle8().withUpgradeGuideSection(7, "configuring_custom_build_layout").nagUser();
}
@SuppressWarnings("deprecation") File customBuildFile = startParameter.getBuildFile();
if (customBuildFile != null) {
DeprecationLogger.deprecateAction("Specifying custom build file location").willBeRemovedInGradle8().withUpgradeGuideSection(7, "configuring_custom_build_layout").nagUser();
}
GradleInternal gradle = buildScopeServices.get(GradleInternal.class);
BuildModelController buildModelController = buildScopeServices.get(BuildModelController.class);
return new DefaultBuildLifecycleController(gradle, buildModelController, exceptionAnalyser, gradle.getBuildListenerBroadcaster(), listenerManager.getBroadcaster(InternalBuildFinishedListener.class), gradle.getServices().get(BuildWorkPreparer.class), gradle.getServices().get(BuildWorkExecutor.class), buildScopeServices, buildToolingModelControllerFactory, stateTransitionControllerFactory);
}
use of org.gradle.StartParameter in project gradle by gradle.
the class BuildLogger method beforeSettings.
// StartParameter.getSettingsFile() and StartParameter.getBuildFile()
@SuppressWarnings("deprecation")
@Override
public void beforeSettings(Settings settings) {
StartParameter startParameter = settings.getStartParameter();
logger.info("Starting Build");
if (logger.isDebugEnabled()) {
logger.debug("Gradle user home: {}", startParameter.getGradleUserHomeDir());
logger.debug("Current dir: {}", startParameter.getCurrentDir());
logger.debug("Settings file: {}", startParameter.getSettingsFile());
logger.debug("Build file: {}", startParameter.getBuildFile());
}
}
use of org.gradle.StartParameter in project gradle by gradle.
the class GradleEnterprisePluginManager method registerMissingPluginWarning.
/**
* This should never happen due to the auto apply behavior.
* It's only here as a kind of safeguard or fallback.
*/
public void registerMissingPluginWarning(GradleInternal gradle) {
if (gradle.isRootBuild()) {
StartParameter startParameter = gradle.getStartParameter();
boolean requested = !startParameter.isNoBuildScan() && startParameter.isBuildScan();
if (requested) {
gradle.addListener(new InternalBuildAdapter() {
@Override
public void settingsEvaluated(@Nonnull Settings settings) {
if (!isPresent() && !unsupported) {
LOGGER.warn(NO_SCAN_PLUGIN_MSG);
}
}
});
}
}
}
use of org.gradle.StartParameter in project gradle by gradle.
the class DefaultSettingsLoader method findAndLoadSettings.
@Override
public SettingsInternal findAndLoadSettings(GradleInternal gradle) {
StartParameter startParameter = gradle.getStartParameter();
SettingsLocation settingsLocation = buildLayoutFactory.getLayoutFor(new BuildLayoutConfiguration(startParameter));
SettingsInternal settings = findSettingsAndLoadIfAppropriate(gradle, startParameter, settingsLocation, gradle.getClassLoaderScope());
ProjectSpec spec = ProjectSpecs.forStartParameter(startParameter, settings);
if (useEmptySettings(spec, settings, startParameter)) {
settings = createEmptySettings(gradle, startParameter, settings.getClassLoaderScope());
}
setDefaultProject(spec, settings);
return settings;
}
Aggregations