-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55518e2
commit cea452d
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package sjpp; | ||
|
||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
import org.apache.tools.ant.BuildException; | ||
import org.apache.tools.ant.Task; | ||
|
||
public class SjppAntTask extends Task { | ||
|
||
private String src; | ||
private String dest; | ||
private String define; | ||
|
||
@Override | ||
public void execute() throws BuildException { | ||
this.log("Starting SimpleJava PreProcessor."); | ||
this.log("src: " + src); | ||
this.log("dest: " + dest); | ||
this.log("define: " + define); | ||
|
||
final Path root = Paths.get(src); | ||
|
||
final Context context = new Context(ContextMode.REGULAR, root); | ||
context.addDefine(define); | ||
|
||
final Path out = Paths.get(dest); | ||
try { | ||
context.process(out); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
this.log("Error " + e.toString()); | ||
} | ||
|
||
} | ||
|
||
public final void setSrc(String src) { | ||
this.src = src; | ||
} | ||
|
||
public final void setDest(String dest) { | ||
this.dest = dest; | ||
} | ||
|
||
public final void setDefine(String define) { | ||
this.define = define; | ||
} | ||
|
||
} |