File: build.xml

package info (click to toggle)
plm 2.6%2Brepack-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 15,000 kB
  • ctags: 6,149
  • sloc: java: 34,456; ansic: 4,070; python: 2,576; xml: 191; perl: 150; makefile: 42; sh: 16
file content (258 lines) | stat: -rw-r--r-- 12,078 bytes parent folder | download
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<?xml version="1.0" encoding="UTF-8"?>
<project default="dist" name="PLM">
	
    <!-- load ChangeLog and set property plm.minor.version accordingly -->
    <loadfile property="plm.minor.version" srcFile="ChangeLog">
        <filterchain>
            <linecontainsregexp>
              <regexp pattern="[0-9]+:.*"/>
            </linecontainsregexp>          
          <headfilter lines="1"/>
          <striplinebreaks/>
          <tokenfilter>
	    <replaceregex pattern=":.*" replace=""/>
	  </tokenfilter>
        </filterchain>
    </loadfile>
    
    <loadfile property="plm.major.version" srcFile="lib/resources/plm.configuration.properties">
        <filterchain>
            <linecontainsregexp>
              <regexp pattern="plm.major.version=.*"/>
            </linecontainsregexp>          
          <headfilter lines="1"/>
          <striplinebreaks/>
          <tokenfilter>
	    <replacestring from="plm.major.version=" to=""/>
	  </tokenfilter>
        </filterchain>
    </loadfile>
    
    <property name="base.dir" value="."/>
    <property name="dist.dir" value="${base.dir}/dist"/>
    <property name="lib.dir" value="${base.dir}/lib"/>
    <property name="src.dir" value="${base.dir}/src"/>
    <property name="site.dir" value="${base.dir}/site"/>
    <property name="classes.dir" value="${site.dir}/bin"/>

    <property file="${base.dir}/keystore.properties"/>

    <path id="project.class.path">
            <pathelement path="${classes.dir}"/>
        <pathelement location="/usr/share/scala/lib/scala-compiler.jar" />
        <pathelement location="/usr/share/scala/lib/scala-library.jar" />
        <pathelement location="/usr/share/scala/lib/scala-reflect.jar" />
            <pathelement location="/usr/share/java/gettext-commons.jar" />
            <pathelement location="/usr/share/java/org.eclipse.jgit.jar" />
            <pathelement location="/usr/share/java/miglayout.jar" />
	    <pathelement location="/usr/share/java/rsyntaxtextarea.jar" />
	    <pathelement location="/usr/share/java/json-simple.jar" />
            <pathelement location="/usr/share/java/httpclient.jar" />
	    <pathelement location="/usr/share/java/httpcore.jar" />
	    <pathelement location="/usr/share/java/jython.jar" />
	    <pathelement location="/usr/share/java/junit4.jar" />
	    <pathelement location="/usr/share/java/mockito-core.jar" />
            <fileset dir="${lib.dir}">
                    <include name="**/*.jar"/>                      
            </fileset>      
    </path>

    <target name="clean" description="clean project">
        <delete dir="${site.dir}/lib"/>
        <delete dir="${site.dir}/po"/>
        <delete dir="${site.dir}/bin"/>
    </target>

    <taskdef name="scalac"
             classname="scala.tools.ant.Scalac">
      <classpath>
        <pathelement location="/usr/share/scala/lib/scala-compiler.jar" />
        <pathelement location="/usr/share/scala/lib/scala-library.jar" />
        <pathelement location="/usr/share/scala/lib/scala-reflect.jar" />
      </classpath>
    </taskdef>
	
    <target name="compile" description="compile all source files">
        <mkdir dir="${classes.dir}"/>
        <scalac classpathref="project.class.path" destdir="${classes.dir}" srcdir="${src.dir}" />
        <javac classpathref="project.class.path" destdir="${classes.dir}" srcdir="${src.dir}" includeantruntime="false" fork="true" encoding="UTF8"/>
    </target>    
    
    <target name="dist" depends="clean, i18n-generate-jar, compile, updateversion" description="build a standalone application jar file">
        <jar destfile="plm.jar">
            <manifest>
                <attribute name="Built-By" value="M. Quinson, G. Oster and others" />
                <attribute name="Main-Class" value="plm.core.ui.ProgrammersLearningMachine" />
                <attribute name="Class-Path" value="." />
            </manifest>
            <fileset dir="${classes.dir}" excludes="**/.gitignore **/*.java **/*.css **/*.html"/>
            <fileset dir="${src.dir}" includes="**/*.py **/*.c **/*.scala **/*.java **/*.html **/*.css **/*.png **/*.map" excludes="**/.gitignore"/>
            <fileset dir="${base.dir}" includes="img/*/*.png img/*.png" excludes="*"/>
            <fileset dir="${base.dir}" includes="ChangeLog" />
            <fileset dir="${lib.dir}" excludes="**/*.jar *.pl l10n/missions/* l10n/engine/*"/>
<!--
            <zipfileset excludes="META-INF/*.SF" src="${lib.dir}/tools-openjdk7.jar" />
                        
            <zipfileset excludes="META-INF/*.SF" src="${lib.dir}/scala/scala-compiler-2.11.4.jar"/>
-->
            <zipfileset excludes="META-INF/*.SF" src="${lib.dir}/plm-messages.jar" />
            
        </jar>
    </target>
    
    <target name="dist-web" depends="compile, updateversion" description="build webstart application jar files">
        <mkdir dir="${site.dir}/lib"/>
        <jar destfile="${site.dir}/lib/plm-webstart.jar" filesetmanifest="mergewithoutmain">
            <manifest>
                <attribute name="Built-By" value="M. Quinson and G. Oster" />
                <attribute name="Main-Class" value="plm.ui.ProgrammersLearningMachine" />
                <attribute name="Class-Path" value="." />
            </manifest>
            <fileset dir="${classes.dir}" excludes="**/.gitignore **/*.java **/*.css **/*.html"/>
            <fileset dir="${src.dir}" includes="**/*.java **/*.py **/*.html **/*.css **/*.map **/*.png" excludes="**/.gitignore"/> 
            <fileset dir="${base.dir}" includes="img/*/*.png img/*.png" excludes="*"/>
            <fileset dir="${lib.dir}" excludes="*.jar"/>
        </jar>
        <copy todir="${site.dir}/lib">
            <fileset dir="${lib.dir}">
                <include name="*.jar"/>
            </fileset>
        </copy>
        <signjar alias="${keystore.alias}" keystore="${keystore.file}" storepass="${keystore.passwd}" lazy="true">
          <path>
            <fileset dir="${site.dir}/lib" includes="**/*.jar" />
          </path>
        </signjar>
    </target>
    
    <target name="javadoc" description="Create Javadocs">
        <mkdir dir="${site.dir}/javadoc/"/>
        <javadoc 
            destdir="${site.dir}/javadoc/">
            <fileset dir="${src.dir}/plm" includes="**/*.java" />
            <fileset dir="${src.dir}/lessons" includes="**/*.java" />
        </javadoc>
    </target>

    <target name="updateversion" description="Update the version number in the properties file">
      <propertyfile file="${lib.dir}/resources/plm.configuration.properties">
        <entry key="plm.minor.version" value="${plm.minor.version}" operation="="/>
      </propertyfile>
    </target>

    <property name="gettexttasks.jar" value="/usr/share/java/gettext-ant-tasks.jar"/>
    <target name="i18n-init" description="Loads the Ant gettext tasks">
      <taskdef name="gettext-extract" classname="org.xnap.commons.ant.gettext.GettextExtractKeysTask" classpath="${gettexttasks.jar}"/>
      <taskdef name="gettext-merge"   classname="org.xnap.commons.ant.gettext.GettextMergeKeysTask"   classpath="${gettexttasks.jar}"/>
      <taskdef name="gettext-generate-default" classname="org.xnap.commons.ant.gettext.GenerateDefaultBundleTask" classpath="${gettexttasks.jar}"/>
      <taskdef name="gettext-dist"    classname="org.xnap.commons.ant.gettext.GettextDistTask"        classpath="${gettexttasks.jar}"/>
    </target>
    <target name="i18n-extract" description="Extracts message keys from the source code" depends="i18n-init">
      <gettext-extract keysFile="plm.pot" poDirectory="l10n/engine">
        <fileset dir="${src.dir}" includes="**/*.java"/>
      </gettext-extract>
    </target>
    <target name="i18n-update" description="Merges newly extracted messages into existing po files" depends="i18n-extract">
      <gettext-merge keysFile="plm.pot" poDirectory="l10n/engine"/>
    </target>
    <target name="i18n-check" description="Checks that the extracted messages are correct" depends="i18n-update">
      <!-- single quote sign is used to escape the format strings in MessageFormat;
           '' has to be used to get a single quote displayed. 
	   That's unfortunate given the amount of ' we have in french and english but anyway.
	   In addition, the strings without {0} are not passed to MessageFormat by i18n.tr().
	   See: https://code.google.com/p/gettext-commons/issues/detail?id=55 

           Rq: check that a word does not appear in translations:
           msggrep -T -e  theworld  - -sort-by-file  l10n/missions/fr.po
	   -->
      <exec executable="msggrep">
           <arg value="-K"/>
	   <arg value="-e"/>
	   <arg value="[^']'[^'].*{"/>
	   <arg value="--sort-by-file"/>
	   <arg value="l10n/engine/fr.po"/>
	   <redirector output="errors-msgid.txt" alwayslog="true"/>           
      </exec>
      <exec executable="msggrep">
           <arg value="-T"/>
	   <arg value="-e"/>
	   <arg value="[^']'[^'].*{"/>
	   <arg value="--sort-by-file"/>
	   <arg value="l10n/engine/fr.po"/>
	   <redirector output="errors-msgstr.txt" alwayslog="true"/>           
      </exec>
      <exec executable="./check_pseudoMD.pl" />
    </target>
    
    <target name="i18n-generate-jar" description="Generates Java ResourceBundles and jars them up" depends="i18n-update, i18n-check">
      <mkdir dir="${site.dir}/po"/>
      <gettext-dist targetBundle="org.plm.i18n.Messages" poDirectory="l10n/engine" outputDirectory="${site.dir}/po" />
      <jar destfile="lib/plm-messages.jar" basedir="${site.dir}/po" includes="org/**"/>
      <delete dir="${site.dir}/po"/>
    </target>

    <target name="test-all-exos" depends="compile" description="tests compilation of provided solutions of all exos">
	  <junit haltonfailure="true" haltonerror="true" printsummary="withOutAndErr" fork="yes">		
		<classpath refid="project.class.path"/>
		<formatter type="plain"/>
        <test name="plm.core.ExoTest"/>		
	  </junit>
    </target>

    <target name="all-tests" depends="compile" description="launch all tests">
	  <junit haltonfailure="true" haltonerror="true" printsummary="withOutAndErr" fork="yes">		
		<classpath refid="project.class.path"/>
		<formatter type="plain"/>
        <test name="plm.test.AllTests"/>		
	  </junit>
    </target>
	
    <target name="unit-tests" depends="compile" description="launch all unit tests">
	  <junit printsummary="withOutAndErr" fork="yes">		
		<classpath refid="project.class.path"/>
		<formatter type="plain"/>
        <test name="plm.test.UnitTests"/>		
	  </junit>
    </target>
	
    <target name="integration-tests" depends="compile" description="launch all integration tests">
	  <junit haltonfailure="true" haltonerror="true" printsummary="withOutAndErr" fork="yes">		
		<classpath refid="project.class.path"/>
		<formatter type="plain"/>
        <test name="plm.test.IntegrationTests"/>		
	  </junit>
    </target>
	
<!--  This requires Java7 to work, but I'd prefer to support for Java6
      a bit longer if possible. Disable this for now, sorry Franck.
      
      
      
    <property name="mac.dir" value="${lib.dir}/mac-resources"/>
    <property name="fr.lproj.dir" value="${mac.dir}/fr.lproj"/>
    <property name="mac.app.name" value="JavaLearningMachine"/>
    <property name="mac.bundle.dir" value="${dist.dir}/${mac.app.name}.app"/>

    <taskdef name="bundleapp"
             classname="com.oracle.appbundler.AppBundlerTask"   
             classpath="${lib.dir}/appbundler-1.0.jar" />

    <target name="build-Mac.app-bundle">
        <bundleapp outputdirectory="dist"
            name="${mac.app.name}"
            displayname="Java Learning Machine"
            identifier="plm.core.ui.JavaLearningMachine"
            mainclassname="plm.core.ui.JavaLearningMachine"
			icon="${mac.dir}/PLM.icns">
            <classpath file="dist/plm-${plm.minor.version}.jar" />
        </bundleapp>
		<copy todir="${mac.bundle.dir}/Contents/Resources/fr.lproj">
			<fileset dir="${fr.lproj.dir}"/>
		</copy>
    </target>
	
	
	<target name="Mac.app" depends="dist, build-Mac.app-bundle">
	</target>
-->	
</project>