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 13:42:54 UTC

svn commit: r829772 - in /commons/sandbox/runtime/trunk/src/main/native: build/org/apache/commons/runtime/ConditionalExecTask.java build/org/apache/commons/runtime/SilentExecTask.java configure.properties.default configure.xml

Author: mturk
Date: Mon Oct 26 12:42:54 2009
New Revision: 829772

URL: http://svn.apache.org/viewvc?rev=829772&view=rev
Log:
Add example ant configure

Added:
    commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalExecTask.java
      - copied, changed from r829771, commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SilentExecTask.java
    commons/sandbox/runtime/trunk/src/main/native/configure.properties.default
    commons/sandbox/runtime/trunk/src/main/native/configure.xml   (with props)
Removed:
    commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SilentExecTask.java

Copied: commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalExecTask.java (from r829771, commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SilentExecTask.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalExecTask.java?p2=commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalExecTask.java&p1=commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SilentExecTask.java&r1=829771&r2=829772&rev=829772&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/SilentExecTask.java (original)
+++ commons/sandbox/runtime/trunk/src/main/native/build/org/apache/commons/runtime/ConditionalExecTask.java Mon Oct 26 12:42:54 2009
@@ -29,13 +29,13 @@
 
 /**
  */
-public class SilentExecTask extends ExecTask
+public class ConditionalExecTask extends ExecTask
 {
 
     /** Optional Vector holding the nested tasks */
     private Vector<Condition> conditions = new Vector<Condition>();
     private Condition cond;
-    public SilentExecTask()
+    public ConditionalExecTask()
     {
         super();
     }

Added: commons/sandbox/runtime/trunk/src/main/native/configure.properties.default
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure.properties.default?rev=829772&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure.properties.default (added)
+++ commons/sandbox/runtime/trunk/src/main/native/configure.properties.default Mon Oct 26 12:42:54 2009
@@ -0,0 +1,38 @@
+# -----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# -----------------------------------------------------------------------------
+# configure.properties.default
+#
+# This is an example "configure.properties" file, used to customize building
+# Runtime for your local environment. It defines the location of all external
+# modules that Runtime depends on. Copy this file to "configure.properties"
+# in the top-level source directory, and customize it as needed.
+#
+# -----------------------------------------------------------------------------
+
+# ----- Vesion Control Flags --------------------------------------------------
+version.major=0
+version.minor=9
+version.patch=3
+version.suffix=-dev
+
+# ----- Default Compile options -----------------------------------------------
+compile.source=1.5
+compile.target=1.5
+compile.debug=off
+compile.optimize=on
+compile.deprecation=on

Added: 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=829772&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure.xml (added)
+++ commons/sandbox/runtime/trunk/src/main/native/configure.xml Mon Oct 26 12:42:54 2009
@@ -0,0 +1,195 @@
+<?xml version="1.0"?>
+<!-- Configure file for Runtime -->
+<project name="Apache Commons Runtime Library Configururation"
+         default="configure"
+         basedir="../../../" >
+    <!-- Give user a chance to override without editing this file
+        (and without typing -D each time it compiles it
+    -->
+    <property file="configure.properties" />
+    <property file="configure.properties.default" />
+
+    <property name="build.top" value="${basedir}"/>
+    <property name="build.dir" value="${basedir}/dist"/>
+    <property name="build.src" value="${build.dir}/src"/>
+    <property name="build.dest" value="${build.dir}/bin"/>
+
+    <property name="build.package.path" value="org/apache/commons/runtime"/>
+    <property name="build.package.name" value="org.apache.commons.runtime"/>
+    <property name="src.java" value="${basedir}/src"/>
+
+    <property name="src.native" value="${basedir}/src/main/native"/>
+
+    <property name="compile.source" value="1.5"/>
+    <property name="compile.target" value="1.5"/>
+    <property name="compile.debug" value="off"/>
+    <property name="compile.optimize" value="on"/>
+    <property name="compile.deprecation" value="on"/>
+
+    <!-- Ant tasks classpath -->
+    <path id="task.classpath">
+        <pathelement location="${build.dest}/build"/>
+    </path>
+    <!-- Build time stamp -->
+    <tstamp>
+        <format property="build.tstamp" pattern="HHmmssSS"/>
+    </tstamp>
+
+    <!-- =================================================================== -->
+    <!-- prints the environment                                              -->
+    <!-- =================================================================== -->
+    <target name="env" description="Print Configuration environment">
+        <echo message="java.home    = ${java.home}"/>
+        <echo message="user.home    = ${user.home}"/>
+        <echo message="os.name      = ${os.name}"/>
+        <echo message="os.arch      = ${os.arch}"/>
+        <echo message="os.version   = ${os.version}"/>
+        <echo message="basedir      = ${basedir}"/>
+        <echo message="build.top    = ${build.top}"/>
+        <echo message="build.dir    = ${build.dir}"/>
+        <echo message="build.src    = ${build.src}"/>
+        <echo message="src.native   = ${src.native}"/>
+        <echo message="build.tstamp = ${build.tstamp}"/>
+    </target>
+
+    <!-- =================================================================== -->
+    <!-- Compiles the ant task directory                                     -->
+    <!-- =================================================================== -->
+    <target name="tasks" depends="env">
+        <mkdir dir="${build.dest}/build"/>
+        <mkdir dir="${build.src}/build"/>
+        <copy todir="${build.src}/build" filtering="yes">
+            <fileset dir="${src.native}/build">
+                <include name="**/*.java"/>
+                <include name="**/*.xml"/>
+                <include name="**/*.properties"/>
+            </fileset>
+        </copy>
+        <javac srcdir="${build.src}/build"
+            destdir="${build.dest}/build"
+            debug="${compile.debug}"
+            source="${compile.source}"
+            target="${compile.target}"
+            deprecation="${compile.deprecation}"
+            optimize="${compile.optimize}">
+            <classpath refid="task.classpath"/>
+        </javac>
+        <taskdef name="systemid"
+            classname="${build.package.name}.SystemIdTask">
+            <classpath refid="task.classpath"/>
+        </taskdef>
+        <taskdef name="conditional"
+            classname="${build.package.name}.ConditionalTask">
+            <classpath refid="task.classpath"/>
+        </taskdef>
+        <taskdef name="uuid"
+            classname="${build.package.name}.UuidTask">
+            <classpath refid="task.classpath"/>
+        </taskdef>
+        <taskdef name="variable"
+            classname="${build.package.name}.VolatileProperty">
+            <classpath refid="task.classpath"/>
+        </taskdef>
+        <taskdef name="cexec"
+            classname="${build.package.name}.ConditionalExecTask">
+            <classpath refid="task.classpath"/>
+        </taskdef>
+        <taskdef name="print"
+            classname="${build.package.name}.FormattedEchoTask">
+            <classpath refid="task.classpath"/>
+        </taskdef>
+        <uuid property="build.uuid" />
+        <systemid prefix="systemid" />
+    </target>
+
+    <macrodef name="sizeof">
+        <attribute name="check"/>
+        <attribute name="result" default="sizeof.@{check}"/>
+        <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;} 
+        </echo>
+        <variable unset="true" name="@{result}"/>
+        <variable unset="true" name="sizeof.res"/>
+        <variable unset="true" name="sizeof.err"/>
+        <cexec executable="cl" dir="${src.native}" output="cc${build.tstamp}.log"
+              resultproperty="sizeof.err">
+            <systemid equals="windows"/>
+            <arg line="-nologo"/>
+            <arg line="cc${build.tstamp}.c"/>
+            <arg line="/link /out:cc${build.tstamp}.exe"/>
+        </cexec>
+        <variable unset="true" name="sizeof.err"/>
+        <cexec dir="${src.native}" executable="cc${build.tstamp}" outputproperty="@{result}"
+              resultproperty="sizeof.err" error="cc${build.tstamp}.err">
+            <systemid equals="windows"/>
+        </cexec>
+        <delete>
+            <fileset dir="${src.native}">
+                <filename name="cc${build.tstamp}*" />
+            </fileset>
+        </delete>
+        <property name="@{result}" value="0"/>
+        <print format="%1$-35s %2$s" message="Checking for sizeof(@{check}) : ${@{result}}"/>
+        </sequential>
+    </macrodef>
+    <target name="test1">
+        <property name="foo" value="bar" />
+        <variable name="foo" value="-D__${systemid.CPU}__" />
+        <variable name="foo" add="-D${systemid.OS}" />
+        <echo message="Target test passes foo=${foo}" />
+    </target>
+    <target name="test2">
+        <echo message="Target test failed" />
+    </target>
+
+    <!-- =================================================================== -->
+    <!-- configure task                                                      -->
+    <!-- =================================================================== -->
+    <target name="configure" depends="tasks">
+        <uuid property="configure.uuid" />
+        <echo message="configure.uuid = ${configure.uuid}" file="${src.native}/a${build.tstamp}.txt"/>
+        <delete>
+            <fileset dir="${src.native}">
+                <filename name="*${build.tstamp}*" />
+            </fileset>
+        </delete>
+        <conditional target="test1" else="test2">
+            <and>
+             <systemid equals="windows"/>
+             <systemid arch="32" />
+            </and>
+        </conditional>
+        <property name="check1" value="none" />
+        <!-- Variable set condition -->
+        <conditional variable="check1" value="-DWIN32" else="false">
+            <and>
+             <systemid equals="windows"/>
+             <systemid arch="32" />
+            </and>
+        </conditional>
+        <!-- Variable add condition -->
+        <conditional variable="check1" add="-D_WIN32 -DWIN32" else="-D_WIN64">
+            <and>
+             <systemid equals="windows"/>
+             <systemid arch="32" />
+            </and>
+        </conditional>
+        <echo message="check1 = ${check1}"/>
+        <!-- Imutable set condition -->
+        <conditional property="cc" value="cl">
+            <and>
+             <systemid equals="windows"/>
+            </and>
+        </conditional>
+        <echo message="check1 = ${check1}"/>
+        <sizeof check="int" result="sizeof.int">
+        </sizeof>
+        <sizeof check="__int64" result="sizeof.void">
+        </sizeof>
+    </target>
+</project>

Propchange: commons/sandbox/runtime/trunk/src/main/native/configure.xml
------------------------------------------------------------------------------
    svn:eol-style = native