You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/10/26 17:40:41 UTC

svn commit: r829856 - in /commons/sandbox/runtime/trunk/src/main/native: build/org/apache/commons/runtime/ConditionalSequence.java configure.xml

Author: mturk
Date: Mon Oct 26 16:40:41 2009
New Revision: 829856

URL: http://svn.apache.org/viewvc?rev=829856&view=rev
Log:
Fix sequence task

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

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=829856&r1=829855&r2=829856&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 16:40:41 2009
@@ -31,14 +31,16 @@
 
     private String            property;
     private String            equals;
-    private String            not;
+    private boolean           ifcheck;
+    private String            or;
 
     public ConditionalSequence()
     {
         super();
         property    = null;
         equals      = null;
-        not         = null;
+        or          = null;
+        ifcheck     = true;
     }
 
     public void setIf(String property)
@@ -46,14 +48,20 @@
         this.property = property;
     }
 
+    public void setIfnot(String property)
+    {
+        this.property = property;
+        ifcheck = false;
+    }
+
     public void setEquals(String value)
     {
         equals = value;
     }
 
-    public void setNot(String value)
+    public void setOr(String value)
     {
-        not = value;
+        or = value;
     }
 
     public void execute()
@@ -64,8 +72,6 @@
             cnt++;
         if (equals != null)
             cnt++;
-        if (not != null)
-            cnt++;
         if (cnt == 0) {
             super.execute();
             return;
@@ -73,18 +79,13 @@
         if (cnt == 1) {
             throw new BuildException("Required attribute is missing");
         }
-        if (cnt == 3) {
-            throw new BuildException("Too many attributes declared");
-        }
         String val = getProject().getProperty(property);
         if (val != null) {
-            if (equals != null) {
-                if (val.equals(equals))
-                    super.execute();
-            }
-            else if (not != null) {
-                if (!val.equals(not))
-                    super.execute();
+            if (val.equals(equals) == ifcheck)
+                super.execute();
+            else if (or != null) {
+                if (val.equals(or) == ifcheck)
+                    super.execute();                    
             }
         }
     }

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=829856&r1=829855&r2=829856&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure.xml (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure.xml Mon Oct 26 16:40:41 2009
@@ -162,7 +162,10 @@
             <arg line="-nologo"/>
             <arg line="cc${build.tstamp}.c /link /out:cc${build.tstamp}.exe"/>
         </cexec>
-        <conditional variable="@{result}" value="ok" else="not found">
+        <conditional variable="@{result}" value="1" else="0">
+            <equals arg1="${have.err}" arg2="0"/>
+        </conditional>
+        <conditional variable="have.res" value="ok" else="not found">
             <equals arg1="${have.err}" arg2="0"/>
         </conditional>
         <delete>
@@ -171,7 +174,7 @@
             </fileset>
         </delete>
         <property name="@{result}" value="0"/>
-        <print format="%1$-45s %2$s" message="Checking for &lt;@{check}.h&gt; : ${@{result}}"/>
+        <print format="%1$-45s %2$s" message="Checking for &lt;@{check}.h&gt; : ${have.res}"/>
         </sequential>
     </macrodef>
 
@@ -193,7 +196,10 @@
             <arg line="-nologo"/>
             <arg line="cc${build.tstamp}.c /link /out:cc${build.tstamp}.exe @{check}.lib"/>
         </cexec>
-        <conditional variable="@{result}" value="ok" else="not found">
+        <conditional variable="@{result}" value="1" else="0">
+            <equals arg1="${have.err}" arg2="0"/>
+        </conditional>
+        <conditional variable="have.res" value="ok" else="not found">
             <equals arg1="${have.err}" arg2="0"/>
         </conditional>
         <delete>
@@ -202,7 +208,7 @@
             </fileset>
         </delete>
         <property name="@{result}" value="0"/>
-        <print format="%1$-45s %2$s" message="Checking for @{check} library : ${@{result}}"/>
+        <print format="%1$-45s %2$s" message="Checking for @{check} library : ${have.res}"/>
         </sequential>
     </macrodef>
 
@@ -258,7 +264,7 @@
         <echo message="check1 = ${check1}"/>
         <sizeof check="int"/>
         <sizeof check="long long" result="config.sizeof.longlong"/>
-        <sequence if="systemid.os" not="windows">
+        <sequence ifnot="systemid.os" equals="windows">
             <have-include check="unistd"/>
         </sequence>
         <sequence if="systemid.os" equals="windows">
@@ -266,6 +272,7 @@
             <have-library check="bufferoverflow"/>
             <have-library check="ktmw32"/>            
         </sequence>
-        <print format="#define HAVE_UNISTD      %1s" message="${config.have.unistd}"/>
+        <print format="#define HAVE_UNISTD_H    %1s" message="${config.have.unistd}"/>
+        <print format="#define HAVE_WINDOWS_H   %1s" message="${config.have.windows}"/>
     </target>
 </project>