summaryrefslogtreecommitdiffstats
path: root/cpp/sca/runtime/extensions/ruby/build.xml
blob: 414ff9bbf8c3176ae08c4d2c75e68ee0d7c382f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<?xml version="1.0" encoding="UTF-8"?>
<!--
   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.
-->
<project name="TuscanyScaNative_extension_ruby" default="all" basedir="../../..">

  <import file="${basedir}/antscripts/system.xml"/>
  <import file="${basedir}/antscripts/compile-targets.xml"/>

  <!--
    Notice that the basedir for this project is set to the TuscanySCA root dir
    This makes path setting in system.xml much simpler, but we'll just have to
    set a property here to this directory.
  -->
  <property name="this.dir"            location="${basedir}/runtime/extensions/ruby"/>
  <property name="this.src.dir"        location="${basedir}/runtime/extensions/ruby/src"/>
  <property name="ruby.xsd.dir"        location="${this.dir}/xsd"/>
  <property name="ruby.core.dir"       location="${this.src.dir}/tuscany/sca/ruby"/>
  <property name="ruby.model.dir"      location="${this.src.dir}/tuscany/sca/ruby/model"/>
  <property name="ruby.extension.dir"  location="${this.dir}/extension/src"/>
  <property name="lib.extension.dir"   location="${this.dir}/extension/.libs"/>
  <property name="lib.dir"             location="${this.src.dir}/.libs"/>
  <property name="ruby.core.lib"       value="tuscany_sca_ruby_lang"/>
  <property name="ruby.extension.lib"  value="tuscany_sca_ruby"/>
  <property name="ruby.install.dir"    location="${tuscanySCA.install.dir}/extensions/ruby"/>

  <!--
    All the cpp files per subdirectory
    New classes should be added to these properties
  -->
  <property
    name="ruby.core.cpp.files"
    value="RubyCompositeContext.cpp
           RubyExtension.cpp
           RubyImplementationExtension.cpp
           RubyServiceProxy.cpp
           RubyServiceWrapper.cpp"/>

  <property
    name="ruby.model.cpp.files"
    value="RubyImplementation.cpp
           RubyReferenceBinding.cpp
           RubyServiceBinding.cpp"/>

  <property
    name="ruby.extension.cpp.files"
    value="Extension.cpp"/>

  <property
    name="ruby.xsd.files"
    value="sca-implementation-ruby.xsd"/>

  <!--
    Public targets
  -->
  <target name="all"
      description="Compile, link, and install all TuscanyScaNative ruby extension source code">
    <antcall target="compile"/>
    <antcall target="link"/>
    <antcall target="install"/>
  </target>

  <target name="build" description="Compile and link all TuscanyScaNative ruby extension source code">
    <antcall target="compile"/>
    <antcall target="link"/>
  </target>

  <target name="compile" description="Compile all TuscanyScaNative ruby extension source code">
    <antcall target="compile.ruby.core"/>
    <antcall target="compile.ruby.model"/>
    <antcall target="compile.ruby.extension"/>
  </target>

  <target name="link" description="Link all TuscanyScaNative ruby extension source code">
    <antcall target="link.ruby.core"/>
    <antcall target="link.ruby.extension"/>
  </target>

  <target name="install" description="Install TuscanyScaNative ruby extension libraries and headers">
    <antcall target="install.ruby.core"/>
    <antcall target="install.ruby.extension"/>
    <antcall target="install.ruby.xsd"/>
  </target>

  <target name="clean" description="Clean all TuscanyScaNative ruby extension compiled source code">
    <antcall target="clean.ruby.core"/>
    <antcall target="clean.ruby.extension"/>
    <antcall target="clean.ruby.xsd"/>
  </target>

  <!--
    Internal targets
    They can still be called, they're just not described, so wont show up in "ant -p"
  -->

    <!-- compile -->

  <target name="compile.ruby.core" depends="check.ruby" if="enable_ruby">
    <cpp-compile
        srcdir="${ruby.core.dir}"
        objdir="${lib.dir}"
        infiles="${ruby.core.cpp.files}">
      <custom-cc-elements>
        <includepath path="${this.src.dir}"/>
        <includepath path="${ruby.include.dir}"/>
        <defineset if="windows" define="TUSCANY_SCA_RUBY_LANG_EXPORTS"/>
      </custom-cc-elements>
    </cpp-compile>
  </target>

  <target name="compile.ruby.model" depends="check.ruby" if="enable_ruby">
    <cpp-compile
        srcdir="${ruby.model.dir}"
        objdir="${lib.dir}"
        infiles="${ruby.model.cpp.files}">
      <custom-cc-elements>
        <includepath path="${this.src.dir}"/>
        <includepath path="${ruby.include.dir}"/>
        <defineset if="windows" define="TUSCANY_SCA_RUBY_LANG_EXPORTS"/>
      </custom-cc-elements>
    </cpp-compile>
  </target>

  <target name="compile.ruby.extension" depends="check.ruby" if="enable_ruby">
    <cpp-compile
        srcdir="${ruby.extension.dir}"
        objdir="${lib.extension.dir}"
        infiles="${ruby.extension.cpp.files}">
      <custom-cc-elements>
        <includepath path="${this.src.dir}"/>
        <includepath path="${ruby.include.dir}"/>
      </custom-cc-elements>
    </cpp-compile>
  </target>

    <!-- link -->

  <target name="link.ruby.core" depends="check.ruby" if="enable_ruby">
    <cpp-link
        outfile="${ruby.core.lib}"
        outdir="${lib.dir}"
        indir="${lib.dir}"
        infiles="*${object.ext}">
      <custom-ld-elements>
        <libset dir="${ruby.lib.dir}" libs="ruby"/>
      </custom-ld-elements>
    </cpp-link>
  </target>

  <target name="link.ruby.extension" depends="check.ruby" if="enable_ruby">
    <cpp-link
        outfile="${ruby.extension.lib}"
        outdir="${lib.extension.dir}"
        indir="${lib.extension.dir}"
        infiles="*${object.ext}"/>
  </target>

    <!-- install -->

  <target name="install.ruby.core" depends="check.ruby" if="enable_ruby">
    <cpp-install-lib
        lib="${ruby.core.lib}"
        srcdir="${lib.dir}"
        destrootdir="${ruby.install.dir}"/>
    <cpp-symlink
        linkdir="${ruby.install.dir}/lib"
        link="${lib.prefix}${ruby.core.lib}${lib.ext}"
        resource="${lib.prefix}${ruby.core.lib}${lib.ext}${tuscanySCA.library.version}"/>
    <cpp-symlink
        linkdir="${ruby.install.dir}/module"
        link="${lib.prefix}${ruby.core.lib}${lib.ext}"
        resourcedir="${ruby.install.dir}/lib"
        resource="${lib.prefix}${ruby.core.lib}${lib.ext}"/>
  </target>

  <target name="install.ruby.extension" depends="check.ruby" if="enable_ruby">
    <cpp-install-file
        srcfile="${lib.prefix}${ruby.extension.lib}${lib.ext}"
        destfile="${ruby.extension.lib}${lib.ext}"
        srcdir="${lib.extension.dir}"
        destdir="${ruby.install.dir}/lib"/>
  </target>

  <target name="install.ruby.xsd" depends="check.ruby" if="enable_ruby">
    <cpp-install-files
        files="${ruby.xsd.files}"
        srcdir="${ruby.xsd.dir}"
        destdir="${ruby.install.dir}/xsd"/>
  </target>

    <!-- clean -->

  <target name="clean.ruby.core">
    <cpp-clean-lib
    	lib="${ruby.core.lib}"
        librootdir="${ruby.install.dir}"/>
    <cpp-clean-files
        dir="${ruby.install.dir}/module"
        rmdir="true"/>
    <delete dir="${lib.dir}" quiet="true"/>
  </target>

  <target name="clean.ruby.extension">
    <cpp-clean-files
        dir="${ruby.install.dir}/lib"
        files="${ruby.extension.lib}${lib.ext}"
        rmdir="true"/>
    <delete dir="${lib.extension.dir}" quiet="true"/>
  </target>

  <target name="clean.ruby.xsd">
    <cpp-clean-files
        dir="${ruby.install.dir}/xsd"
        rmdir="true"/>
  </target>

</project>