scons –interactive

scons –interactive is one way to speed up repeated builds.

SCons spends most of its time at three tasks

  1. Reading and parsing the SConstruct/SConscript/site_scons files. This takes about 6-10 seconds at the moment in one of our moderate-sized projects.
  2. Examining dependencies. This takes 1-20 seconds in that same project.
  3. Building targets. This can take 0-1000 seconds, depending on how much is being rebuilt.

The first one can be separated from the other two quite easily. If you do this

scons --interactive

then SCons will read all the build files, and drop you into a little shell

scons>>> build

will simply build everything. Or

scons>>> build game_client

will just build the game_client target.

Type exit to leave the shell

scons>>> exit

As long as you are not updating any build scripts themselves, you can leave a command-prompt in the scons shell, and you’ll shave seconds off each rebuild (for the project I’m working on, this is 5-10 seconds). This can be significant if you are working on a subset of the files and know it.

If you have command-line options that affect the build, you’d typically do them on the call that starts the interactive shell. For example, we have some typical options like

scons --interactive --fast --skiptests

I’ve just started doing this, so I don’t know yet if there are hidden gotchas.

The commands you can issue in interactive mode are

  • build
  • clean
  • exit
  • help
  • shell
  • version

You can use shell to run another scons, but I suggest against doing “shell scons –interactive” from inside an scons shell :)

For slightly more information, see the scons man page at http://www.scons.org/doc/production/HTML/scons-man.html.

The real goal is that naive builds are fast (that’s what I call just typing “scons”), but right now naive builds have a fairly large overhead on non-trivial projects.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>