blob: ad4a2520fabdefe69c61222f302f3f476ff39f1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
package ch.fhnw.thga.gradleplugins;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import org.gradle.api.Project;
import org.gradle.api.file.FileCollection;
import org.gradle.api.provider.Provider;
import org.gradle.api.provider.Property;
public final class SharedTaskLogic
{
private SharedTaskLogic() {};
public static final String NEW_LINE = System.lineSeparator();
public static final Provider<FileCollection> setupClasspath(
Project project,
Property<String> dependencies,
Object... paths)
{
return dependencies.map(depsClasspath ->
{
return depsClasspath.isEmpty() ? project.files(paths)
: project.files(depsClasspath, paths);
});
}
public static final String extractClassNameFromFregeModuleName(String moduleName)
{
return moduleName.substring(moduleName.lastIndexOf(".") + 1);
}
private static void writeFile(
File destination,
String content,
boolean append)
throws IOException
{
try (BufferedWriter output = new BufferedWriter(new FileWriter(destination, append)))
{
output.write(content);
}
}
static File writeToFile(File destination, String content) throws IOException
{
writeFile(destination, content, false);
return destination;
}
}
|