-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
96 lines (79 loc) · 3.49 KB
/
build.xml
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
<project name="custom_data_source">
<description>
IBM OPL Custom data source sample with JDBC
</description>
<property environment="env"/>
<property name="src" location="src/main/java"/>
<property name="build" location="build"/>
<property file="build.properties"/>
<condition property="example.home" value="${env.CPLEX_STUDIO_DIR128}/opl">
<isset property="env.CPLEX_STUDIO_DIR128"/>
</condition>
<property name="example.home" value="${opl.home}">
</property>
<!-- This makes sure that when running `ant run_target -Dexport=result.txt`,
the main program is run with -export result.txt, thus writing a result.txt
file with the result.
-->
<condition property="export.option" value="-export ${export}">
<isset property="export"/>
</condition>
<property name="export.option" value=""/>
<echo message="Importing ${example.home}/examples/opl_interfaces/java/build_common.xml"/>
<import file="${example.home}/examples/opl_interfaces/java/build_common.xml"/>
<property name="oplall.jar" value="${example.home}/lib/oplall.jar"/>
<property name="debug" value="off"/>
<path id="project.class.path">
<pathelement location="build/"/>
<pathelement location="${oplall.jar}"/>
<pathelement location="${mysql.jdbc.connector.path}"/>
<pathelement path="${db2.jdbc.connector.path}"/>
<pathelement location="${sqlserver.jdbc.connector.path}"/>
</path>
<target name="init">
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${build}" debug="${debug}">
<classpath refid="project.class.path"/>
</javac>
</target>
<target name="jar" depends="compile">
<jar destfile="lib/jdbc-custom-data-source.jar" basedir="${build}"
manifest="src/main/resources/META-INF/MANIFEST.MF"/>
</target>
<target name="run" depends="compile">
<echo message="Running command line: ${cmd}"/>
<java classname="com.ibm.opl.customdatasource.CustomDataSource">
<classpath refid="project.class.path"/>
<jvmarg value="-Djava.library.path=${example.home}/bin/${example.platform}"/>
<jvmarg line="${example.jvmargs}"/>
<arg line="${export.option} ${cmd}"/>
<env key="PATH" path="${example.home}/bin/${example.platform}${platform.separator}${env.PATH}"/>
<env key="LD_LIBRARY_PATH" path="${example.home}/bin/${example.platform}"/>
<env key="LIBPATH" path="${example.home}/bin/${example.platform}"/>
<!-- for Windows since ant is case sensitive for environment variable -->
<env key="Path" path="${example.home}/bin/${example.platform}${platform.separator}${env.Path}"/>
<env key="LD_PRELOAD_32" path="${preload_32}"/>
<env key="LD_PRELOAD_64" path="${preload_64}"/>
</java>
</target>
<target name="run_db2" depends="compile">
<antcall target="run">
<param name="cmd" value="-properties data/db_db2.xml examples/oil/oil.mod examples/oil/oil.dat"/>
</antcall>
</target>
<target name="run_mysql" depends="compile">
<antcall target="run">
<param name="cmd" value="-properties data/db_mysql.xml examples/oil/oil.mod examples/oil/oil.dat"/>
</antcall>
</target>
<target name="run_mssql" depends="compile">
<antcall target="run">
<param name="cmd" value="-properties data/db_mssql.xml examples/oil/oil.mod examples/oil/oil.dat"/>
</antcall>
</target>
<target name="clean">
<delete dir="${build}"/>
</target>
</project>