gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
m2compile and next task
[pub/donny/ant-tasks.git] / m2compile.java
1 package svetovid;
3 import org.apache.tools.ant.BuildException;
4 import org.apache.tools.ant.Task;
6 import java.io.*;
8 public class m2compile extends Task {
9 private String module="program";
10 private File dir=null;
13 // needs to recognize whether it's linux or not
15 // needs to check wheter the compilation is needed
16 // based on the timestamps of the exe and mod
18 // The method executing the task
19 public void execute() throws BuildException {
20 int exit = -1;
21 try{
22 ProcessBuilder pb = new ProcessBuilder(
23 "wine", "xc", "=make", "=all", module);
24 pb.directory(dir);
25 pb.inheritIO();
27 Process p = pb.start();
28 p.waitFor();
29 exit = p.exitValue();
31 }catch (Exception ex) {
32 throw new BuildException(ex);
33 }
34 if (exit != 0)
35 throw new BuildException("compilation ended with code "+exit);
36 }
38 public void setModule(String msg) {
39 this.module = msg;
40 }
42 public void setDir(File msg) {
43 this.dir = msg;
44 }
46 public static void main(String[] args){
47 m2compile m = new m2compile();
49 m.execute();
50 }
51 }
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner