commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r829866 - in /commons/sandbox/runtime/trunk/src/main/native: ./ build/org/apache/commons/runtime/
Date Mon, 26 Oct 2009 17:28:28 GMT
Author: mturk
Date: Mon Oct 26 17:28:27 2009
New Revision: 829866

URL: http://svn.apache.org/viewvc?rev=829866&view=rev
Log:
Make variable as condition

Modified:
    commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalExecTask.java
    commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalSequence.java
    commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalTask.java
    commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/VolatileProperty.java
    commons/sandbox/runtime/trunk/src/main/native/configure.xml

Modified: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalExecTask.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalExecTask.java?rev=829866&r1=829865&r2=829866&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalExecTask.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalExecTask.java
Mon Oct 26 17:28:27 2009
@@ -75,6 +75,11 @@
         conditions.addElement(cond);
     }
 
+    public void addVariable(VolatileProperty var)
+    {
+        conditions.addElement(var);
+    }
+
     public void execute()
         throws BuildException
     {

Modified: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalSequence.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalSequence.java?rev=829866&r1=829865&r2=829866&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalSequence.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalSequence.java
Mon Oct 26 17:28:27 2009
@@ -85,7 +85,7 @@
                 super.execute();
             else if (or != null) {
                 if (val.equals(or) == ifcheck)
-                    super.execute();                    
+                    super.execute();
             }
         }
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalTask.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalTask.java?rev=829866&r1=829865&r2=829866&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalTask.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalTask.java
Mon Oct 26 17:28:27 2009
@@ -77,6 +77,11 @@
         add(id);
     }
 
+    public void addVariable(VolatileProperty var)
+    {
+        add(var);
+    }
+
     public void execute()
         throws BuildException
     {

Modified: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/VolatileProperty.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/VolatileProperty.java?rev=829866&r1=829865&r2=829866&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/VolatileProperty.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/VolatileProperty.java
Mon Oct 26 17:28:27 2009
@@ -23,18 +23,22 @@
 import org.apache.tools.ant.PropertyHelper;
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.taskdefs.Property;
+import org.apache.tools.ant.taskdefs.condition.Condition;
+import org.apache.tools.ant.taskdefs.condition.ConditionBase;
 
 /**
  */
-public class VolatileProperty extends Property
+public class VolatileProperty extends Property implements Condition
 {
 
     private String  add;
     private boolean del;
+    private String  equ;
     public VolatileProperty()
     {
         super();
         add = null;
+        equ = null;
         del = false;
     }
 
@@ -43,6 +47,11 @@
         add = value;
     }
 
+    public void setEquals(String value)
+    {
+        equ = value;
+    }
+
     public void setUnset(boolean value)
     {
         del = value;
@@ -115,6 +124,19 @@
         prop.execute();
     }
 
+    public boolean eval()
+        throws BuildException
+    {
+        if (equ == null)
+            throw new BuildException("Attribute \"equals\" is required");
+        if (name == null)
+            throw new BuildException("Attribute \"name\" is required");
+        if (equ.equals(getName()))
+            return true;
+        else
+            return false;
+    }
+
     public void execute()
         throws BuildException
     {

Modified: commons/sandbox/runtime/trunk/src/main/native/configure.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure.xml?rev=829866&r1=829865&r2=829866&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure.xml (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure.xml Mon Oct 26 17:28:27 2009
@@ -107,15 +107,15 @@
     </target>
 
     <macrodef name="sizeof">
-        <attribute name="check"/>
-        <attribute name="result" default="config.sizeof.@{check}"/>
+        <attribute name="type"/>
+        <attribute name="result" default="config.sizeof.@{type}"/>
         <sequential>
         <echo file="${src.native}/cc${build.tstamp}.c" append="false">/* Created by
Apache Ant */
 #include &lt;stdio.h&gt;
 #include &lt;stdlib.h&gt;
 #include &lt;sys/types.h&gt;
 #include &lt;wctype.h&gt;
-int main() {printf("%d", (int)sizeof(@{check}));return 0;}
+int main() {printf("%d", (int)sizeof(@{type}));return 0;}
         </echo>
         <cexec dir="${src.native}" executable="cl" output="cc${build.tstamp}.log"
               resultproperty="sizeof.err">
@@ -139,34 +139,34 @@
             </fileset>
         </delete>
         <property name="@{result}" value="0"/>
-        <print format="%1$-45s %2$s" message="Checking for sizeof(@{check}) : ${@{result}}"/>
+        <print format="%1$-45s %2$s" message="Checking for sizeof(@{type}) : ${@{result}}"/>
         </sequential>
     </macrodef>
 
     <macrodef name="have-include">
-        <attribute name="check"/>
-        <attribute name="result" default="config.have.@{check}"/>
+        <attribute name="file"/>
+        <attribute name="result" default="config.have.@{file}"/>
         <sequential>
         <echo file="${src.native}/cc${build.tstamp}.c" append="false">/* Created by
Apache Ant */
 #include &lt;stdio.h&gt;
 #include &lt;stdlib.h&gt;
-#include &lt;@{check}.h&gt;
+#include &lt;@{file}.h&gt;
 int main() {printf("1");return 0;}
     </echo>
         <cexec dir="${src.native}" executable="cl" output="cc${build.tstamp}.log"
               resultproperty="have.err">
             <and>
                 <systemid equals="windows"/>
-                <equals arg1="${cc}" arg2="cl"/>
+                <variable name="${cc}" equals="cl"/>
             </and>
             <arg line="-nologo"/>
             <arg line="cc${build.tstamp}.c /link /out:cc${build.tstamp}.exe"/>
         </cexec>
         <conditional variable="@{result}" value="1" else="0">
-            <equals arg1="${have.err}" arg2="0"/>
+            <variable name="${have.err}" equals="0"/>
         </conditional>
         <conditional variable="have.res" value="ok" else="not found">
-            <equals arg1="${have.err}" arg2="0"/>
+            <variable name="${have.err}" equals="0"/>
         </conditional>
         <delete>
             <fileset dir="${src.native}">
@@ -174,12 +174,12 @@
             </fileset>
         </delete>
         <property name="@{result}" value="0"/>
-        <print format="%1$-45s %2$s" message="Checking for &lt;@{check}.h&gt;
: ${have.res}"/>
+        <print format="%1$-45s %2$s" message="Checking for &lt;@{file}.h&gt; :
${have.res}"/>
         </sequential>
     </macrodef>
 
     <macrodef name="have-library">
-        <attribute name="check"/>
+        <attribute name="file"/>
         <attribute name="result" default="have.lib.@{check}"/>
         <sequential>
         <echo file="${src.native}/cc${build.tstamp}.c" append="false">/* Created by
Apache Ant */
@@ -191,16 +191,16 @@
               resultproperty="have.err">
             <and>
                 <systemid equals="windows"/>
-                <equals arg1="${cc}" arg2="cl"/>
+                <variable name="${cc}" equals="cl"/>
             </and>
             <arg line="-nologo"/>
-            <arg line="cc${build.tstamp}.c /link /out:cc${build.tstamp}.exe @{check}.lib"/>
+            <arg line="cc${build.tstamp}.c /link /out:cc${build.tstamp}.exe @{file}.lib"/>
         </cexec>
         <conditional variable="@{result}" value="1" else="0">
-            <equals arg1="${have.err}" arg2="0"/>
+            <variable name="${have.err}" equals="0"/>
         </conditional>
         <conditional variable="have.res" value="ok" else="not found">
-            <equals arg1="${have.err}" arg2="0"/>
+            <variable name="${have.err}" equals="0"/>
         </conditional>
         <delete>
             <fileset dir="${src.native}">
@@ -208,7 +208,7 @@
             </fileset>
         </delete>
         <property name="@{result}" value="0"/>
-        <print format="%1$-45s %2$s" message="Checking for @{check} library : ${have.res}"/>
+        <print format="%1$-45s %2$s" message="Checking for @{file} library : ${have.res}"/>
         </sequential>
     </macrodef>
 
@@ -262,15 +262,15 @@
             </and>
         </conditional>
         <echo message="check1 = ${check1}"/>
-        <sizeof check="int"/>
-        <sizeof check="long long" result="config.sizeof.longlong"/>
+        <sizeof type="int"/>
+        <sizeof type="long long" result="config.sizeof.longlong"/>
         <sequence ifnot="systemid.os" equals="windows">
             <have-include check="unistd"/>
         </sequence>
         <sequence if="systemid.os" equals="windows">
-            <have-include check="windows"/>
-            <have-library check="bufferoverflow"/>
-            <have-library check="ktmw32"/>            
+            <have-include file="windows"/>
+            <have-library file="bufferoverflow"/>
+            <have-library file="ktmw32"/>
         </sequence>
         <print format="#define HAVE_UNISTD_H    %1s" message="${config.have.unistd}"/>
         <print format="#define HAVE_WINDOWS_H   %1s" message="${config.have.windows}"/>



Mime
View raw message