forked from functionaljava/functionaljava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.gradle
More file actions
45 lines (38 loc) · 1.41 KB
/
Copy pathlib.gradle
File metadata and controls
45 lines (38 loc) · 1.41 KB
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
import org.apache.tools.ant.taskdefs.condition.Os
String findCommand(String dir, String command) {
def extension = Os.isFamily(Os.FAMILY_WINDOWS) ? ".exe" : ""
def cmd = "$dir/$command$extension"
if (! new File(cmd).exists()) {
throw new Exception("Command $command not found in dir $dir")
}
cmd
}
String findJavaCommand(String command) {
def jh = System.getenv("JAVA8_HOME")
if (jh == null) {
throw new Exception("Environment variable JAVA8_HOME not set")
}
findCommand("$jh/bin", command)
}
List<String> projectClasses(List<String> list, String base) {
list.collect {
"$base/$it/build/classes/main"
}
}
def createDynamicJavadoc(String module, List<String> paths) {
def taskName = "dynamicJava8Javadoc"
task "$taskName"(type: Exec) {
def cp = projectClasses(paths, "$module/..").join(";")
def c = findJavaCommand("javadoc")
commandLine c, "-sourcepath", "$module/src/main/java", "-d", "$module/build/docs/javadoc", "-subpackages", "fj", "-Xdoclint:none", "-quiet", "-classpath", cp
}
project.tasks[taskName]
}
ext {
createDynamicJavadoc = this.&createDynamicJavadoc
findJavaCommand = this.&findJavaCommand
}
task java8Javadoc(type: Exec) {
def c = findJavaCommand("javadoc")
commandLine c, "-sourcepath", "$projectDir/src/main/java", "-d", "$buildDir/docs/javadoc", "-subpackages", "fj", "-Xdoclint:none", "-quiet"
}