aboutsummaryrefslogtreecommitdiffstats
blob: 80675d600196d25bdf2df31dfcd01c7fa34ea91d (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
<?xml version="1.0"?>
<!--/*******************************************************************************
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
*   Ant naming conventions:
*   - regardless of the actual OS platform,'/' is the directory separator
*     (Ant will convert as appropriate).
*   - multi-word properties use periods '.'
*     - properties ending in .jar define jarfile names only (no path)
*     - properties ending in .lib are fully qualified jars (path and filename)
*     - properties ending in .dir are directory paths
*     - properties ending in .path are path refid names (classpath fragments)
*   - multi-word targets use hyphens '-'
*     - targets beginning with test- are reserved for high level test targets,
*       and are used in test results parsing
*     - targets typically use the form <action>-<object>-<type> (ie. package-bundle-zip)
*   - multi-word macros use underscores '_'
*   - multi-word macro attributes are concatenated
*     e.g. 'runpathref'
*   - multi-word tasks (taskdef) names are concatenated
*     e.g. 'validateconnection'
*   - OS environment variables are in ALLCAPS and have 'env' as a prefix
*     e.g. ${env.XXX}.
*   - Ant properties are lower case.
*
* Contributors:
*     bdoughan - initial API and implementation
*     egwin - update to adopt calling standards
#******************************************************************************/-->
<project name="org.eclipse.persistence.moxy.dynamicxjc" default="build" basedir=".">
    <available file="../${ant.project.name}" type="dir" property="dynamic.is.local"/>
    <!-- Test to make sure that the calling script doesn't inherit the variable -->
    <!-- (should be set locally, and be destroyed upon return) -->
    <fail message="Not running from '${ant.project.name}' directory" unless="dynamic.is.local"/>

    <dirname  property="dynamic.build.location_temp" file="${ant.file.org.eclipse.persistence.moxy.dynamicxjc}"/>
    <pathconvert targetos="unix" property="dynamic.build.location">
        <path>
            <pathelement location="${dynamic.build.location_temp}"/>
        </path>
    </pathconvert>
    <condition property="dynamic.2.base.dir" value="../.." else="..">
        <contains string="${dynamic.build.location}" substring="moxy/${ant.project.name}"/>
    </condition>
    <echo message="dynamic.2.base.dir = '${dynamic.2.base.dir}'"/>
    <property name="dynamic.2.common.plugins.dir" value="${dynamic.2.base.dir}/plugins"/>
    <property name="dynamic.2.buildsys.dir" value="${dynamic.2.base.dir}/buildsystem"/>

    <!-- local property overrides -->
    <condition property="custom.properties.message" value="Loading ${user.home}/build.properties..."
                                                     else="Custom properties file '${user.home}/build.properties' not found to load.">
        <available file="${user.home}/build.properties"/>
    </condition>
    <echo message="${custom.properties.message}"/>
    <property file="${user.home}/build.properties"/>
    <property file="${dynamic.build.location}/antbuild.properties"/>

    <propertyset id="parser.properties">
        <propertyref prefix="javax.xml"/>
    </propertyset>

    <!-- Primary Targets -->
    <target name="build" depends="clean, compile, jar"  description="build ${ant.project.name} component"/>
    <target name="jar"   depends="package"              description="package ${ant.project.name} component using bn"/>

    <!-- clean -->
    <target name="clean" description="Clean all generated content">
        <delete includeEmptyDirs="true" failonerror="false">
            <fileset dir="${classes.dir}"/>
            <fileset dir="${dynamic.2.common.plugins.dir}" includes="${dynamic.jar.prefix}_*.jar, ${dynamic.jar.prefix}.source_*.jar"/>
        </delete>
    </target>

    <!-- initialize varables and paths needed for compile -->
    <!-- the number of properties needed now is too great for lazy loading without a target -->
    <target name="init">
        <!-- This HAS to be defined after allowing user redefinitions (which will cause the condition not to set anything) -->
        <!-- This tests to make sure the extensions dir exists, if not sets to a existant dummy location -->
        <condition property="extensions.depend.dir" value="${dynamic.2.base.dir}/../extension.lib.external"
                                                    else="${dynamic.build.location}">
            <available file="${dynamic.2.base.dir}/../extension.lib.external" type="dir"/>
        </condition>
        <echo message="extensions.depend.dir       = '${extensions.depend.dir}'"/>

        <!-- versioning -->
        <!-- These variables  are set in autobuild.xml. A manual build gets defaults -->
        <tstamp>
           <format property="build.date" pattern="yyyyMMdd"/>
           <format property="build.time" pattern="HHmm"/>
        </tstamp>
        <property name="build.type"            value="SNAPSHOT"/>
        <property name="svn.revision"          value="NA"/>
        <property name="version.qualifier"     value="qualifier"/>
        <property name="version.string"        value="${release.version}.${version.qualifier}"/>
        <property name="release.designation"   value="EclipseLink ${release.version} Build"/>
        <property name="specification.vendor"  value="Eclipse.org - EclipseLink Project"/>
        <property name="implementation.vendor" value="${specification.vendor}"/>

        <!-- dependency properties -->
        <property name="core.lib"           value="${dynamic.2.common.plugins.dir}/org.eclipse.persistence.core_${version.string}.jar"/>
        <property name="moxy.lib"           value="${dynamic.2.common.plugins.dir}/org.eclipse.persistence.moxy_${version.string}.jar"/>
        <property name="jaxb-api.lib"       value="${dynamic.2.common.plugins.dir}/${jaxb-api.jar}"/>
        <property name="jaxb-xjc.lib"       value="${dynamic.2.common.plugins.dir}/${jaxb-xjc.jar}"/>
        <property name="jaxb-impl.lib"      value="${dynamic.2.common.plugins.dir}/${jaxb-impl.jar}"/>

        <!-- dependency tests -->
        <available file="${core.lib}"                  property="core.bundle.exist"/>
        <fail message="Cannot find core: '${core.lib}'"     unless="core.bundle.exist"/>
        <available file="${moxy.lib}"                  property="moxy.bundle.exist"/>
        <fail message="Cannot find moxy: '${moxy.lib}'"     unless="moxy.bundle.exist"/>
        <available file="${jaxb-api.lib}"              property="jaxb-api.bundle.exist"/>
        <fail message="Cannot find jaxb-api: '${jaxb-api.lib}'" unless="jaxb-api.bundle.exist"/>
        <available file="${jaxb-xjc.lib}"              property="jaxb-xjc.bundle.exist"/>
        <fail message="Cannot find jaxb-xjc: '${jaxb-xjc.lib}'" unless="jaxb-xjc.bundle.exist"/>
        <available file="${jaxb-impl.lib}"             property="jaxb-impl.bundle.exist"/>
        <fail message="Cannot find jaxb-impl: '${jaxb-impl.lib}'" unless="jaxb-impl.bundle.exist"/>

        <!-- Set Compile Path-->
        <path id="dynamic.compile.path">
            <pathelement path="${jaxb-api.lib}"/>
            <pathelement path="${dynamic.2.common.plugins.dir}/${asm}"/>
            <pathelement path="${jaxb-xjc.lib}"/>
            <pathelement path="${jaxb-impl.lib}"/>
            <pathelement path="${core.lib}"/>
            <pathelement path="${moxy.lib}"/>
            <fileset
                dir="${dynamic.2.common.plugins.dir}"
                includes="${dynamic.global.depend}"/>
        </path>
    </target>

    <!-- compile -->
    <target name="compile" depends="init" description="Compile bundle code">
        <mkdir dir="${classes.dir}"/>
        <javac srcdir="${src.dir}"
               destdir="${classes.dir}"
               includes="org/eclipse/persistence/**/*.java"
               debug="${javac.debug}"
               debuglevel="${javac.debuglevel}"
               encoding="UTF-8"
               optimize="${javac.optimize}"
               source="${javac.version}"
               target="${javac.version}"
               deprecation="${javac.deprecation}"
               failonerror="true"
               memoryMaximumSize="512m"
               fork="true"
               classpathref="dynamic.compile.path"
        />
    </target>

    <!-- package -->
    <target name="package" depends="init" description="jar non-OSGI bundle">
        <jar jarfile="${dynamic.2.common.plugins.dir}/${dynamic.jar.prefix}_${version.string}.jar">
            <manifest>
                <attribute name="Specification-Vendor"   value="${specification.vendor}"/>
                <attribute name="Specification-Version"  value="${release.version}"/>
                <attribute name="Implementation-Vendor"  value="${implementation.vendor}"/>
                <attribute name="Implementation-Version" value="${version.string}"/>
                <attribute name="Bundle-ManifestVersion" value="2"/>
                <attribute name="Bundle-Name"            value="EclipseLink MOXY Dynamic Persistence"/>
                <attribute name="Bundle-SymbolicName"    value="${ant.project.name}"/>
                <attribute name="Bundle-Vendor"          value="${implementation.vendor}"/>
                <attribute name="Bundle-Version"         value="${version.string}"/>
            </manifest>
            <fileset dir="${dynamic.2.base.dir}">
                <include name="about.html"/>
                <include name="readme.html"/>
                <include name="license.*"/>
            </fileset>
            <fileset dir="${classes.dir}">
                <include name="org/eclipse/persistence/**/*.class"/>
            </fileset>
        </jar>
        <jar jarfile="${dynamic.2.common.plugins.dir}/${dynamic.jar.prefix}.source_${version.string}.jar">
            <manifest>
                <attribute name="Specification-Vendor"   value="${specification.vendor}"/>
                <attribute name="Specification-Version"  value="${release.version}"/>
                <attribute name="Implementation-Vendor"  value="${implementation.vendor}"/>
                <attribute name="Implementation-Version" value="${version.string}"/>
                <attribute name="Bundle-ManifestVersion" value="2"/>
                <attribute name="Bundle-Name"            value="EclipseLink MOXY Source"/>
                <attribute name="Bundle-SymbolicName"    value="${ant.project.name}.source"/>
                <attribute name="Bundle-Vendor"          value="${implementation.vendor}"/>
                <attribute name="Bundle-Version"         value="${version.string}"/>
            </manifest>
            <fileset dir="${dynamic.2.base.dir}">
                <include name="about.html"/>
                <include name="readme.html"/>
                <include name="license.*"/>
            </fileset>
            <fileset dir="${src.dir}">
                <include name="org/eclipse/persistence/**/*.java"/>
            </fileset>
       </jar>
    </target>

</project>