build.xml 16.3 KB
Newer Older
1
<project name="sat4j" default="p2">
2 3
         <!-- using Eclipse compiler -->
        <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
4 5 6 7 8 9 10 11
        <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"/>
12
	<target name="pseudo" depends="core" description="Build a jar file suitable for the PB evaluations from current source tree">
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
		<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>
                <antcall target="zip-bundle">
		   <param name="package" value="pb"/>
                </antcall>
	</target>

30
        <target name="maxsat" depends="pseudo" description="Build a jar file suitable for the MaxSAT evaluations from  current source tree">
31 32 33 34 35 36 37 38 39 40 41 42
		<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>
43 44 45 46 47 48 49 50 51 52
                <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>
53 54 55
               <antcall target="zip-bundle">
		   <param name="package" value="maxsat"/>
                </antcall>
56
	</target>
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
	
	<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>
82

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

119
	<target name="sat" depends="core" description="Build a jar file suitable for experimenting with SAT solvers from  current source tree">
120 121 122 123 124 125 126 127 128 129 130 131
		<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
132 133 134 135 136 137 138 139 140 141 142
                <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"/>
			   <include name="org.sat4j.sat.jar"/>
		   </zipgroupfileset>
                   <zipgroupfileset dir="${lib}">
                           <include name="commons-cli.jar"/>
                           <include name="commons-beanutils.jar"/>
		   </zipgroupfileset>
               </jar>
143 144 145
               <antcall target="zip-bundle">
		   <param name="package" value="sat4j-sat"/>
                </antcall>
146 147
	</target>

leberre's avatar
leberre committed
148
	<target name="core" depends="prepare" description="Build a jar file suitable for embedding SAT technology into a Java application from current source tree">
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
		<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>

166
	<target name="sudoku" depends="core" description="Build the sudoku demo  from current source tree">
leberre's avatar
leberre committed
167
		<echo>Building Sudoku app demo</echo>
168
		<antcall target="build">
leberre's avatar
leberre committed
169 170 171
			<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"/>
172 173 174
                        <param name="jarname" value="org.sat4j.sudoku"/>
			<param name="mainclass" value="org.sat4j.apps.sudoku.SDApplication"/>
		</antcall>
leberre's avatar
leberre committed
175 176 177 178 179 180 181 182 183 184 185
		<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>
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 259 260 261 262 263 264 265 266
	</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}">
			<include name="*.jar"/>
		</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
267 268 269 270 271 272 273
				<include name="**/*.properties"/>
				<include name="**/*.png"/>
				<include name="**/*.gif"/>
				<include name="**/*.jpg"/> 
				<include name="**/*.js"/>
				<include name="**/*.html"/>
				<include name="**/*.version"/>
274
                                <include name="**/*.xsd"/>
275 276 277 278 279 280 281 282
				<include name="about.html"/>
			</fileset>
			<fileset dir="${src}/../../../">
				<include name="plugin.properties"/>
				<include name="**/*.MF"/>
			</fileset>
		</copy>
		<replace dir="${build}" token="9.9.9.token" value="${release}.v${BUILD_DATE}"><include name="**/*.version"/><include name="**/*.MF"/></replace>
283
		<jar destfile="${dist}/${release}/${jarname}.jar" basedir="${build}" manifest="${build}/META-INF/MANIFEST.MF"/>
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
		<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>
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
	</target>
        <target name="tests" 
          description="Launch JUnit tests and generate a report">
		<echo>Compiling test files</echo>
		<javac srcdir="${test}" destdir="${build}" source="1.5" debug="true">
			<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/"/>
363

364 365
			<batchtest fork="yes" todir="${testreport.dir}">
				<fileset dir="${build}">
366
				        <include name="**/*Test*.class" />
367 368
					<exclude name="**/AllTests.class" />
					<exclude name="**/Abstract*Test.class" />
369
					<exclude name="**/XplainTests*"/>
370 371 372 373 374 375 376 377 378 379 380
				</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>
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398
	</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}" />
                <delete dir="$testreport.dir}"/>
		<delete dir="${doc}" />
	</target>

</project>