From: Doni Pracner Date: Thu, 13 Mar 2014 19:18:33 +0000 (+0100) Subject: m2compile - now uses Ant OS to detect wheter 'wine' is need or not X-Git-Url: https://svarog.pmf.uns.ac.rs/gitweb/?a=commitdiff_plain;h=565ed407b1f892a9a755b77ce46bcb81b3975f59;p=pub%2Fdonny%2Fant-tasks.git m2compile - now uses Ant OS to detect wheter 'wine' is need or not --- diff --git a/com/quemaster/ant/m2/m2compile.java b/com/quemaster/ant/m2/m2compile.java index 6d43534..5ba7a9e 100644 --- a/com/quemaster/ant/m2/m2compile.java +++ b/com/quemaster/ant/m2/m2compile.java @@ -2,6 +2,8 @@ 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.*; @@ -10,7 +12,6 @@ public class m2compile extends Task { 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 @@ -18,9 +19,15 @@ public class m2compile extends Task { // 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( - "wine", "xc", "=make", "=all", module); + ProcessBuilder pb = new ProcessBuilder(list); pb.directory(dir); pb.inheritIO();