build.xml 19.6 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
        <!--
5
        <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
6
        --> 
7 8 9
        <property name="testreport.dir" value="tests"/>
	<property name="build" value="bin" />
	<property name="doc" value="api" />
10
	<property name="target" value="1.5"/>
11 12 13 14
        <property name="dist" value="dist"/>
        <property name="release" value="CUSTOM"/>
        <property name="tag" value="HEAD"/>
        <property name="lib" value="lib"/>
15
        <property name="next.eclipse.release.date" value="June, 2010"/>
16
	<target name="pseudo" depends="core" description="Build a jar file suitable for the PB evaluations from current source tree">
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"/>
                </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
		<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>
51 52 53 54 55 56 57 58 59 60
                <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>
61 62 63
               <antcall target="zip-bundle">
		   <param name="package" value="maxsat"/>
                </antcall>
64
	</target>
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
	
	<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>
89

90
	<target name="csp" depends="core" description="Build a jar file suitable for the CSP competitions from  current source tree">
91
		<echo>Building CSP Solver</echo>
92 93 94 95 96
		<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>
97 98 99 100 101 102 103 104 105 106 107
                <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>
108 109 110 111 112 113 114 115 116 117 118 119
                <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>
120 121 122
                <antcall target="zip-bundle">
		   <param name="package" value="csp"/>
                </antcall>
123 124
	</target>

125
	<target name="sat" depends="core,pseudo,maxsat" description="Build a jar file suitable for experimenting with SAT solvers from  current source tree">
126 127 128 129 130 131 132 133 134 135 136
		<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>
137 138 139 140
                <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"/>
141
                           <include name="org.sat4j.pb.jar"/>
142 143 144 145 146
			   <include name="org.sat4j.sat.jar"/>
		   </zipgroupfileset>
                   <zipgroupfileset dir="${lib}">
                           <include name="commons-cli.jar"/>
                           <include name="commons-beanutils.jar"/>
147
                           <include name="commons-logging.jar"/>
148
                           <include name="jchart2d.jar"/>
149 150
		   </zipgroupfileset>
               </jar>
151 152 153
               <antcall target="zip-bundle">
		   <param name="package" value="sat4j-sat"/>
                </antcall>
154 155
	</target>

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
	<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"/>
                                <attribute name="Main-Class" value="org.sat4j.sat.LaunchRemoteControl"/>
                       </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>
    
187
	<target name="core" depends="prepare" description="Build a jar file suitable for embedding SAT technology into a Java application from current source tree">
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
		<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
203 204 205 206 207 208 209 210
	
	<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>
211 212
		<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
213 214 215 216 217 218
                       <manifest>
                                <attribute name="Built-By" value="Daniel Le Berre"/>
                                <attribute name="Main-Class" value="org.sat4j.MUSLauncher"/>
                       </manifest>
                 </jar>
	</target>
219

220
	<target name="sudoku" depends="core" description="Build the sudoku demo  from current source tree">
221
		<echo>Building Sudoku app demo</echo>
222
		<antcall target="build">
223 224 225
			<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"/>
226 227 228
                        <param name="jarname" value="org.sat4j.sudoku"/>
			<param name="mainclass" value="org.sat4j.apps.sudoku.SDApplication"/>
		</antcall>
229 230 231 232 233 234 235 236 237 238 239
		<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>
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
	</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}">
264 265 266
			<include name="*src.jar"/>
		</fileset>
        <fileset dir="${lib}">
267
			<include name="*.jar"/>
268
            <exclude name="*src.jar"/>
269 270 271 272 273 274 275 276 277 278 279
		</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" 
280
				 source="1.6" 
281 282 283 284 285 286 287 288 289 290
				 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.*"
291 292 293
				 sourcepath="${module}/src/main/java" 
				 stylesheetfile="stylesheet.css"
				 overview="${module}/src/main/java/overview.html" 
294 295 296 297 298 299 300 301 302 303 304 305 306 307
				 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}"
308
	        includeantruntime="false">
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
			<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">
324 325 326 327 328 329 330
				<include name="**/*.properties"/>
				<include name="**/*.png"/>
				<include name="**/*.gif"/>
				<include name="**/*.jpg"/> 
				<include name="**/*.js"/>
				<include name="**/*.html"/>
				<include name="**/*.version"/>
331
                                <include name="**/*.xsd"/>
332 333 334 335 336 337 338
				<include name="about.html"/>
			</fileset>
			<fileset dir="${src}/../../../">
				<include name="plugin.properties"/>
				<include name="**/*.MF"/>
			</fileset>
		</copy>
339 340 341 342
		<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>
343
		<jar destfile="${dist}/${release}/${jarname}.jar" basedir="${build}" manifest="${build}/META-INF/MANIFEST.MF"/>
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 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
		<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>
407 408 409 410
	</target>
        <target name="tests" 
          description="Launch JUnit tests and generate a report">
		<echo>Compiling test files</echo>
411
		<javac srcdir="${test}" destdir="${build}" source="1.5" target="1.5" debug="true">
412 413 414 415 416 417 418 419 420 421 422
			<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/"/>
423

424 425
			<batchtest fork="yes" todir="${testreport.dir}">
				<fileset dir="${build}">
426
				        <include name="**/*Test*.class" />
427
					<exclude name="**/AllTests.class" />
428
					<exclude name="**/Abstract*Test*.class" />
429
					<exclude name="**/XplainTests*"/>
430
					<exclude name="**/CompetPBRes*HTMixedConstraintsObjectiveLearningTest.class"/>
431 432 433 434 435 436 437 438 439 440 441
				</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>
442 443 444 445 446 447 448 449 450 451 452 453 454
	</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}" />
455
                <delete dir="${testreport.dir}"/>
456 457 458 459
		<delete dir="${doc}" />
	</target>

</project>