X-Git-Url: http://svarog.pmf.uns.ac.rs/gitweb/?p=pub%2Fdonny%2Fant-tasks.git;a=blobdiff_plain;f=com%2Fquemaster%2Fant%2Fm2%2Fm2compile.java;fp=com%2Fquemaster%2Fant%2Fm2%2Fm2compile.java;h=0000000000000000000000000000000000000000;hp=32063347736790321a0a596197bc1390413c147d;hb=0418bf052a76f925d47f401b6052ea40c191b62c;hpb=152d518806464dc94cb27fee2ae4bcf23edbe424 diff --git a/com/quemaster/ant/m2/m2compile.java b/com/quemaster/ant/m2/m2compile.java deleted file mode 100644 index 3206334..0000000 --- a/com/quemaster/ant/m2/m2compile.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.quemaster.ant.m2; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.condition.Os; -import java.util.ArrayList; - -import java.io.*; - -/** - m2compile is an Ant Task that executes a Modula 2 compiler on the give - module in the given dir. Currently it just assumes that the Native - XDS Modula 2 compiler "xc" is in the PATH, and if the OS is not - in the Windows family uses "wine" to execute it. - */ -public class m2compile extends Task { - private String module="program"; - private File dir=null; - - - - // needs to check wheter the compilation is needed - // based on the timestamps of the exe and mod - - // The method executing the task - public void execute() throws BuildException { - int exit = -1; - ArrayList list = new ArrayList(); - if (!Os.isFamily(Os.FAMILY_WINDOWS)) - list.add("wine"); - list.add("xc"); - list.add("=make"); - list.add("=all"); - list.add(module); - try{ - ProcessBuilder pb = new ProcessBuilder(list); - pb.directory(dir); - pb.inheritIO(); - - Process p = pb.start(); - p.waitFor(); - exit = p.exitValue(); - - }catch (Exception ex) { - throw new BuildException(ex); - } - if (exit != 0) - throw new BuildException("compilation ended with code "+exit); - } - - public void setModule(String msg) { - this.module = msg; - } - - public void setDir(File msg) { - this.dir = msg; - } - - public static void main(String[] args){ - m2compile m = new m2compile(); - - m.execute(); - } -}