build.xml 18.7 KB
Newer Older
1
<project name="sat4j" default="p2">
2
         <!-- using Eclipse compiler -->
3
         
4
        <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
5
        
6 7 8 9 10 11 12 13
        <property name="testreport.dir" value="tests"/>
	<property name="build" value="bin" />
	<property name="doc" value="api" />
	<property name="target" value="jsr14"/>
        <property name="dist" value="dist"/>
        <property name="release" value="CUSTOM"/>
        <property name="tag" value="HEAD"/>
        <property name="lib" value="lib"/>
14
        <property name="next.eclipse.release.date" value="June, 2010"/>
15
	<target name="pseudo" depends="core" description="Build a jar file suitable for the PB evaluations from current source tree">
16 17 18 19 20 21 22 23 24 25 26 27
		<echo>Building Pseudo Boolean Solver</echo>
		<antcall target="build">
		   <param name="package" value="pb"/>
		   <param name="src" value="org.sat4j.pb/src/main/java" />
                   <param name="jarname" value="org.sat4j.pb"/>
		   <param name="mainclass" value="org.sat4j.pb.LanceurPseudo2007"/>
                </antcall>
                <antcall target="source-package">
                   <param name="package" value="pb"/>
		   <param name="src" value="org.sat4j.pb/src/main/java" />
                   <param name="jarname" value="org.sat4j.pb"/>
                </antcall>
28 29 30 31 32 33
                <echo>Create All-In-One auto-executable package</echo>
                <jar destfile="${dist}/${release}/sat4j-pb.jar" basedir="${build}" manifest="${build}/META-INF/MANIFEST.MF">		 
			<zipgroupfileset dir="${dist}/${release}">
                           <include name="org.sat4j.core.jar"/>
		        </zipgroupfileset>
               </jar>
34 35 36 37 38
                <antcall target="zip-bundle">
		   <param name="package" value="pb"/>
                </antcall>
	</target>

39
        <target name="maxsat" depends="pseudo" description="Build a jar file suitable for the MaxSAT evaluations from  current source tree">
40 41 42 43 44 45 46 47 48 49 50 51
		<echo>Building MAXSAT Solver</echo>
                <antcall target="build">
		   <param name="package" value="maxsat"/>
		   <param name="src" value="org.sat4j.maxsat/src/main/java" />
		   <param name="jarname" value="org.sat4j.maxsat"/>
		   <param name="mainclass" value="org.sat4j.maxsat.GenericOptLauncher"/>
		</antcall>
                <antcall target="source-package">
                   <param name="package" value="maxsat"/>
		   <param name="src" value="org.sat4j.maxsat/src/main/java" />
                   <param name="jarname" value="org.sat4j.maxsat"/>
                </antcall>
52 53 54 55 56 57 58 59 60 61
                <echo>Create All-In-One auto-executable package</echo>
                <jar destfile="${dist}/${release}/sat4j-maxsat.jar" basedir="${build}" manifest="${build}/META-INF/MANIFEST.MF">		 
			<zipgroupfileset dir="${dist}/${release}">
                           <include name="org.sat4j.core.jar"/>
			   <include name="org.sat4j.pb.jar"/>
		   </zipgroupfileset>
                   <zipgroupfileset dir="${lib}">
                           <include name="commons-cli.jar"/>
		   </zipgroupfileset>
               </jar>
62 63 64
               <antcall target="zip-bundle">
		   <param name="package" value="maxsat"/>
                </antcall>
65
	</target>
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
	<target name="multicore" depends="pseudo" description="Build a jar file with a parallel pseudo boolean solver">
		<echo>Building Parallel Pseudo Boolean Solver</echo>
                <antcall target="build">
		   <param name="package" value="multicore"/>
		   <param name="src" value="org.sat4j.multicore/src/main/java" />
		   <param name="jarname" value="org.sat4j.multicore"/>
		   <param name="mainclass" value="org.sat4j.multicore.MultiCoreLauncher"/>
		</antcall>
                <antcall target="source-package">
                   <param name="package" value="multicore"/>
		   <param name="src" value="org.sat4j.multicore/src/main/java" />
                   <param name="jarname" value="org.sat4j.multicore"/>
                </antcall>
                <echo>Create All-In-One auto-executable package</echo>
                <jar destfile="${dist}/${release}/sat4j-multicore.jar" basedir="${build}" manifest="${build}/META-INF/MANIFEST.MF">		 
			<zipgroupfileset dir="${dist}/${release}">
                           <include name="org.sat4j.core.jar"/>
			   <include name="org.sat4j.pb.jar"/>
		   </zipgroupfileset>
               </jar>
               <antcall target="zip-bundle">
		   <param name="package" value="multicore"/>
                </antcall>
	</target>
	
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
	<target name="intervalorders" depends="pseudo" description="Build the interval order agregation tool from  current source tree">
		<echo>Building Interval Order tool</echo>
                <antcall target="build">
		   <param name="package" value="intervalorders"/>
		   <param name="src" value="org.sat4j.intervalorders/src/main/java" />
		   <param name="jarname" value="org.sat4j.intervalorders"/>
		   <param name="mainclass" value="org.sat4j.intervalorders.Tester"/>
		</antcall>
                <antcall target="source-package">
                   <param name="package" value="intervalorders"/>
		   <param name="src" value="org.sat4j.intervalorders/src/main/java" />
                   <param name="jarname" value="org.sat4j.intervalorders"/>
                </antcall>
                <echo>Create All-In-One auto-executable package</echo>
                <jar destfile="${dist}/${release}/sat4j-intervalorders.jar" basedir="${build}" manifest="${build}/META-INF/MANIFEST.MF">		 
			<zipgroupfileset dir="${dist}/${release}">
                           <include name="org.sat4j.core.jar"/>
			   <include name="org.sat4j.pb.jar"/>
		   </zipgroupfileset>
               </jar>
               <antcall target="zip-bundle">
		   <param name="package" value="intervalorders"/>
                </antcall>
	</target>
116

117
	<target name="csp" depends="core" description="Build a jar file suitable for the CSP competitions from  current source tree">
118
		<echo>Building CSP Solver</echo>
119 120 121 122 123 124
		<antcall target="build">
		   <param name="package" value="csp.xmlparser"/>
		   <param name="src" value="org.sat4j.csp.xmlparser/src/main/java" />
                   <param name="jarname" value="org.sat4j.csp.xmlparser"/>
		   <param name="mainclass" value="org.sat4j.csp.CSPLauncher"/>
		</antcall>
125 126 127 128 129 130 131 132 133 134 135
                <antcall target="build">
		   <param name="package" value="csp"/>
		   <param name="src" value="org.sat4j.csp/src/main/java" />
                   <param name="jarname" value="org.sat4j.csp"/>
		   <param name="mainclass" value="org.sat4j.csp.CSPLauncher"/>
		</antcall>
                <antcall target="source-package">
                   <param name="package" value="csp"/>
		   <param name="src" value="org.sat4j.csp/src/main/java" />
                   <param name="jarname" value="org.sat4j.csp"/>
                </antcall>
136 137 138 139 140 141 142 143 144 145 146 147
                <echo>Create All-In-One auto-executable package</echo>
                <jar destfile="${dist}/${release}/sat4j-csp.jar" basedir="${build}" manifest="${build}/META-INF/MANIFEST.MF">		 
		   <zipgroupfileset dir="${dist}/${release}">
                           <include name="org.sat4j.core.jar"/>
			   <include name="org.sat4j.pb.jar"/>
			   <include name="org.sat4j.csp.jar"/>
			   <include name="org.sat4j.csp.xmlparser.jar"/>
		   </zipgroupfileset>
                   <zipgroupfileset dir="${lib}">
                           <include name="js.jar"/>
		   </zipgroupfileset>
               </jar>
148 149 150
                <antcall target="zip-bundle">
		   <param name="package" value="csp"/>
                </antcall>
151 152
	</target>

153
	<target name="sat" depends="core,pseudo" description="Build a jar file suitable for experimenting with SAT solvers from  current source tree">
154 155 156 157 158 159 160 161 162 163 164 165
		<echo>Building the Java SAT Solvers toolkit</echo>
                <antcall target="build">
		   <param name="package" value="sat"/>
		   <param name="src" value="org.sat4j.sat/src/main/java" />
                   <param name="jarname" value="org.sat4j.sat"/>
		   <param name="mainclass" value="org.sat4j.Lanceur"/>
		</antcall>
                <antcall target="source-package">
                   <param name="package" value="sat"/>
		   <param name="src" value="org.sat4j.sat/src/main/java" />
                   <param name="jarname" value="org.sat4j.sat"/>
                </antcall>
leberre's avatar
leberre committed
166 167 168 169
                <echo>Create All-In-One auto-executable package</echo>
                <jar destfile="${dist}/${release}/sat4j-sat.jar" basedir="${build}" manifest="${build}/META-INF/MANIFEST.MF">		 
		   <zipgroupfileset dir="${dist}/${release}">
                           <include name="org.sat4j.core.jar"/>
170
                           <include name="org.sat4j.pb.jar"/>
leberre's avatar
leberre committed
171 172 173 174 175
			   <include name="org.sat4j.sat.jar"/>
		   </zipgroupfileset>
                   <zipgroupfileset dir="${lib}">
                           <include name="commons-cli.jar"/>
                           <include name="commons-beanutils.jar"/>
176
                           <include name="commons-logging.jar"/>
leberre's avatar
leberre committed
177 178
		   </zipgroupfileset>
               </jar>
179 180 181
               <antcall target="zip-bundle">
		   <param name="package" value="sat4j-sat"/>
                </antcall>
182 183
	</target>

leberre's avatar
leberre committed
184
	<target name="core" depends="prepare" description="Build a jar file suitable for embedding SAT technology into a Java application from current source tree">
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
		<echo>Building core library to be embedded into Java applications</echo>
                <antcall target="build">
		   <param name="package" value="core"/>
		   <param name="src" value="org.sat4j.core/src/main/java" />
                   <param name="jarname" value="org.sat4j.core"/>
		   <param name="mainclass" value="org.sat4j.BasicLauncher"/>
		</antcall>
                <antcall target="source-package">
		   <param name="package" value="core"/>
		   <param name="src" value="org.sat4j.core/src/main/java" />
                   <param name="jarname" value="org.sat4j.core"/>
		</antcall>
                <antcall target="zip-bundle">
		   <param name="package" value="core"/>
                </antcall>
	</target>

202
	<target name="sudoku" depends="core" description="Build the sudoku demo  from current source tree">
leberre's avatar
leberre committed
203
		<echo>Building Sudoku app demo</echo>
204
		<antcall target="build">
leberre's avatar
leberre committed
205 206 207
			<param name="package" value="org.sat4j.sudoku"/>
			<param name="src" value="org.sat4j.sudoku/src/main/java"/>
                        <param name="lib" value="org.sat4j.sudoku/lib"/>
208 209 210
                        <param name="jarname" value="org.sat4j.sudoku"/>
			<param name="mainclass" value="org.sat4j.apps.sudoku.SDApplication"/>
		</antcall>
leberre's avatar
leberre committed
211 212 213 214 215 216 217 218 219 220 221
		<echo>Create All-In-One auto-executable package</echo>
                <jar destfile="${dist}/${release}/sudoku-v${BUILD_DATE}.jar" basedir="${build}" manifest="${build}/META-INF/MANIFEST.MF">		 
			<zipgroupfileset dir="${dist}/${release}">
                           <include name="org.sat4j.core.jar"/>
			   <include name="org.sat4j.sudoku.jar"/>
		   </zipgroupfileset>
		  
                   <zipgroupfileset dir="org.sat4j.sudoku/lib">
                           <include name="jlfgr-1_0.jar"/>
		   </zipgroupfileset>
               </jar>
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
	</target>

	<target name="prepare" depends="clean">
		<!-- Create the time stamp -->
                <tstamp>
                   <format property="BUILD_DATE" pattern="yyyyMMdd"/>
                </tstamp>
		<echo>Creating build and doc directories</echo>
		<mkdir dir="${build}" />
                <mkdir dir="${testreport.dir}" />
                <mkdir dir="${dist}" />
		<mkdir dir="${dist}/${release}" />
		<mkdir dir="${dist}/${release}/lib" />
		<mkdir dir="${doc}" />
		<mkdir dir="${doc}/core" />
		<mkdir dir="${doc}/sat" />
		<mkdir dir="${doc}/pb" />
		<mkdir dir="${doc}/maxsat" />
		<mkdir dir="${doc}/csp" />
	</target>

	<path id="somePath">
		<pathelement location="${build}"/>
		<fileset dir="${lib}">
246 247 248
			<include name="*src.jar"/>
		</fileset>
        <fileset dir="${lib}">
249
			<include name="*.jar"/>
250
            <exclude name="*src.jar"/>
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
		</fileset>
		<fileset dir="${dist}/${release}">
			<include name="*.jar"/>
		</fileset>
		<pathelement location="${java.home}/lib/javaws.jar"/> 
	</path>

	<target name="javadoc">
		<echo>Generating Javodoc</echo>
		<javadoc destdir="${doc}/${module}" 
				 access="public" 
				 source="1.5" 
				 use="true" 
				 notree="false" 
				 nonavbar="false" 
				 noindex="false" 
				 splitindex="true" 
				 author="true" 
				 version="true" 
				 nodeprecatedlist="false" 
				 nodeprecated="false" 
				 packagenames="org.sat4j.*,org.sat4j.spec.*,org.sat4j.core.*,org.sat4j.minisat.*,org.sat4j.minisat.core.*,org.sat4j.minisat.constraints.*,org.sat4j.minisat.constraints.cnf.*"
				 sourcepath="${module}/src" 
				 stylesheetfile="core/lib/stylesheet.css"
				 overview="${module}/src/overview.html" 
				 doctitle="SAT4J: a SATisfiability library for Java">
				 <classpath refid="somePath"/>
				<group title="User level: stable public API." packages="org.sat4j:org.sat4j.*"/>
				<group title="Developer level: internal API, subject to change." packages="org.sat4j.minisat.*:org.sat4j.reader.csp:org.sat4j.pb.*"/>

		</javadoc>
	</target>

	<target name="build" depends="prepare">
		<echo>Compiling source code ${src} using target ${target}</echo>
		<javac
		srcdir="${src}"
		destdir="${build}"
		source="1.5"
		target="${target}"
	>
			<classpath refid="somePath"/>
		</javac>
		<copy todir="${build}" failonerror="false">
			<fileset dir="${src}">
				<include name="**/*.properties"/>
				<include name="**/*.png"/>
				<include name="**/*.gif"/>
				<include name="**/*.jpg"/> 
				<include name="**/*.js"/>
				<include name="**/*.html"/>
				<include name="**/*.version"/>
				<exclude name="**/package.html"/>
				<exclude name="**/*.jpage"/>
			</fileset>
			<fileset dir="${src}/../resources">
leberre's avatar
leberre committed
307 308 309 310 311 312 313
				<include name="**/*.properties"/>
				<include name="**/*.png"/>
				<include name="**/*.gif"/>
				<include name="**/*.jpg"/> 
				<include name="**/*.js"/>
				<include name="**/*.html"/>
				<include name="**/*.version"/>
314
                                <include name="**/*.xsd"/>
315 316 317 318 319 320 321
				<include name="about.html"/>
			</fileset>
			<fileset dir="${src}/../../../">
				<include name="plugin.properties"/>
				<include name="**/*.MF"/>
			</fileset>
		</copy>
322 323 324 325
		<replace dir="${build}" token="9.9.9.token" value="${release}.v${BUILD_DATE}"><include name="**/*.MF"/></replace>
                <replace dir="${build}" token="$${version}" value="${release}.v${BUILD_DATE}"><include name="**/*.version"/></replace>
		<replace dir="${build}" token="$${version}" value="${release}"><include name="**/about.html"/></replace>
                <replace dir="${build}" token="$${next.eclipse.release.date}" value="${next.eclipse.release.date}"><include name="**/about.html"/></replace>
326
		<jar destfile="${dist}/${release}/${jarname}.jar" basedir="${build}" manifest="${build}/META-INF/MANIFEST.MF"/>
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
		<copy todir="${dist}/${release}/lib" failonerror="false">
			<fileset dir="${lib}">
				<include name="commons*.jar"/>
				<include name="jlf*.jar"/>
				<include name="csp*.jar"/>
				<include name="js.jar"/>
		    </fileset>
	       </copy>
	</target>

	<target name="source-package">
                <jar destfile="${dist}/${release}/${jarname}-src.jar" manifest="${build}/META-INF/MANIFEST.MF">
			<fileset dir="${src}">
                                <include name="**/*.java"/>
				<include name="**/*.properties"/>
				<include name="**/*.png"/>
				<include name="**/*.gif"/>
				<include name="**/*.jpg"/> 
				<include name="**/*.js"/>
				<include name="**/*.html"/>
				<include name="**/*.version"/>
				<exclude name="**/package.html"/>
				<exclude name="**/*.jpage"/>
			</fileset>
			<fileset dir="${src}/../resources">
				<include name="about.html"/>
			</fileset>
                        <fileset dir="${src}/../../../">
				<include name="plugin.properties"/>
                                <include name="build.properties"/>
                                <include name="**/*.MF"/>
			</fileset>
		</jar>	
        </target>

        <target name="zip-bundle" depends="prepare">
            <zip destfile="${dist}/${release}/sat4j-${package}-v${BUILD_DATE}.zip">
                     <fileset dir="${dist}/${release}/">
				<include name="*${package}*.jar"/>
		    </fileset>
            </zip>
        </target>
	  <target name="javadocs" description="Build all the Javadocs">
	        <antcall target="javadoc">
			<param name="module" value="core"/>
			<param name="lib" value="core/lib"/>
		</antcall>
	        <antcall target="javadoc">
			<param name="module" value="sat"/>
			<param name="lib" value="sat/lib"/>
		</antcall>
	        <antcall target="javadoc">
			<param name="module" value="pb"/>
			<param name="lib" value="pb/lib"/>
		</antcall>
	        <antcall target="javadoc">
			<param name="module" value="maxsat"/>
			<param name="lib" value="maxsat/lib"/>
		</antcall>
	        <antcall target="javadoc">
			<param name="module" value="csp"/>
			<param name="lib" value="csp/lib"/>
		</antcall>
390 391 392 393
	</target>
        <target name="tests" 
          description="Launch JUnit tests and generate a report">
		<echo>Compiling test files</echo>
394
		<javac srcdir="${test}" destdir="${build}" source="1.5" target="1.5" debug="true">
395 396 397 398 399 400 401 402 403 404 405
			<classpath refid="somePath"/>
		</javac>
		<echo>Running JUNIT tests</echo>
		<junit printsummary="yes" haltonfailure="no" fork="yes">
			<classpath refid="somePath"/>
			<formatter type="plain"/>
			<jvmarg value="-ea"/>
			<jvmarg value="-Xms500M"/>
			<jvmarg value="-Xmx500M"/>
			<jvmarg value="-Dtest.prefix=${basedir}/org.sat4j.core/src/test/testfiles/"/>
			<jvmarg value="-Dtest.pbprefix=${basedir}/org.sat4j.pb/src/test/testfiles/"/>
406

407 408
			<batchtest fork="yes" todir="${testreport.dir}">
				<fileset dir="${build}">
409
				        <include name="**/*Test*.class" />
410
					<exclude name="**/AllTests.class" />
411
					<exclude name="**/Abstract*Test*.class" />
412
					<exclude name="**/XplainTests*"/>
413
					<exclude name="**/CompetPBRes*HTMixedConstraintsObjectiveLearningTest.class"/>
414 415 416 417 418 419 420 421 422 423 424
				</fileset>
			</batchtest>
		</junit>
	</target>
	<target name="p2-tests" description="Runs tests for packages that ship with Eclipse">
		<antcall target="tests">
		   <param name="test" value="org.sat4j.core/src/test/java:org.sat4j.pb/src/test/java" />
		</antcall>
	</target>
	<target name="p2" depends="cleanrelease,core,pseudo" description="Build a release of SAT4J Core and SAT4J Pseudo to be used in Eclipse p2">
                 <echo>Built release ${release} of both SAT4J Core and SAT4J Pseudo</echo>
425 426 427 428 429 430 431 432 433 434 435 436 437
	</target>

	<target name="all" depends="cleanrelease,core,pseudo,maxsat,csp,sat,sudoku" description="Build a full release of SAT4J project">
                 <echo>Built full release ${release}</echo>
	</target>

	<target name="cleanrelease">
                 <delete dir="${dist}/${release}" />
	</target>

	<target name="clean" description="Delete build and doc directories">
		<!-- Delete the ${build} and ${doc} directory trees -->
		<delete dir="${build}" />
438
                <delete dir="${testreport.dir}"/>
439 440 441 442
		<delete dir="${doc}" />
	</target>

</project>