Skip to content

Commit

Permalink
Bitwuzla: Add an option -Dbitwuzla.rebuildWrapper=on to the build scr…
Browse files Browse the repository at this point in the history
…ipt. If this option is not specified, or set to false the SWIG wrapper will not be recreated.
  • Loading branch information
daniel-raffler committed Apr 9, 2024
1 parent 3ae7860 commit 566363d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ SPDX-License-Identifier: Apache-2.0
<delete includeEmptyDirs="true">
<fileset dir="." includes="${class.dir}/** ${ivy.module}-*.jar ivy-*.xml *.so *.dll *.dylib *.jar"/>
<fileset dir="lib/native/source/libmathsat5j" includes="*.so *.dll *.o"/>
<fileset dir="${bitwuzla.path}" includes="include/ src/"/>
<fileset dir="${bitwuzla.path}" includes="bitwuzla_wrap.cpp bitwuzla_wrap.h bitwuzla_wrap.o"/>
<fileset dir="${bitwuzla.path}" includes="include/"/>
<fileset dir="${bitwuzla.path}" includes="bitwuzla_wrap.o"/>
</delete>
</target>

Expand Down
22 changes: 20 additions & 2 deletions build/build-publish-solvers/solver-bitwuzla.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ SPDX-License-Identifier: Apache-2.0

<import file="macros.xml"/>

<target name="package-bitwuzla" depends="">
<!-- Determine version and build the Bitwuzla binaries -->
<target name="build-bitwuzla">
<fail unless="bitwuzla.path">
Please specify the path to Bitwuzla with the flag -Dbitwuzla.path=/path/to/bitwuzla.
The path has to point to the root Bitwuzla folder, i.e.,
Expand Down Expand Up @@ -60,6 +61,14 @@ SPDX-License-Identifier: Apache-2.0
<arg value="install"/>
</exec>

<!-- check if -Dbitwuzla.rebuildWrapper=on was used-->
<condition property="rebuild">
<istrue value="${bitwuzla.rebuildWrapper}"/>
</condition>
</target>

<!-- Run swig to generate a new wrapper. Only executed if rebuildWrapper was specified. -->
<target name="build-wrapper" if="rebuild" depends="build-bitwuzla">
<!-- copy bitwuzla include files to the source tree -->
<delete dir="${source.path}/include" quiet="true"/>
<copy todir="${source.path}">
Expand Down Expand Up @@ -90,7 +99,17 @@ SPDX-License-Identifier: Apache-2.0
<arg value="-i"/>
<arg value="lib/native/source/libbitwuzla/phantomReferences.patch"/>
</exec>
</target>

<!-- Skip rebuilding the swig header if rebuildWrapper was not specified -->
<target name="skip-wrapper" unless="rebuild" depends="build-bitwuzla">
<echo>WARNING: Skipping the build step for the SWIG wrapper.
If the Bitwuzla API has changed since the last release the wrapper should be updated. Use
option -Dbitwuzla.rebuildWrapper to run SWIG and automatically generate a new wrapper.</echo>
</target>

<!-- Continue with the build and package everything -->
<target name="package-bitwuzla" depends="build-wrapper, skip-wrapper">
<!-- compile java proxies and create jar file -->
<mkdir dir="${source.path}/build"/>
<javac release="11" srcdir="${source.path}/src/" destdir="${source.path}/build" includeantruntime="false"
Expand Down Expand Up @@ -214,7 +233,6 @@ SPDX-License-Identifier: Apache-2.0
</exec>
</target>


<target name="publish-bitwuzla" depends="package-bitwuzla, load-ivy"
description="Publish Bitwuzla binaries to Ivy repository.">
<ivy:resolve conf="solver-bitwuzla" file="solvers_ivy_conf/ivy_bitwuzla.xml"/>
Expand Down

0 comments on commit 566363d

Please sign in to comment.