Structure
How does this system work?
Our build and pack system follows the structure that is outlined below to give you the ability to create a powerful build system for your projects to ensure that you provide developers short commands to build the project and to simplify the complicated build operations.
Required structure
The following structure is required for every project that uses this build toolset:
Project directory
tools(directory, cloned as a git submodule. Consult the source code for more info.)vendor(directory, you'll have to create the below files and this directory yourself)vnd_build.py(file, list of instructions for build)vnd_clean.py(file, list of instructions for cleanup)vnd_test.py(file, list of instructions for test)vnd_increment.py(file, list of instructions for version incrementation)vnd_vendorize.py(file, list of instructions for dependency vendoring)vnd_gendocs.py(file, list of instructions for documentation generation)vnd_packdocs.py(file, list of instructions for documentation packing)vnd_packbin.py(file, list of instructions for artifact packing)vnd_pushbin.py(file, list of instructions for pushing to package registry)vnd_liquidize.py(file, list of instructions for project obsoletion)vnd_updatedeps.py(file, list of instructions for updating project dependencies)vnd_listprojs.py(file, list of instructions for listing project files)
Dependency vendoring may be required for offline builds, especially .NET projects that use NuGet to fetch their dependencies. In this case, you'll have to implement the localize function.
How the project calls the build scripts is entirely up to the project and not to a standard Makefile that makes use of those scripts found in the tools directory.
Vendor Python scripts
When you begin writing vendor scripts for your projects, you'll have to consider the following:
Argument signatures for some actions
Not all actions that ADT supports contain the same argument signatures. Therefore, it's best to follow this:
Build arguments and test arguments are provided with the first argument,
build_argsandtest_args, before the extra arguments,extra_args. Therefore, you'll need to provide those two arguments when defining thevnd_build()and thevnd_test()functions, like this:Extra arguments are arguments that are unknown to the ADT hook for each action. However,
build_argsis populated by-b(--build-args) switch, andtest_argsis populated by-t(--test-args) switch.Increment action doesn't support extra arguments, because it assumes that, after the old version (
old_version) and the new version (new_version) is specified, extra arguments are specified as extra versions (api_versions), such as codenames or API versions. However, you'll need to define all three arguments when definingvnd_increment(), like this:
Pre-action and post-action events
If you want to specify the instructions that you want to run before the real event, you'll have to define either one or both of the parameterless functions that are named like this:
vnd_preaction(): Contains instructions that are executed before the actionvnd_postaction(): Contains instructions that are executed after the successful action run.
For example, vnd_prebuild() defines pre-build actions and vnd_postbuild() defines post-build actions, and are located in the vnd_build.py module.
Please note that the arguments are not supported in these functions.
Other tools
When it comes to ADT's other tools, here are the available tools that you can use:
Standalone actions
intreport
-l [-lp path]
Generates a report to a local directory
-r [-rp path] [-sh host] [-sp port] [-su username] [-sp password]
Generates a report to a remote directory over SSH with password
-r [-rp path] [-sh host] [-sp port] [-su username] [-sk privkeypath]
Generates a report to a remote directory over SSH with private key
dnresxlang
json_path -ac -l language -c culture [-c culture2] [-c culture3]...
Adds cultures to an existing language
json_path -ai -l language -is locid locstr [-is locid2 locstr2] [-is locid3 locstr3]...
Adds localizations and their strings to an existing language
json_path -al -l language -c culture [-c culture2] [-c culture3]...
Adds a language with specified cultures
json_path -dc -l language -c culture [-c culture2] [-c culture3]...
Deletes cultures from a specific language
json_path -di -l language -i locid[-i locid2] [-i locid3]...
Deletes localizations from a specific language
json_path -dl -l language
Deletes a language
json_path -ec -l language -c culture [-c culture2] [-c culture3]...
Replaces a list of cultures with specified cultures
json_path -ei -l language -is locid locstr [-is locid2 locstr2] [-is locid3 locstr3]...
Edits existing localizations for new strings
json_path -r [-l language]
Generates a report for a specific language or for all languages
json_path -s -rp resx_path
Saves all languages and converts them for use with .NET projects
The dnresxlang action only supports .NET projects. You can find the JSON structure of a language file here.
Git-specific actions
tags
Lists tags for the whole repo
branches
Lists checked-out branches
commits
Lists commits in the current branch
status
Lists status of the local repo
revert
commit
Creates a commit that reverts a commit
commit
-s summary -t type [-b body] [-a attributes] [-i --assistant model] [-c commit]
Creates a conventional commit with summary and type
push
[-r remote]
Pushes commits to either the current remote or a specific remote
reset
commit
Resets to a commit
hardclean
Forces destructive removal of untracked files, even ignored ones (executes git clean -xdf)
In order to be able to use Git-specific actions, you'll have to clone ADT as submodule in your repository after initializing it. You may need to use the git command directly in some situations.
You can pass -v to any ADT command to enable verbose output, and you can pass --nobanner to prevent showing version information.
To be able to use other tools, you'll have to either install dependencies from your system package manager outlined in the requirements.txt file, or you'll have to use pip install -r tools/requirements.txt to install the required dependencies. You can learn more about requirements.txt here.
Last updated