Dependencies and building apps

Are there common “build tool” type solutions to manage library dependencies (and possible build steps to bundle an application)?

Or should libraries be made into packs and installed? I guess qsave_program is the go to method to bundle an app.

Good question. First is to decide on how you want to deliver your application. Roughly, the options are

  • Source. That means you simply distribute a directory holding all code a resources. The user needs a compatible SWI-Prolog installation. Packs can be specified in the installation instructions (run swipl pack install p1 p2 ...). I typically add the packs as git submodules to the project. See for example the SWISH sources. Possibly we should add some file that defines the dependencies and is used to install required packs?

  • As a qlf file. This is nice if your application consists of only Prolog code. Also requires SWI-Prolog installed. Typically, you can create this using

    swipl qlf compile --include myapp.pl
    
  • As a saved state. The state is essentially a zip file and may contain other resources in addition to the compiled Prolog code. See resource/3. Normally created using

     swipl -o myapp -c myapp.pl
    
  • As above, including foreign code and the virtual machine. Add --stand-alone --foreign=save to the options

If you are a bit persistent, you can create a single file pure executable as well, but that is beyond the scope of this.

The choice defines on whether it is ok to demand SWI-Prolog to be installed, the OS and whether or not you want to keep your code secret.

I hope this is a start of an answer :slight_smile:

1 Like