aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/build-osgi-bundles.xml
blob: 72a1795354de40f5bf3818a08aceb7525f3ad786 (plain) (blame)
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
<?xml version="1.0"?>
<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->

<project name="osgi-bundles" default="build" basedir=".">

  <property name="build.compiler" value="extJavac"/>

  <target name="archiveOsgiBundle">
    <property name="MANIFEST" value="target/build/manifest.mf"/>
    <copy file="src/test/java/${package}/${name}/Manifest.MF"
          tofile="${MANIFEST}"
          overwrite="true">
    </copy>

    <delete dir="staging"/>
    <mkdir dir="staging"/>
    <mkdir dir="target/test-classes"/> <!-- Create test-classes, does not exist during clover testing -->
    <copy todir="staging">
      <fileset dir="target/test-classes" includes="${package}/${name}/**"/>
    </copy>

    <mkdir dir="bundles"/>
    <jar jarfile="bundles/${name}bundle.jar"
         basedir="staging"
         manifest="${MANIFEST}"
         includes="**"
         index="true"
         />

    <delete file="${MANIFEST}"/>
  </target>

  <target name="archiveOsgiBundleVersion">
    <delete dir="staging"/>
    <mkdir dir="staging"/>

    <copy todir="staging">
      <fileset dir="src/test/java" includes="${package}/${name}-${version}/**"/>
    </copy>

    <!-- Remove version constraints imposed by developer tools/java -->
    <!-- Correct directory name to match package -->
    <move file="staging/${package}/${name}-${version}" todir="staging/${package}/${name}"/>
    <!-- Make source files .java -->
    <move todir="staging/${package}/${name}" includeemptydirs="false">
      <fileset dir="staging/${package}/${name}"/>
      <mapper type="glob" from="*.java.text" to="*.java"/>
    </move>

    <antcall target="compile">
      <param name="SOURCEPATH" value="staging"/>
      <param name="CLASSES_DIR" value="staging"/>
    </antcall>

    <mkdir dir="bundles"/>
    <jar jarfile="bundles/${name}bundle-${version}.jar"
         basedir="staging"
         manifest="src/test/java/${package}/${name}-${version}/Manifest.MF"
         includes="**"
         excludes="**/*.java"
         index="true"
         />
  </target>


  <!-- =================================================================== -->
  <!-- Creates the class jar archive                                       -->
  <!-- =================================================================== -->
  <target name="build"
          description="Jars the osgi bundles produced by this">
    <antcall target="archiveOsgiBundle">
      <param name="name" value="client"/>
      <param name="package" value="com/yahoo/osgi/test"/>
    </antcall>
    <antcall target="archiveOsgiBundle">
      <param name="name" value="calculatorservice"/>
      <param name="package" value="com/yahoo/osgi/test"/>
    </antcall>
    <antcall target="archiveOsgiBundle">
      <param name="name" value="counterservice"/>
      <param name="package" value="com/yahoo/osgi/test"/>
    </antcall>
    <antcall target="archiveOsgiBundle">
      <param name="name" value="searcher2"/>
      <param name="package" value="com/yahoo/search/searchchain/config/test"/>
    </antcall>
    <antcall target="archiveOsgiBundle">
      <param name="name" value="twosearchers"/>
      <param name="package" value="com/yahoo/search/searchchain/config/test"/>
    </antcall>
    <antcall target="archiveOsgiBundle">
      <param name="name" value="searcher1"/>
      <param name="package" value="com/yahoo/search/searchchain/config/test"/>
    </antcall>
    <antcall target="archiveOsgiBundleVersion">
      <param name="name" value="searcher1"/>
      <param name="package" value="com/yahoo/search/searchchain/config/test"/>
      <param name="version" value="2"/>
    </antcall>
    <antcall target="archiveOsgiBundleVersion">
      <param name="name" value="searcher1"/>
      <param name="package" value="com/yahoo/search/searchchain/config/test"/>
      <param name="version" value="2.1"/>
    </antcall>
    <antcall target="archiveOsgiBundleVersion">
      <param name="name" value="searcher1"/>
      <param name="package" value="com/yahoo/search/searchchain/config/test"/>
      <param name="version" value="2.2"/>
    </antcall>
    <antcall target="archiveOsgiBundle">
      <param name="name" value="updatesearcher"/>
      <param name="package" value="com/yahoo/search/searchchain/config/test"/>
    </antcall>
    <antcall target="archiveOsgiBundleVersion">
      <param name="name" value="updatesearcher"/>
      <param name="package" value="com/yahoo/search/searchchain/config/test"/>
      <param name="version" value="2"/>
    </antcall>

  </target>

  <!-- =================================================================== -->
  <!-- Compiles the source code                                            -->
  <!-- =================================================================== -->
  <target name="compile"
          description="Compiles all source files in the project SOURCEPATH">
    <property name="PATTERN" value="*"/>
    <property name="DEBUG" value="true"/>
    <property name="OPTI" value="off"/>
    <javac srcdir="${SOURCEPATH}"
           includeantruntime="false"
           encoding="UTF-8"
           destdir="${CLASSES_DIR}"
           classpath="target/classes:${MVN_COMPILE_CLASSPATH}"
           debug="${DEBUG}"
           deprecation="off"
           includes="**/${PATTERN}*.java"
           source="1.5"
           target="1.5"
           optimize="${OPTI}">
      <compilerarg compiler="jikes" value="+Pno-effective-java" />
      <compilerarg compiler="jikes" value="+Pno-shadow" />
      <compilerarg compiler="jikes" value="+Pno-switchcheck" />
    </javac>
  </target>

</project>