build.xml 20.8 KB
Newer Older
1
<project name="sat4j" default="p2">
2
         <!-- using Eclipse compiler -->
Daniel Le Berre's avatar
Daniel Le Berre committed
3
         <!-- COMMENT THAT LINE IF YOU WANT TO USE DEFAULT JDK COMPILER -->        
4
        <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
5 6 7
        <property name="testreport.dir" value="tests"/>
	<property name="build" value="bin" />
	<property name="doc" value="api" />
8
	<property name="target" value="1.5"/>
9 10 11 12
        <property name="dist" value="dist"/>
        <property name="release" value="CUSTOM"/>
        <property name="tag" value="HEAD"/>
        <property name="lib" value="lib"/>
13
        <property name="next.eclipse.release.date" value="June, 2010"/>
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
	<target name="br4cp" depends="core" description="Build a jar file for the BR4CP French ANR from the source tree">
		<echo>Building BR4CP tool</echo>
		<antcall target="build">
		   <param name="package" value="br4cp"/>
		   <param name="src" value="org.sat4j.br4cp/src/main/java" />
                   <param name="jarname" value="org.sat4j.br4cp"/>
                </antcall>
                <antcall target="source-package">
                   <param name="package" value="br4cp"/>
		   <param name="src" value="org.sat4j.br4cp/src/main/java" />
                   <param name="jarname" value="org.sat4j.br4cp"/>
                </antcall>
                <echo>Create All-In-One auto-executable package</echo>
                <jar destfile="${dist}/${release}/sat4j-br4cp.jar" basedir="${build}" manifest="${build}/META-INF/MANIFEST.MF">		 
			<zipgroupfileset dir="${dist}/${release}">
29 30
				<include name="org.sat4j.core.jar"/>
				<include name="org.sat4j.pb.jar"/>
31 32 33 34 35 36
		        </zipgroupfileset>
               </jar>
                <antcall target="zip-bundle">
		   <param name="package" value="br4cp"/>
                </antcall>
	</target>
37
	<target name="pseudo" depends="core" description="Build a jar file suitable for the PB evaluations from current source tree">
38 39 40 41 42 43 44 45 46 47 48
		<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"/>
                </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>
49 50 51 52 53 54
                <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>
55 56 57 58 59
                <antcall target="zip-bundle">
		   <param name="package" value="pb"/>
                </antcall>
	</target>

60
        <target name="maxsat" depends="pseudo" description="Build a jar file suitable for the MaxSAT evaluations from  current source tree">
61 62 63 64 65 66 67 68 69 70 71
		<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"/>
		</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>
72 73 74 75 76 77 78 79 80 81
                <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>
82 83 84
               <antcall target="zip-bundle">
		   <param name="package" value="maxsat"/>
                </antcall>
85
	</target>
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
	
	<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"/>
		</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>
110

111
	<target name="csp" depends="core" description="Build a jar file suitable for the CSP competitions from  current source tree">
112
		<echo>Building CSP Solver</echo>
113 114 115 116 117
		<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"/>
		</antcall>
118 119 120 121 122 123 124 125 126 127 128
                <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>
129 130 131 132 133 134 135 136 137 138 139 140
                <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>
141 142 143
                <antcall target="zip-bundle">
		   <param name="package" value="csp"/>
                </antcall>
144 145
	</target>

146
	<target name="sat" depends="core,pseudo,maxsat" description="Build a jar file suitable for experimenting with SAT solvers from  current source tree">
147 148 149 150 151 152 153 154 155 156 157
		<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"/>
		</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>
158 159 160 161
                <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"/>
162
                           <include name="org.sat4j.pb.jar"/>
163
                           <include name="org.sat4j.maxsat.jar"/>
164 165 166 167 168
			   <include name="org.sat4j.sat.jar"/>
		   </zipgroupfileset>
                   <zipgroupfileset dir="${lib}">
                           <include name="commons-cli.jar"/>
                           <include name="commons-beanutils.jar"/>
169
                           <include name="commons-logging.jar"/>
170
                           <include name="jchart2d.jar"/>
171 172
		   </zipgroupfileset>
               </jar>
173 174 175
               <antcall target="zip-bundle">
		   <param name="package" value="sat4j-sat"/>
                </antcall>
176 177
	</target>

178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
	<target name="remote" depends="core,pseudo" description="Build a jar file suitable for build the incredible sat4j remote control">
		<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"/>
		</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>
                <echo>Create All-In-One auto-executable package</echo>
                <jar destfile="${dist}/${release}/sat4j-remotecontrol.jar" basedir="${build}">
                       <manifest>
                                <attribute name="Built-By" value="Stephanie Roussel"/>
194
                                <attribute name="Main-Class" value="org.sat4j.sat.Launcher"/>
195 196 197 198 199 200 201 202 203 204 205 206 207 208
                       </manifest>
		   <zipgroupfileset dir="${dist}/${release}">
                           <include name="org.sat4j.core.jar"/>
                           <include name="org.sat4j.pb.jar"/>
			   <include name="org.sat4j.sat.jar"/>
		   </zipgroupfileset>
                   <zipgroupfileset dir="${lib}">
                           <include name="commons-cli.jar"/>
                           <include name="commons-beanutils.jar"/>
                           <include name="commons-logging.jar"/>
		   </zipgroupfileset>
               </jar>
	</target>
    
209
	<target name="core" depends="prepare" description="Build a jar file suitable for embedding SAT technology into a Java application from current source tree">
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
		<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"/>
		</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>
Daniel Le Berre's avatar
Daniel Le Berre committed
225 226 227 228 229 230 231 232
	
	<target name="mus" depends="prepare" description="Build a jar file for MUS solver">
		<echo>Building MUS solver</echo>
                <antcall target="build">
		   <param name="package" value="core"/>
		   <param name="src" value="org.sat4j.core/src/main/java" />
                   <param name="jarname" value="sat4j-mus"/>
		</antcall>
233 234
		<delete file="${dist}/${release}/sat4j-mus.jar"/>
		<jar destfile="${dist}/${release}/sat4j-mus-v${BUILD_DATE}.jar" basedir="${build}">                        
Daniel Le Berre's avatar
Daniel Le Berre committed
235 236 237 238 239 240
                       <manifest>
                                <attribute name="Built-By" value="Daniel Le Berre"/>
                                <attribute name="Main-Class" value="org.sat4j.MUSLauncher"/>
                       </manifest>
                 </jar>
	</target>
241

242
	<target name="sudoku" depends="core" description="Build the sudoku demo  from current source tree">
243
		<echo>Building Sudoku app demo</echo>
244
		<antcall target="build">
245 246 247
			<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"/>
248 249 250
                        <param name="jarname" value="org.sat4j.sudoku"/>
			<param name="mainclass" value="org.sat4j.apps.sudoku.SDApplication"/>
		</antcall>
251 252 253 254 255 256 257 258 259 260 261
		<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>
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
	</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}">
286 287 288
			<include name="*src.jar"/>
		</fileset>
        <fileset dir="${lib}">
289
			<include name="*.jar"/>
290
            <exclude name="*src.jar"/>
291 292 293 294 295 296 297 298 299 300 301
		</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" 
302
				 source="1.6" 
303 304 305 306 307 308 309 310 311 312
				 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.*"
313 314 315
				 sourcepath="${module}/src/main/java" 
				 stylesheetfile="stylesheet.css"
				 overview="${module}/src/main/java/overview.html" 
316 317 318 319 320 321 322 323 324 325 326 327 328 329
				 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}"
Daniel Le Berre's avatar
Daniel Le Berre committed
330
		debug="true"
331
	        includeantruntime="false">
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
			<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">
347 348 349 350 351 352 353
				<include name="**/*.properties"/>
				<include name="**/*.png"/>
				<include name="**/*.gif"/>
				<include name="**/*.jpg"/> 
				<include name="**/*.js"/>
				<include name="**/*.html"/>
				<include name="**/*.version"/>
354
                                <include name="**/*.xsd"/>
355 356 357 358 359 360 361
				<include name="about.html"/>
			</fileset>
			<fileset dir="${src}/../../../">
				<include name="plugin.properties"/>
				<include name="**/*.MF"/>
			</fileset>
		</copy>
362 363 364 365
		<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>
366
		<jar destfile="${dist}/${release}/${jarname}.jar" basedir="${build}" manifest="${build}/META-INF/MANIFEST.MF"/>
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
		<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>
430 431 432 433
	</target>
        <target name="tests" 
          description="Launch JUnit tests and generate a report">
		<echo>Compiling test files</echo>
434
		<javac srcdir="${test}" destdir="${build}" source="1.5" target="1.5" debug="true">
435 436 437 438 439 440 441 442 443 444 445
			<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/"/>
446

447 448
			<batchtest fork="yes" todir="${testreport.dir}">
				<fileset dir="${build}">
449 450
					<include name="**/*Test*.class" />
					<include name="**/*Bug*.class" />
451
					<exclude name="**/AllTests.class" />
452
					<exclude name="**/Abstract*Test*.class" />
453
					<exclude name="**/XplainTests*"/>
454
					<exclude name="**/CompetPBRes*HTMixedConstraintsObjectiveLearningTest.class"/>
455 456 457 458 459 460 461 462 463 464 465
				</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>
466 467 468 469 470 471 472 473 474 475 476 477 478
	</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}" />
479
                <delete dir="${testreport.dir}"/>
480 481 482 483
		<delete dir="${doc}" />
	</target>

</project>