Access ProgressLoggerFactory through the public API

Hi folks!

I’m the author of the gradle-download-task (https://github.com/michel-kraemer/gradle-download-task/). This plugin is able to display progress while downloading files. For this I’m using the public class ‘ProgressLoggerFactory’. At the moment I get an instance of this class through the following code (Java):

ProjectInternal pi = (ProjectInternal)project;

ProgressLoggerFactory plf = pi.getServices().get(ProgressLoggerFactory.class);

progressLogger = plf.newOperation(getClass());

String desc = "Download " + src.toString();

progressLogger.setDescription(desc);

progressLogger.setLoggingHeader(desc);

I know that using the internal API is not a good idea. The plugin has compatibility issues almost every time a new gradle version is released. I’m referring to this issue: https://github.com/michel-kraemer/gradle-download-task/issues/3

Is it possible to access ProgressLoggerFactory without using the internal API? Or do you have another idea how to get a new ProgressLogger?

Thanks for your help! Michel

2 Likes