File: build.xml

package info (click to toggle)
jenkins-htmlunit-core-js 2.6-hudson-1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch, wheezy
  • size: 5,640 kB
  • ctags: 9,833
  • sloc: java: 72,311; xml: 903; makefile: 12; sh: 10
file content (168 lines) | stat: -rw-r--r-- 7,009 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
<?xml version="1.0" encoding="UTF-8"?>

<!-- ====================================================================== 

htmlunit-core-js is a Rhino fork containing patches that haven't yet been
applied in Rhino but that are needed for HtmlUnit.

The build file ensures that no patch is kept when it is not needed anymore.

CAUTION: before to release, the rhinoDiff.txt need to be generated to respect 
the terms of the MPL.

Marc Guillemot                                                                
====================================================================== -->
<project default="default" xmlns:artifact="urn:maven-artifact-ant">
	<property name="test.classes" location="target/test-classes" />
	<property name="test.src" location="src" />
	<property name="patchedRhino.classes" location="target/rhino-patched-classes" />
	<property name="patchedRhino.src" location="rhino/src" />
	<property name="originalRhino.classes" location="target/rhino-original-classes" />
	<property name="src.test.dir" location="src" />
	<property name="junit.jar" location="/usr/share/java/junit4.jar" />
	
	<property name="version" value="2.6"/>
	<property name="jar" location="target/htmlunit-core-js-${version}.jar" />
	<property name="jar.sources" location="target/htmlunit-core-js-${version}-sources.jar" />
	
	<property name="rhino.base.date" value="20090701" description="the date of the Rhino version we take as basis. Used to generate the diff"/>
	
	<target name="default" depends="test, checkPatchNeeded">

	</target>

	<target name="compile" description="--> description">
		<mkdir dir="${patchedRhino.classes}" />
		<ant dir="rhino" antfile="src/build.xml" target="compile">
			<property name="classes" value="${patchedRhino.classes}" />
		</ant>
		<mkdir dir="${test.classes}" />
		<javac destdir='${test.classes}' debug='true' encoding="ISO-8859-1" source='1.5' target='1.5' includeAntRuntime='false'>
			<classpath>
				<pathelement location='${junit.jar}' />
				<pathelement location='${patchedRhino.classes}' />
			</classpath>
			<src path='${test.src}' />
		</javac>
	</target>

	<!-- - - - - - - - - - - - - - - - - - 
          target: depends                      
         - - - - - - - - - - - - - - - - - -->
	<target name="test" depends="compile" description="run the JUnit tests">
		<runTests rhinoClasses="${patchedRhino.classes}" rhinoVersion="patched" />
	</target>

	<macrodef name="runTests">
		<attribute name="rhinoClasses" />
		<attribute name="rhinoVersion" />
		<sequential>
			<echo message="Running tests against Rhino @{rhinoVersion} (@{rhinoClasses})" />
			<mkdir dir="target/junit" />
			<junit fork="yes">
				<jvmarg value="-Drhino=@{rhinoVersion}" />
				<classpath>
					<pathelement path="@{rhinoClasses}" />
					<pathelement path="${test.classes}" />
					<pathelement location="${junit.jar}" />
				</classpath>
				<batchtest todir="target/junit">
					<fileset dir="${src.test.dir}">
						<include name="**/*Test.java" />
					</fileset>
				</batchtest>
				<formatter type="plain" />
			</junit>
		</sequential>
	</macrodef>

	<target name="checkPatchNeeded" depends="updateRhinoOriginal" description="checks that the pb are not yet fixed in Rhino and the patches still needed">
		<mkdir dir="${originalRhino.classes}" />
		<ant dir="rhino_original/mozilla/js/rhino" antfile="src/build.xml" target="compile">
			<property name="classes" value="${originalRhino.classes}" />
		</ant>
		<runTests rhinoClasses="${originalRhino.classes}" rhinoVersion="original" />
	</target>

	<target name="updateRhinoOriginal" unless="updateRhinoOriginal.skip">
		<mkdir dir="rhino_original" />
		<cvs cvsRoot=":pserver:anonymous:anonymous@cvs-mirror.mozilla.org:/cvsroot" package="mozilla/js/rhino" dest="rhino_original" failonerror="true" />
	</target>

	<target name="generateRhinoDiff">
		<echo message="Generating diff to rhinoDiff.txt"/>
		<cvs command="diff -u -N" output="rhinoDiff.txt" dest="rhino/src" failonerror="false" />
		<echo message="Don't forget to clean the generated diff (for instance removing all lines with .svn)"/>
	</target>

	<target name="repackage" depends="compile" description="Copy org.mozilla.* to net.sourceforge.htmlunit.corejs and compiles">
		<property name="repackaged-rhino.dir" value="target/repackaged-rhino"/>
		<property name="corejs.dir" value="${repackaged-rhino.dir}/src/net/sourceforge/htmlunit/corejs"/>
		
		<mkdir dir="${corejs.dir}"/>
		<copy toDir="${corejs.dir}">
		    <fileset dir='${patchedRhino.src}/org/mozilla'>
				<include name="**/*"/>
		    </fileset>
		</copy>

		<replace dir="${corejs.dir}" token="org.mozilla" value="net.sourceforge.htmlunit.corejs"/>
		<replace dir="${corejs.dir}" token="org/mozilla" value="net/sourceforge/htmlunit/corejs"/>

		<mkdir dir='${repackaged-rhino.dir}/classes'/>
		<javac destdir='${repackaged-rhino.dir}/classes' debug='true' encoding="ISO-8859-1" source='1.5' target='1.5' includeAntRuntime='false'>
			<classpath>
				<pathelement location='${junit.jar}' />
				<pathelement location='${patchedRhino.classes}' />
			</classpath>
			<src path='${repackaged-rhino.dir}/src' />
		</javac>
		<copy toDir="${repackaged-rhino.dir}/classes">
		    <fileset dir="${repackaged-rhino.dir}/src">
				<exclude name="**/*.java"/>
		    </fileset>
		</copy>
	</target>

	<target name="jar-all" depends="repackage">
		<jar destfile="${jar.sources}">
		    <fileset dir='${repackaged-rhino.dir}/src'>
				<include name="**/*"/>
		    </fileset>
		    <fileset dir='.'>
				<include name="rhinoDiff.txt"/>
		    </fileset>
		</jar>
	 	<jar destfile="${jar}">
		    <fileset dir='${repackaged-rhino.dir}/classes' />
		    <fileset dir='.'>
				<include name="rhinoDiff.txt"/>
		    </fileset>
		</jar>
	</target>

	<target name="deploy-snapshot" depends="jar-all" description="Deploys a snapshot to HTMLUnit snapshot repository">
		<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.0.8.jar" />
		<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"
			classpathref="maven-ant-tasks.classpath" />
		<artifact:pom id="maven.project" file="pom.xml" />
		<artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-2"/>
		<artifact:deploy file="${jar}">
			<pom refid="maven.project"/>
			<attach file="${jar.sources}" classifier="sources" /> 
		</artifact:deploy>
	</target>

	<target name="deploy-mvn-local" depends="jar-all" description="Deploys jars to a local folder">
		<echo message="Deploying locally to ${deploy-mvn-local.dir}"/>
		<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.0.8.jar" />
		<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"
			classpathref="maven-ant-tasks.classpath" />
		<artifact:pom id="maven.project" file="pom.xml" />
		<artifact:deploy file="${jar}">
			<pom refid="maven.project"/>
			<remoteRepository url="file://${deploy-mvn-local.dir}"/>
			<attach file="${jar.sources}" classifier="sources" /> 
		</artifact:deploy>
	</target>
</project>