Java Code Examples for org.gradle.StartParameter#isProfile()

The following examples show how to use org.gradle.StartParameter#isProfile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GradleParameters.java    From gradle-metrics-plugin with Apache License 2.0 6 votes vote down vote up
public static GradleParameters fromGradle(org.gradle.api.invocation.Gradle gradle) {
    StartParameter start = gradle.getStartParameter();
    List<KeyValue> projectProperties = KeyValue.mapToKeyValueList(start.getProjectProperties());
    return new GradleParameters(start.getTaskRequests(),
            start.getExcludedTaskNames(),
            start.isBuildProjectDependencies(),
            start.getCurrentDir(),
            start.getProjectDir(),
            projectProperties,
            start.getGradleUserHomeDir(),
            start.getSettingsFile(),
            start.getBuildFile(),
            start.getInitScripts(),
            start.isDryRun(),
            start.isRerunTasks(),
            start.isProfile(),
            start.isContinueOnFailure(),
            start.isOffline(),
            start.getProjectCacheDir(),
            start.isRefreshDependencies(),
            start.getMaxWorkerCount(),
            start.isConfigureOnDemand()
    );
}
 
Example 2
Source File: DefaultGradleLauncherFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private DefaultGradleLauncher doNewInstance(StartParameter startParameter, BuildCancellationToken cancellationToken, BuildRequestMetaData requestMetaData) {
    final BuildScopeServices serviceRegistry = new BuildScopeServices(sharedServices, startParameter);
    serviceRegistry.add(BuildRequestMetaData.class, requestMetaData);
    serviceRegistry.add(BuildClientMetaData.class, requestMetaData.getClient());
    serviceRegistry.add(BuildCancellationToken.class, cancellationToken);
    ListenerManager listenerManager = serviceRegistry.get(ListenerManager.class);
    LoggingManagerInternal loggingManager = serviceRegistry.newInstance(LoggingManagerInternal.class);
    loggingManager.setLevel(startParameter.getLogLevel());

    //this hooks up the ListenerManager and LoggingConfigurer so you can call Gradle.addListener() with a StandardOutputListener.
    loggingManager.addStandardOutputListener(listenerManager.getBroadcaster(StandardOutputListener.class));
    loggingManager.addStandardErrorListener(listenerManager.getBroadcaster(StandardOutputListener.class));

    LoggerProvider loggerProvider = (tracker.getCurrentBuild() == null) ? buildProgressLogger : LoggerProvider.NO_OP;
    listenerManager.useLogger(new TaskExecutionLogger(serviceRegistry.get(ProgressLoggerFactory.class), loggerProvider));
    if (tracker.getCurrentBuild() == null) {
        listenerManager.useLogger(new BuildLogger(Logging.getLogger(BuildLogger.class), serviceRegistry.get(StyledTextOutputFactory.class), startParameter, requestMetaData));
    }
    listenerManager.addListener(tracker);

    listenerManager.addListener(serviceRegistry.get(ProfileEventAdapter.class));
    if (startParameter.isProfile()) {
        listenerManager.addListener(new ReportGeneratingProfileListener());
    }
    ScriptUsageLocationReporter usageLocationReporter = new ScriptUsageLocationReporter();
    listenerManager.addListener(usageLocationReporter);
    DeprecationLogger.useLocationReporter(usageLocationReporter);

    GradleInternal gradle = serviceRegistry.get(Instantiator.class).newInstance(DefaultGradle.class, tracker.getCurrentBuild(), startParameter, serviceRegistry.get(ServiceRegistryFactory.class));
    return new DefaultGradleLauncher(
            gradle,
            serviceRegistry.get(InitScriptHandler.class),
            new SettingsHandler(
                    new DefaultSettingsFinder(
                            new BuildLayoutFactory()),
                    serviceRegistry.get(SettingsProcessor.class),
                    new BuildSourceBuilder(
                            this,
                            cancellationToken,
                            serviceRegistry.get(ClassLoaderScopeRegistry.class).getCoreAndPluginsScope(),
                            serviceRegistry.get(CacheRepository.class))
            ),
            serviceRegistry.get(BuildLoader.class),
            serviceRegistry.get(BuildConfigurer.class),
            gradle.getBuildListenerBroadcaster(),
            serviceRegistry.get(ExceptionAnalyser.class),
            loggingManager,
            listenerManager.getBroadcaster(ModelConfigurationListener.class),
            listenerManager.getBroadcaster(TasksCompletionListener.class),
            gradle.getServices().get(BuildExecuter.class),
            listenerManager.getBroadcaster(BuildCompletionListener.class),
            serviceRegistry
    );
}
 
Example 3
Source File: DefaultGradleLauncherFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private DefaultGradleLauncher doNewInstance(StartParameter startParameter, BuildCancellationToken cancellationToken, BuildRequestMetaData requestMetaData) {
    final BuildScopeServices serviceRegistry = new BuildScopeServices(sharedServices, startParameter);
    serviceRegistry.add(BuildRequestMetaData.class, requestMetaData);
    serviceRegistry.add(BuildClientMetaData.class, requestMetaData.getClient());
    serviceRegistry.add(BuildCancellationToken.class, cancellationToken);
    ListenerManager listenerManager = serviceRegistry.get(ListenerManager.class);
    LoggingManagerInternal loggingManager = serviceRegistry.newInstance(LoggingManagerInternal.class);
    loggingManager.setLevel(startParameter.getLogLevel());

    //this hooks up the ListenerManager and LoggingConfigurer so you can call Gradle.addListener() with a StandardOutputListener.
    loggingManager.addStandardOutputListener(listenerManager.getBroadcaster(StandardOutputListener.class));
    loggingManager.addStandardErrorListener(listenerManager.getBroadcaster(StandardOutputListener.class));

    LoggerProvider loggerProvider = (tracker.getCurrentBuild() == null) ? buildProgressLogger : LoggerProvider.NO_OP;
    listenerManager.useLogger(new TaskExecutionLogger(serviceRegistry.get(ProgressLoggerFactory.class), loggerProvider));
    if (tracker.getCurrentBuild() == null) {
        listenerManager.useLogger(new BuildLogger(Logging.getLogger(BuildLogger.class), serviceRegistry.get(StyledTextOutputFactory.class), startParameter, requestMetaData));
    }
    listenerManager.addListener(tracker);

    listenerManager.addListener(serviceRegistry.get(ProfileEventAdapter.class));
    if (startParameter.isProfile()) {
        listenerManager.addListener(new ReportGeneratingProfileListener());
    }
    ScriptUsageLocationReporter usageLocationReporter = new ScriptUsageLocationReporter();
    listenerManager.addListener(usageLocationReporter);
    DeprecationLogger.useLocationReporter(usageLocationReporter);

    GradleInternal gradle = serviceRegistry.get(Instantiator.class).newInstance(DefaultGradle.class, tracker.getCurrentBuild(), startParameter, serviceRegistry.get(ServiceRegistryFactory.class));
    return new DefaultGradleLauncher(
            gradle,
            serviceRegistry.get(InitScriptHandler.class),
            new SettingsHandler(
                    new DefaultSettingsFinder(
                            new BuildLayoutFactory()),
                    serviceRegistry.get(SettingsProcessor.class),
                    new BuildSourceBuilder(
                            this,
                            cancellationToken,
                            serviceRegistry.get(ClassLoaderScopeRegistry.class).getCoreAndPluginsScope(),
                            serviceRegistry.get(CacheRepository.class))
            ),
            serviceRegistry.get(BuildLoader.class),
            serviceRegistry.get(BuildConfigurer.class),
            gradle.getBuildListenerBroadcaster(),
            serviceRegistry.get(ExceptionAnalyser.class),
            loggingManager,
            listenerManager.getBroadcaster(ModelConfigurationListener.class),
            listenerManager.getBroadcaster(TasksCompletionListener.class),
            gradle.getServices().get(BuildExecuter.class),
            listenerManager.getBroadcaster(BuildCompletionListener.class),
            serviceRegistry
    );
}