gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under the git version control system import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
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.*;
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;
public class m2compile extends Task {
private String module="program";
private File dir=null;
- // needs to recognize whether it's linux or not
// needs to check wheter the compilation is needed
// based on the timestamps of the exe and mod
// 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;
// The method executing the task
public void execute() throws BuildException {
int exit = -1;
+ ArrayList<String> list = new ArrayList<String>();
+ if (!Os.isFamily(Os.FAMILY_WINDOWS))
+ list.add("wine");
+ list.add("xc");
+ list.add("=make");
+ list.add("=all");
+ list.add(module);
try{
try{
- ProcessBuilder pb = new ProcessBuilder(
- "wine", "xc", "=make", "=all", module);
+ ProcessBuilder pb = new ProcessBuilder(list);
pb.directory(dir);
pb.inheritIO();
pb.directory(dir);
pb.inheritIO();