org.gradle.api.logging.Logging Java Examples

The following examples show how to use org.gradle.api.logging.Logging. 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: AntLoggingAdapter.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
Example #2
Source File: BaseVariantData.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
public BaseVariantData(
        @NonNull AndroidConfig androidConfig,
        @NonNull TaskManager taskManager,
        @NonNull GradleVariantConfiguration variantConfiguration) {
    this.androidConfig = androidConfig;
    this.variantConfiguration = variantConfiguration;
    this.taskManager = taskManager;

    // eventually, this will require a more open ended comparison.
    mSplitHandlingPolicy =
            androidConfig.getGeneratePureSplits()
                    && variantConfiguration.getMinSdkVersion().getApiLevel() >= 21
                    ? SplitHandlingPolicy.RELEASE_21_AND_AFTER_POLICY
                    : SplitHandlingPolicy.PRE_21_POLICY;

    // warn the user in case we are forced to ignore the generatePureSplits flag.
    if (androidConfig.getGeneratePureSplits()
            && mSplitHandlingPolicy != SplitHandlingPolicy.RELEASE_21_AND_AFTER_POLICY) {
        Logging.getLogger(BaseVariantData.class).warn(
                String.format("Variant %s, MinSdkVersion %s is too low (<21) "
                                + "to support pure splits, reverting to full APKs",
                        variantConfiguration.getFullName(),
                        variantConfiguration.getMinSdkVersion().getApiLevel()));
    }
    scope = new VariantScope(taskManager.getGlobalScope(), this);
}
 
Example #3
Source File: WebAppUtils.java    From azure-gradle-plugins with MIT License 6 votes vote down vote up
public static DockerImageType getDockerImageTypeFromName(final AppService appService) {
    if (appService == null || StringUtils.isEmpty(appService.getImageName())) {
        return DockerImageType.NONE;
    }
    final boolean isCustomRegistry = isNotEmpty(appService.getRegistryUrl());
    final boolean isPrivate = isNotEmpty(appService.getServerId());

    Logging.getLogger(WebAppUtils.class)
            .quiet("ServerId: " + appService.getServerId() + " : " + System.getenv("SERVER_ID"));

    if (isCustomRegistry) {
        return isPrivate ? DockerImageType.PRIVATE_REGISTRY : DockerImageType.UNKNOWN;
    } else {
        return isPrivate ? DockerImageType.PRIVATE_DOCKER_HUB : DockerImageType.PUBLIC_DOCKER_HUB;
    }
}
 
Example #4
Source File: AtlasExtension.java    From atlas with Apache License 2.0 6 votes vote down vote up
public AtlasExtension(@NonNull final ProjectInternal project,
                      @NonNull Instantiator instantiator,
                      @NonNull NamedDomainObjectContainer<T> buildTypes,
                      @NonNull NamedDomainObjectContainer<PatchConfig> patchConfigs,
                      @NonNull NamedDomainObjectContainer<DexConfig> dexConfigs) {

    logger = Logging.getLogger(this.getClass());
    this.project = project;

    this.patchConfigs = patchConfigs;
    this.dexConfigs = dexConfigs;
    this.buildTypes = buildTypes;
    this.multiDexConfigs = project.container(MultiDexConfig.class, new MultiDexConfigFactory(

        instantiator,project, project.getLogger()));
    this.atlasChannelConfigs = project.container(DefaultChannelConfig.class, new DefaultChannelConfigFactory(instantiator, project, project.getLogger()));
    this.enhanceConfigs = project.container(EnhanceConfig.class, new EnhanceConfigFactory(instantiator, project, project.getLogger()));
    tBuildConfig = (Z) instantiator.newInstance(TBuildConfig.class);
    manifestOptions = instantiator.newInstance(ManifestOptions.class);
    bundleConfig = instantiator.newInstance(BundleConfig.class);
}
 
Example #5
Source File: AntLoggingAdapter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
Example #6
Source File: TaskManager.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
public TaskManager(
        Project project,
        AndroidBuilder androidBuilder,
        AndroidConfig extension,
        SdkHandler sdkHandler,
        DependencyManager dependencyManager,
        ToolingModelBuilderRegistry toolingRegistry) {
    this.project = project;
    this.androidBuilder = androidBuilder;
    this.sdkHandler = sdkHandler;
    this.extension = extension;
    this.toolingRegistry = toolingRegistry;
    this.dependencyManager = dependencyManager;
    logger = Logging.getLogger(this.getClass());

    globalScope = new GlobalScope(
            project,
            androidBuilder,
            checkNotNull((String) project.getProperties().get("archivesBaseName")),
            extension,
            sdkHandler,
            toolingRegistry);
}
 
Example #7
Source File: LogLevelConverter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Maps a Logback log level and optional marker to a Gradle log level.
 * Returns null if there is no equivalent Gradle log level (such as for TRACE).
 */
@Nullable
public static LogLevel toGradleLogLevel(Level level, @Nullable Marker marker) {
    switch(level.toInt()) {
        case Level.TRACE_INT:
            return null;
        case Level.DEBUG_INT:
            return LogLevel.DEBUG;
        case Level.INFO_INT:
            if (marker == Logging.LIFECYCLE) {
                return LogLevel.LIFECYCLE;
            }
            if (marker == Logging.QUIET) {
                return LogLevel.QUIET;
            }
            return LogLevel.INFO;
        case Level.WARN_INT:
            return LogLevel.WARN;
        case Level.ERROR_INT:
            return LogLevel.ERROR;
        default:
            throw new IllegalArgumentException("Don't know how to map Logback log level '" + level + "' to a Gradle log level");
    }
}
 
Example #8
Source File: LogLevelConverter.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Maps a Logback log level and optional marker to a Gradle log level.
 * Returns null if there is no equivalent Gradle log level (such as for TRACE).
 */
@Nullable
public static LogLevel toGradleLogLevel(Level level, @Nullable Marker marker) {
    switch(level.toInt()) {
        case Level.TRACE_INT:
            return null;
        case Level.DEBUG_INT:
            return LogLevel.DEBUG;
        case Level.INFO_INT:
            if (marker == Logging.LIFECYCLE) {
                return LogLevel.LIFECYCLE;
            }
            if (marker == Logging.QUIET) {
                return LogLevel.QUIET;
            }
            return LogLevel.INFO;
        case Level.WARN_INT:
            return LogLevel.WARN;
        case Level.ERROR_INT:
            return LogLevel.ERROR;
        default:
            throw new IllegalArgumentException("Don't know how to map Logback log level '" + level + "' to a Gradle log level");
    }
}
 
Example #9
Source File: LogLevelConverter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Maps a Logback log level and optional marker to a Gradle log level.
 * Returns null if there is no equivalent Gradle log level (such as for TRACE).
 */
@Nullable
public static LogLevel toGradleLogLevel(Level level, @Nullable Marker marker) {
    switch(level.toInt()) {
        case Level.TRACE_INT:
            return null;
        case Level.DEBUG_INT:
            return LogLevel.DEBUG;
        case Level.INFO_INT:
            if (marker == Logging.LIFECYCLE) {
                return LogLevel.LIFECYCLE;
            }
            if (marker == Logging.QUIET) {
                return LogLevel.QUIET;
            }
            return LogLevel.INFO;
        case Level.WARN_INT:
            return LogLevel.WARN;
        case Level.ERROR_INT:
            return LogLevel.ERROR;
        default:
            throw new IllegalArgumentException("Don't know how to map Logback log level '" + level + "' to a Gradle log level");
    }
}
 
Example #10
Source File: AntLoggingAdapter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
Example #11
Source File: AntLoggingAdapter.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
Example #12
Source File: LogLevelConverter.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Maps a Logback log level and optional marker to a Gradle log level.
 * Returns null if there is no equivalent Gradle log level (such as for TRACE).
 */
@Nullable
public static LogLevel toGradleLogLevel(Level level, @Nullable Marker marker) {
    switch(level.toInt()) {
        case Level.TRACE_INT:
            return null;
        case Level.DEBUG_INT:
            return LogLevel.DEBUG;
        case Level.INFO_INT:
            if (marker == Logging.LIFECYCLE) {
                return LogLevel.LIFECYCLE;
            }
            if (marker == Logging.QUIET) {
                return LogLevel.QUIET;
            }
            return LogLevel.INFO;
        case Level.WARN_INT:
            return LogLevel.WARN;
        case Level.ERROR_INT:
            return LogLevel.ERROR;
        default:
            throw new IllegalArgumentException("Don't know how to map Logback log level '" + level + "' to a Gradle log level");
    }
}
 
Example #13
Source File: TransformReplacer.java    From atlas with Apache License 2.0 5 votes vote down vote up
public void replaceDataBindingMergeArtifactsTransform() {
    List<TransformTask> list = TransformManager.findTransformTaskByTransformType(variantContext,
            DataBindingMergeArtifactsTransform.class);
    for (TransformTask transformTask : list) {
        File outFolder =
                new File(
                        variantContext.getScope().getBuildFolderForDataBindingCompiler(),
                        DataBindingBuilder.ARTIFACT_FILES_DIR_FROM_LIBS);
        AtlasDataBindingMergeArtifactsTransform dataBindingMergeArtifactsTransform = new AtlasDataBindingMergeArtifactsTransform(variantContext, Logging.getLogger(AtlasDataBindingMergeArtifactsTransform.class), outFolder);
        ReflectUtils.updateField(transformTask, "transform", dataBindingMergeArtifactsTransform);
    }

}
 
Example #14
Source File: AtlasBaseTaskManager.java    From atlas with Apache License 2.0 5 votes vote down vote up
public AtlasBaseTaskManager(AtlasBuilder androidBuilder, T androidExtension, Project project,
                            AtlasExtension atlasExtension) {
    this.tAndroidBuilder = androidBuilder;
    this.androidExtension = androidExtension;
    this.project = project;
    this.tasks = new TaskContainerAdaptor(project.getTasks());
    this.atlasExtension = atlasExtension;
    this.logger = new LoggerWrapper(Logging.getLogger(AtlasBaseTaskManager.class));
    this.extraModelInfo = new ExtraModelInfo(new ProjectOptions(project), Logging.getLogger(AtlasBaseTaskManager.class));

    //this.dependencyManager = new DependencyManager(androidExtension, project, atlasExtension);
}
 
Example #15
Source File: ThinPexGenerator.java    From pygradle with Apache License 2.0 5 votes vote down vote up
public ThinPexGenerator(
    Project project,
    List<String> pexOptions,
    EntryPointTemplateProvider templateProvider,
    Map<String, String> extraProperties) {

    super(project, pexOptions, templateProvider, extraProperties);
    logger = Logging.getLogger(ThinPexGenerator.class);
}
 
Example #16
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
    );
}
 
Example #17
Source File: IvyLoggingAdaper.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void log(String msg, int level) {
    logger.log(Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(level), msg);
}
 
Example #18
Source File: DefaultGradleLauncherFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private DefaultGradleLauncher doNewInstance(StartParameter startParameter, BuildRequestMetaData requestMetaData) {
    final BuildScopeServices serviceRegistry = new BuildScopeServices(sharedServices, startParameter);
    serviceRegistry.add(BuildRequestMetaData.class, requestMetaData);
    serviceRegistry.add(BuildClientMetaData.class, requestMetaData.getClient());
    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(new BuildCleanupListener(serviceRegistry));

    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,
                            serviceRegistry.get(ClassLoaderScope.class),
                            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));
}
 
Example #19
Source File: AbstractGradleExecuter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected AbstractGradleExecuter(GradleDistribution distribution, TestDirectoryProvider testDirectoryProvider) {
    this.distribution = distribution;
    this.testDirectoryProvider = testDirectoryProvider;
    logger = Logging.getLogger(getClass());
}
 
Example #20
Source File: IvyLoggingAdaper.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void log(String msg, int level) {
    logger.log(Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(level), msg);
}
 
Example #21
Source File: AbstractGradleExecuter.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected AbstractGradleExecuter(GradleDistribution distribution, TestDirectoryProvider testDirectoryProvider) {
    this.distribution = distribution;
    this.testDirectoryProvider = testDirectoryProvider;
    logger = Logging.getLogger(getClass());
}
 
Example #22
Source File: AbstractGradleExecuter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected AbstractGradleExecuter(GradleDistribution distribution, TestDirectoryProvider testDirectoryProvider) {
    this.distribution = distribution;
    this.testDirectoryProvider = testDirectoryProvider;
    logger = Logging.getLogger(getClass());
}
 
Example #23
Source File: BaseExtension.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
BaseExtension(
        @NonNull final ProjectInternal project,
        @NonNull Instantiator instantiator,
        @NonNull AndroidBuilder androidBuilder,
        @NonNull SdkHandler sdkHandler,
        @NonNull NamedDomainObjectContainer<BuildType> buildTypes,
        @NonNull NamedDomainObjectContainer<ProductFlavor> productFlavors,
        @NonNull NamedDomainObjectContainer<SigningConfig> signingConfigs,
        @NonNull ExtraModelInfo extraModelInfo,
        final boolean isLibrary) {
    this.androidBuilder = androidBuilder;
    this.sdkHandler = sdkHandler;
    this.buildTypes = buildTypes;
    //noinspection unchecked
    this.productFlavors = (NamedDomainObjectContainer) productFlavors;
    this.signingConfigs = signingConfigs;
    this.extraModelInfo = extraModelInfo;
    this.project = project;

    logger = Logging.getLogger(this.getClass());

    defaultConfig = instantiator.newInstance(ProductFlavor.class, BuilderConstants.MAIN,
            project, instantiator, project.getLogger());

    aaptOptions = instantiator.newInstance(AaptOptions.class);
    dexOptions = instantiator.newInstance(DexOptions.class);
    lintOptions = instantiator.newInstance(LintOptions.class);
    compileOptions = instantiator.newInstance(CompileOptions.class);
    packagingOptions = instantiator.newInstance(PackagingOptions.class);
    preprocessingOptions = instantiator.newInstance(PreprocessingOptions.class);
    splits = instantiator.newInstance(Splits.class, instantiator);

    sourceSetsContainer = project.container(AndroidSourceSet.class,
            new AndroidSourceSetFactory(instantiator, project, isLibrary));

    sourceSetsContainer.whenObjectAdded(new Action<AndroidSourceSet>() {
        @Override
        public void execute(AndroidSourceSet sourceSet) {
            ConfigurationContainer configurations = project.getConfigurations();

            createConfiguration(
                    configurations,
                    sourceSet.getCompileConfigurationName(),
                    "Classpath for compiling the " + sourceSet.getName() + " sources.");

            String packageConfigDescription;
            if (isLibrary) {
                packageConfigDescription
                        = "Classpath only used when publishing '" + sourceSet.getName() + "'.";
            } else {
                packageConfigDescription
                        = "Classpath packaged with the compiled '" + sourceSet.getName() + "' classes.";
            }
            createConfiguration(
                    configurations,
                    sourceSet.getPackageConfigurationName(),
                    packageConfigDescription);

            createConfiguration(
                    configurations,
                    sourceSet.getProvidedConfigurationName(),
                    "Classpath for only compiling the " + sourceSet.getName() + " sources.");

            createConfiguration(
                    configurations,
                    sourceSet.getWearAppConfigurationName(),
                    "Link to a wear app to embed for object '" + sourceSet.getName() + "'.");

            sourceSet.setRoot(String.format("src/%s", sourceSet.getName()));
        }
    });

    sourceSetsContainer.create(defaultConfig.getName());
}
 
Example #24
Source File: DependencyManager.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public DependencyManager(Project project, ExtraModelInfo extraModelInfo) {
    this.project = project;
    this.extraModelInfo = extraModelInfo;
    logger = new LoggerWrapper(Logging.getLogger(DependencyManager.class));
}
 
Example #25
Source File: PerformanceTrackingRewriter.java    From android-perftracking with MIT License 4 votes vote down vote up
public PerformanceTrackingRewriter() {
  _log = Logging.getLogger(PerformanceTrackingRewriter.class.getSimpleName());
}
 
Example #26
Source File: DummyRewriter.java    From android-perftracking with MIT License 4 votes vote down vote up
public DummyRewriter() {
  _log = Logging.getLogger(DummyRewriter.class.getSimpleName());
}
 
Example #27
Source File: DefaultGradleLauncherFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private DefaultGradleLauncher doNewInstance(StartParameter startParameter, BuildRequestMetaData requestMetaData) {
    final BuildScopeServices serviceRegistry = new BuildScopeServices(sharedServices, startParameter);
    serviceRegistry.add(BuildRequestMetaData.class, requestMetaData);
    serviceRegistry.add(BuildClientMetaData.class, requestMetaData.getClient());
    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(new BuildCleanupListener(serviceRegistry));

    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,
                            serviceRegistry.get(ClassLoaderScope.class),
                            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));
}
 
Example #28
Source File: IvyLoggingAdaper.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void log(String msg, int level) {
    logger.log(Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(level), msg);
}
 
Example #29
Source File: AbstractGradleExecuter.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected AbstractGradleExecuter(GradleDistribution distribution, TestDirectoryProvider testDirectoryProvider) {
    this.distribution = distribution;
    this.testDirectoryProvider = testDirectoryProvider;
    logger = Logging.getLogger(getClass());
}
 
Example #30
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
    );
}