Tool to output git revision info to a file, similar to SVN $keywords$.
gitrev [commands]
Commands: (executed in order specified on commandline)
--path
Output current git repo root path
-f|--format "formatstring"
Specify format string to use for output
-e|--echo
Evaluate current format and output to stdout
-d|--delimiter "begin:end"
Specify colon-separated begin and end markers for file insert mode
-i|--insert "filename"
Evaluate current format and replace part between delimiters in file
$root$: Repository root path$branch$: current branch, i.e.heads/master$hash$: full hash of current commit$hash6$: short hash of current commit$mod$: repository modified state, either empty or(modified)$svnrev$: forgit-svn: SVN revision of the most recent commit with agit-svn-id$time$: ISO-8601 timestamp (local time)$timeutc$: ISO-8601 timestamp (UTC)
Default format string is:
$branch$ $hash6$ $mod$ $timeutc$
Inserting text into files needs a delimiter. Start and end-marker are delimited by a :. If there is no : in the string given, both are assumed to be the same. The default delimiter for git_rev.pas.sample is:
{REV}':'{/REV}
Everything between those two strings on the same line is replaced with the evaluated format string.
Tool to automate build/release processes, similar to what could be achieved with makefiles, but more integrated.
buildutil.exe [options] [TASK]
Task: begin building at [TASK], otherwise starts at [*MAIN*]
Options:
-f|--file "FILENAME"
Read Buildfile from FILENAME, defaults to Buildfile
-s|--suppress "TASK[,TASK]"
Do not execute TASKs, assume succeeded
Buildfiles are structured in INI-style sections. Each section describes a single Task to be performed by a Tool, or a series of Task names to invoke. Tasks are executed in the order they are specified. If any Task fails (this includes nonzero exit codes of external programs), the entire process will be aborted.
Before a Task is executed, variables in the section content (including CMD scripts) are replaced with their current values. Variables are written like so: ${VARIABLE}. VARIABLE may be:
- A valid variable name (any alphanumeric character as well as the underscore):
- if the variable is defined, return the value of the variable
- otherwise, return the empty string
- Any other content will be examined as a function call
${FUNC ARGV}- If the function and arguments are valid, return result of the function
- otherwise, return unparsed VARIABLE
Functions syntax is heavily inspired by GNU Make, although only a subset is implemented here. Functions are always a one-word function name followed by a space character followed by one or more comma-separated arguments. Arguments may contain variable and function references again, but only if not more than the top contain comma-delimited arguments. Example:
Valid:
${subst dir,dir2,${realpath ${TOOLPATH}}}
Not Valid:
${subst dir,dir2,${subst my,other,${TOOLPATH}}}
Functions are:
-
Text Functions
Function Description ${upper TEXT}Returns TEXT in uppercase ${lower TEXT}Returns TEXT in lowercase ${subst FROM,TO,TEXT}Replace all occurences of FROM in TEXT with TO -
Variable Functions
Function Description ${defined NAME}return 1 if NAME is defined and nonempty, 0 otherwise -
File Name Functions
Function Description ${dir FNAME}Returns the directory part of FNAME, including backslash, or ./if FNAME contains no directory${notdir FNAME}Returns only the filename part of FNAME, without any directory ${suffix FNAME}Returns only the extension part of FNAME, or the empty string if FNAME has no extension ${basename FNAME}Returns FNAME without extension, but including path names ${realpath FNAME}Returns FNAME expanded relative to the current directory -
Shell Function
Function Description ${shell COMMAND}Executes COMMAND in a subshell and returns the output, lines concatenated by spaces. COMMAND may include arbitrary spaces and commas. The result code is stored in the _SHELLSTATUS variable.
Task lists are Tasks that only invoke other Tasks. Usually, the main Task is a task list. Task lists are defined by having a section contain no Tool specifier and a single tasks item:
[*MAIN*]
tasks=build,makearchive
All items except TASKS= will be treated as if they were passed to the env Tool, that is, set/clear environment variables. Any variable modified in this way is restored after executing all referenced tasks.
If a Task contains a Tool specifier (which must be given as the first item), this tool is invoked.
-
cmd: Run a shell scriptAll remaining lines in the task are executed as a shell script
-
powershell: Run a Windows PowerShell scriptAll remaining lines in the task are executed as a PowerShell script (as if dot-sourced) with ExecutionPolicy RemoteSigned (so you may call further scripts)
-
lazbuild: invoke LazBuild (global:PROGRAM_LAZBUILD)Call Lazbuild to build a Lazarus project.
PROJECT= Required, .lpi file name MODE= Optional, build mode BUILD=default Optional, build depth. Allowed values: DEFAULT: only build what is needed CLEAN : re-build project ALL : re-build project and all dependencies OPTS= Optional, additional call arguments -
lazversion: Modify version informationModifies version information in Lazarus project file (LPI). Version information must be active (UseVersionInfo=true) in the PROJECT given. Backups of original files will be created before saving.
PROJECT= Required, .lpi file name INCREMENT= Optional, increment version number by `Major.Minor.Revision.Build`. Trailing zeroes may be left out. SETENV= Optional, store new version number into a variable after other operations are done. ADDFLAG= REMOVEFLAG= Optional, add/remove version flags. Specify comma-separated flags, those not explicitly modified remain unchanged. Allowed values: pvaDebug pvaPreRelease pvaPatched pvaPrivateBuild pvaSpecialBuild COPYTO= Optional, copy version information to other LPI file(s) after other operations are done. Specify comma-separated file names here. -
zip: create a zip file from file list (global:PROGRAM_7ZIPorPROGRAM_ZIP)Create a Zip-File from files specified in a listing section. Can use 7z or Info-ZIP style utils.
FILENAME= Required, output file name FILES= Required, section containing file definitions LEVEL=5 Optional, compression level (0..9) EXCLUDE= Optional, file mask to excludeFiles list format is
FROM=TO.FROMmay be a file or file mask. If it is a file,TOmay be a directory inside the archive or the new file name. To signal a directory name, use a path delimiter as last character, in this case, the file will keep the basename. IfFROMis a file mask,TOwill be treated as a directory name. IfTOis empty, it is the same as/, meaning the archive root. -
env: Set environment variablesLines contain
Name=Valuepairs of variables. UseName=to clear/undefine a variable.
Some global parameters are required to specify for example program paths. These are searched in (in order):
- Variables set via the
envTool - Environment variables
- the section
*BUILDUTIL*of the current Buildfile - the section
Globalsof an INI-filed calledbuildutil.inilocated in the same place as the buildutil binary (more precisely, the buildutil binary name with.iniextension).