Skip to content
Eric Merritt edited this page Dec 28, 2011 · 4 revisions

Build Hooks

Sinan provides a mechanism to integrate with external tools. This is via the hooks functionality. This functionality is used by putting a directory called '_hooks' in the root of your project. Inside this directory you place executable files that implement the functionality you want to run. When these files are run is determined by there name. The are named in the form of <when>-<task>. The when is may be one of two values, either 'pre' or 'post'. The task is the name of the task you want the thing to run around. For example, if you wanted something to run just after the build task is complete you would create a file called 'post-build' and make it executable. This file will then be run (in the context of the root directory) immediately after the build task and before any other tasks or run. A file called 'pre-build' would do just the opposite, running immediately before the build task.

Having the ability to run these files at specific times is good. However, without getting some information from sinan its not terribly useful. Fortunately, there is a mechanism for getting this information. Sinan passes it to the running script via environmental variables. There are two sets of environmental variables that are passed. The first is the global information about the project. These variables are available as follows.

SIN_RELEASE : The name of the release sinan is building

SIN_RELEASE_VSN : The version of the release sinan is building

SIN_BUILD_ROOT : The root of the build dir sinan is using

SIN_BUILD_DIR : The actually release ready build dir sinan is using

SIN_APPS_DIR : The build location of the apps, usually <BUILD_DIR>/lib

SIN_RELEASE_DIR : The directory into which release artifacts will be built

SIN_HOME_DIR : The users home directory that sinan is using

SIN_PROJECT_DIR : The root directory for the project sinan is building

For each application in the project

SIN__VSN : The version for that application

SIN__DIR : The directory into which sinan will build

Clone this wiki locally