Skip to content

Build Props

jaswsinc edited this page Jun 29, 2016 · 17 revisions

Project-Specific Properties

All project-specific properties should be added to a .build.props file in the root of your GitHub repo. Please see: example.props (with comments) for a list of all project-specific build properties.

Minimum Required Project-Specific Properties

# The title of your project.
project_title                                       = My Project Pro

# Should match the GitHub repo owner.
project_owner                                       = websharks

# Should match the GitHub repo slug.
project_slug                                        = my-project-pro

# Project text domain for i18n POT generation.
# In most cases you should exclude the `-pro` suffix here.
project_text_domain                                 = my-project

# Project namespace. Should always start with WebSharks\\
# Important: If your project is NOT open-source, or your project may (at any point in the future) offer
# a lite variation — where the original project becomes a 'pro' version; you should add \\Pro to your project's
# PHP namespace (right from the start) and declare it that way in the .build.props file.
# If in doubt, add the \\Pro suffix. Most projects should start with a \\Pro namespace.
project_namespace                                   = WebSharks\\My\\Project\\Pro

# This is a concatenation of all sub-namespace names, minus the \\ slashes.
project_sub_namespace                               = MyProjectPro

# This can be a hard-coded version or you can make it dynamic using replacement codes.
# %y, %m, %d = year, month, day. %now = number of seconds into the current day.
project_version                                     = %y%m%d.%now

# PHP version required to run your project.
project_php_required_version                        = 7.0.4

# Latest version of PHP you've tested against.
# ${php.version} = The version of PHP you run the build with.
project_php_tested_up_to_version                    = ${php.version}

# Required only if your project is a WP theme or plugin.
# Defining any of these properties implies that your project is a WP theme/plugin.
# Likewise, excluding both of these properties implies that your project is not a WP theme/plugin.
project_wp_required_version                         = x.x.x
project_wp_tested_up_to_version                     = x.x-alpha

# Required only if your project is built on top of the WP Sharks Core.
# Defining any of these properties implies that your project is built on the WP Sharks Core.
# Likewise, excluding both of these properties implies that your project is not built on the WP Sharks Core.
project_wp_sharks_core_required_version             = xxxxxx.xxxx
project_wp_sharks_core_tested_up_to_version         = xxxxxx.xxxx

Building the Lite Variation of a Pro Project

Defining any of these properties implies that you do want to build a lite variation. Also, when you define any of these properties you must define all of them. Note: You should always remove a 'pro' suffix from the lite variation as seen below.

project_lite_title                                  = My Project
project_lite_slug                                   = my-project
project_lite_text_domain                            = my-project

project_lite_namespace                              = WebSharks\\My\\Project
project_lite_sub_namespace                          = MyProject

Command-Line Properties (How-To)

In Phing, properties can also be set at the command-line using the -D option.

$ phing -D name=value
$ phing -D name1=value1 -D name2='value2'

Command-Line Properties in websharks/phings

Note: These are special because they're intended for command-line use only.

Feature-Related Command-Line Properties

  • issue Can be used to bypass the prompt for an issue number.

    $ phing feature -D issue=123
  • pr Can be used to disable automatic PR creation when starting a new feature branch.

    $ phing feature -D issue=123 -D pr=false

Release-Related Command-Line Properties

  • slack-enable Can be used to disable Slack notifications.

    $ phing release -D slack-enable=false
  • slack-channel Can be used to force Slack notifications into a specific channel. This can be helpful when running tests with the Phing build system; i.e., you can create a private group that only you can see, and send notifications there temporarily.

    $ phing release -D slack-channel='#my-sandbox'
    # Don't forget the hash symbol and don't forget the quotes.

Other/Misc. Command-Line Properties

  • action Not currently exposed by any public targets.
  • type Not currently exposed by any public targets.

Overwriting Project-Specific Build Properties

In addition to the special properties listed above, you can also overwrite any property that's normally defined in .build.props, using the same -D option at the command-line. For a list of all possible build properties, see: example.props.

$ phing build -D project_version=16xxxx

Other Phing Command-Line Options

In addition, Phing itself provides a number of command-line options. For example, the following command-line option allows you to see a list of all available targets.

$ phing -l

Default target:
-------------------------------------------------------------------------------
 build

Subtargets:
-------------------------------------------------------------------------------
 build
 build-all
 build-lite
 ...

For more information about targets, see: Build Targets