xref: /aoo42x/main/solenv/ant/idl.xml (revision bee6bcb9)
1<?xml version="1.0" encoding="UTF-8"?>
2<!--***********************************************************
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements.  See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership.  The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License.  You may obtain a copy of the License at
11 *
12 *   http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied.  See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 *
21 ***********************************************************-->
22
23
24<project name="idl" xmlns:if="ant:if" xmlns:unless="ant:unless">
25
26    <dirname property="idl.basedir" file="${ant.file.idl}"/>
27
28    <!-- global properties -->
29    <property file="${idl.basedir}/../../ant.properties"/>
30
31
32
33    <property name="idl.build.dir" location="${build.base.dir}/idl"/>
34    <property name="idl.urd.build.dir" location="${idl.build.dir}/urd"/>
35    <property name="idl.rdb.build.dir" location="${idl.build.dir}/rdb"/>
36    <property name="idl.classes.build.dir" location="${idl.build.dir}/classes"/>
37    <property name="idl.javamaker.flag" location="${idl.build.dir}/idl.javamaker.flag"/>
38
39    <target name="idl" depends="idl-check,idl-javamaker"/>
40
41    <target name="idl-check">
42        <local name="idl.files.exist"/>
43        <condition property="idl.files.exist">
44            <resourcecount refid="idl.files" when="greater" count="0"/>
45        </condition>
46
47        <local name="idl.files.union"/>
48        <union id="idl.files.union" if:set="idl.files.exist">
49            <filelist refid="idl.files"/>
50        </union>
51        <uptodate property="idl.uptodate" targetfile="${idl.javamaker.flag}" if:set="idl.files.exist">
52            <srcresources refid="idl.files.union"/>
53        </uptodate>
54        <property name="idl.uptodate" value="true" unless:set="idl.files.exist"/>
55    </target>
56
57    <macrodef name="javamaker">
58        <attribute name="input-rdb"/>
59        <attribute name="output-directory"/>
60        <attribute name="no-dependent-types" default="false"/>
61        <attribute name="excludes" default=""/>
62        <sequential>
63            <mkdir dir="@{output-directory}"/>
64            <exec executable="${OUTDIR}/bin/javamaker" failonerror="true">
65                <env key="LD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
66                <env key="DYLD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
67                <arg value="-O@{output-directory}"/>
68                <arg value="-BUCR"/>
69                <arg value="-nD"
70                    if:true="@{no-dependent-types}"/>
71                <arg value="@{input-rdb}"/>
72                <arg value="-X@{excludes}"
73                    unless:blank="@{excludes}"/>
74            </exec>
75        </sequential>
76    </macrodef>
77
78    <target name="idl-javamaker" depends="idl-regmerge" unless="idl.uptodate">
79        <mkdir dir="${idl.classes.build.dir}"/>
80        <javamaker
81            input-rdb="${idl.rdb.build.dir}/registry.rdb"
82            output-directory="${idl.classes.build.dir}"
83            no-dependent-types="true"
84            excludes="${OUTDIR}/bin/types.rdb"/>
85        <touch file="${idl.javamaker.flag}"/>
86    </target>
87
88    <target name="idl-regmerge" depends="idl-idlc" unless="idl.uptodate">
89        <mkdir dir="${idl.rdb.build.dir}"/>
90        <delete file="${idl.rdb.build.dir}/registry.rdb"/>
91        <apply executable="${OUTDIR}/bin/regmerge" failonerror="true">
92            <env key="LD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
93            <env key="DYLD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
94            <arg value="${idl.rdb.build.dir}/registry.rdb"/>
95            <arg value="/UCR"/>
96            <fileset dir="${idl.urd.build.dir}" includes="**/*.urd"/>
97        </apply>
98    </target>
99
100    <target name="idl-idlc" unless="idl.uptodate">
101        <mkdir dir="${idl.urd.build.dir}"/>
102        <apply executable="${OUTDIR}/bin/idlc" failonerror="true">
103            <env key="LD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
104            <env key="DYLD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
105            <arg value="-I${OUTDIR}/idl"/>
106            <arg value="-O"/>
107            <arg value="${idl.urd.build.dir}"/>
108            <arg value="-verbose"/>
109            <arg value="-cid"/>
110            <arg value="-we"/>
111            <filelist refid="idl.files"/>
112        </apply>
113    </target>
114
115</project>
116
117