-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathGlobMatchingTask.java
More file actions
68 lines (57 loc) · 1.77 KB
/
GlobMatchingTask.java
File metadata and controls
68 lines (57 loc) · 1.77 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package org.python.util;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.Path;
public abstract class GlobMatchingTask extends MatchingTask {
protected Path src;
protected File destDir;
protected Set<File> toExpose = new HashSet<>();
/**
* Set the source directories to find the class files to be exposed.
*/
public void setSrcdir(Path srcDir) {
if (src == null) {
src = srcDir;
} else {
src.append(srcDir);
}
}
/**
* Gets the source dirs to find the class files to be exposed.
*/
public Path getSrcdir() {
return src;
}
/**
* Set the destination directory into which the Java source files should be compiled.
*
* @param destDir
* the destination director
*/
public void setDestdir(File destDir) {
this.destDir = destDir;
}
/**
* Gets the destination directory into which the java source files should be compiled.
*
* @return the destination directory
*/
public File getDestdir() {
return destDir;
}
/**
* Check that all required attributes have been set and nothing silly has been entered.
*/
protected void checkParameters() throws BuildException {
if (src == null || src.size() == 0) {
throw new BuildException("srcdir attribute must be set!", getLocation());
}
if (destDir != null && !destDir.isDirectory()) {
throw new BuildException("destination directory '" + destDir + "' does not exist "
+ "or is not a directory", getLocation());
}
}
}