1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc
.squirreljme
.plugin
.util
;
12 import java
.nio
.file
.Path
;
13 import java
.util
.concurrent
.Callable
;
14 import org
.gradle
.api
.Task
;
15 import org
.gradle
.api
.file
.FileCollection
;
18 * This takes the output of a task and provides a {@link Callable} so that
19 * it produces that single file.
23 public class SingleTaskOutputFile
24 implements Callable
<Path
>
26 /** The task to get. */
27 protected final Task task
;
30 * Initializes the utility.
32 * @param __task The task to extract from.
33 * @throws NullPointerException On null arguments.
36 public SingleTaskOutputFile(Task __task
)
37 throws NullPointerException
40 throw new NullPointerException("NARG");
52 FileCollection files
= this.task
.getOutputs().getFiles();
54 if (files
.getFiles().isEmpty())
57 return files
.getSingleFile().toPath();