Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 20456

Get up-to-date status of a task in java

$
0
0

Since no one could give me an answer, I finally figured it out by myself.
In case anyone else needs this, here’s my solution, just add this Listener to your BuildLauncher:

    class Listener implements ProgressListener{
	String task;
	String current;
	
	@Override
	public void statusChanged(ProgressEvent event) {
		if(event instanceof TaskProgressEvent) {
			if(event instanceof TaskFinishEvent) {
				System.out.print("Name: " + event.getDescriptor().toString().replace("Task :", ""));
				TaskFinishEvent taskFinishEvent = (TaskFinishEvent) event;
				TaskOperationResult result = taskFinishEvent.getResult();
				if(result instanceof TaskSuccessResult) {
					System.out.println("  up-tp-date :" + ((TaskSuccessResult)result).isUpToDate());
				}
			}
		}
	}

Viewing all articles
Browse latest Browse all 20456

Latest Images

Trending Articles



Latest Images