xref: /aoo42x/main/solenv/ant/idl.xml (revision 8f71f2da)
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">
40        <check-idl/>
41        <build-idl unless:set="idl.uptodate"/>
42    </target>
43
44    <target name="unoprivateapi-cppumaker">
45        <property name="idl.cppumaker.flag" location="${unoprivateapi.outdir}/idl.cppumaker.flag"/>
46        <check-idl-cppumaker/>
47        <build-idl-cppumaker unless:set="idl.cppumaker.uptodate"/>
48    </target>
49
50    <macrodef name="check-idl">
51        <sequential>
52            <local name="idl.files.exist"/>
53            <condition property="idl.files.exist">
54                <resourcecount refid="idl.files" when="greater" count="0"/>
55            </condition>
56
57            <uptodate property="idl.uptodate" targetfile="${idl.javamaker.flag}" if:set="idl.files.exist">
58                <srcresources>
59                    <resources refid="idl.files"/>
60                </srcresources>
61            </uptodate>
62            <property name="idl.uptodate" value="true" unless:set="idl.files.exist"/>
63        </sequential>
64    </macrodef>
65
66    <macrodef name="check-idl-cppumaker">
67        <sequential>
68            <uptodate property="idl.cppumaker.uptodate" targetfile="${idl.cppumaker.flag}">
69                <srcresources>
70                    <file name="${unoprivateapi.idl}"/>
71                </srcresources>
72            </uptodate>
73        </sequential>
74    </macrodef>
75
76    <macrodef name="build-idl">
77        <sequential>
78            <idlc urdDirectory="${idl.urd.build.dir}">
79                <idlFiles>
80                    <resources refid="idl.files"/>
81                </idlFiles>
82            </idlc>
83            <regmerge
84                urdDirectory="${idl.urd.build.dir}"
85                rdbDirectory="${idl.rdb.build.dir}"/>
86            <javamaker
87                inputRdb="${idl.rdb.build.dir}/registry.rdb"
88                outputDirectory="${idl.classes.build.dir}"
89                noDependentTypes="true"
90                excludes="${OUTDIR}/bin/types.rdb"/>
91            <touch file="${idl.javamaker.flag}"/>
92        </sequential>
93    </macrodef>
94
95    <macrodef name="build-idl-cppumaker">
96        <sequential>
97            <idlc urdDirectory="${unoprivateapi.outdir}/urd">
98                <idlFiles>
99                    <file name="${unoprivateapi.idl}"/>
100                </idlFiles>
101            </idlc>
102            <regmerge
103                urdDirectory="${unoprivateapi.outdir}/urd"
104                rdbDirectory="${unoprivateapi.outdir}/rdb"/>
105            <cppumaker
106                inputRdb="${unoprivateapi.outdir}/rdb/registry.rdb"
107                outputDirectory="${unoprivateapi.outdir}/inc"/>
108            <touch file="${idl.cppumaker.flag}"/>
109        </sequential>
110    </macrodef>
111
112    <macrodef name="idlc">
113        <element name="idlFiles"/>
114        <attribute name="urdDirectory"/>
115        <sequential>
116            <mkdir dir="@{urdDirectory}"/>
117            <apply executable="${OUTDIR}/bin/idlc" failonerror="true">
118                <env key="LD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
119                <env key="DYLD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
120                <arg value="-I${OUTDIR}/idl"/>
121                <arg value="-O"/>
122                <arg value="@{urdDirectory}"/>
123                <arg value="-verbose"/>
124                <arg value="-cid"/>
125                <arg value="-we"/>
126                <resources>
127                    <idlFiles/>
128                </resources>
129            </apply>
130        </sequential>
131    </macrodef>
132
133    <macrodef name="regmerge">
134        <attribute name="urdDirectory"/>
135        <attribute name="rdbDirectory"/>
136        <sequential>
137            <mkdir dir="@{rdbDirectory}"/>
138            <delete file="@{rdbDirectory}/registry.rdb"/>
139            <apply executable="${OUTDIR}/bin/regmerge" failonerror="true">
140                <env key="LD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
141                <env key="DYLD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
142                <arg value="@{rdbDirectory}/registry.rdb"/>
143                <arg value="/UCR"/>
144                <fileset dir="@{urdDirectory}" includes="**/*.urd"/>
145            </apply>
146        </sequential>
147    </macrodef>
148
149    <macrodef name="javamaker">
150        <attribute name="inputRdb"/>
151        <attribute name="outputDirectory"/>
152        <attribute name="noDependentTypes" default="false"/>
153        <attribute name="excludes" default=""/>
154        <sequential>
155            <mkdir dir="@{outputDirectory}"/>
156            <exec executable="${OUTDIR}/bin/javamaker" failonerror="true">
157                <env key="LD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
158                <env key="DYLD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
159                <arg value="-O@{outputDirectory}"/>
160                <arg value="-BUCR"/>
161                <arg value="-nD"
162                    if:true="@{noDependentTypes}"/>
163                <arg value="@{inputRdb}"/>
164                <arg value="-X@{excludes}"
165                    unless:blank="@{excludes}"/>
166            </exec>
167        </sequential>
168    </macrodef>
169
170    <macrodef name="cppumaker">
171        <attribute name="inputRdb"/>
172        <attribute name="outputDirectory"/>
173        <sequential>
174            <mkdir dir="@{outputDirectory}"/>
175            <exec executable="${OUTDIR}/bin/cppumaker" failonerror="true">
176                <env key="LD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
177                <env key="DYLD_LIBRARY_PATH" value="${OUTDIR}/lib"/>
178                <arg value="-O@{outputDirectory}"/>
179                <arg value="-BUCR"/>
180                <arg value="-C"/>
181                <arg value="@{inputRdb}"/>
182                <arg value="${OUTDIR}/bin/udkapi.rdb"/>
183            </exec>
184        </sequential>
185    </macrodef>
186</project>
187
188