Phing - Replaceable Parameters?

I’m new to phing, so I may be missing something obvious here, but I have the following that packages a chrome extension

<exec command="&quot;C:\\PortableApps\\GoogleChromePortable\\GoogleChromePortable.exe&quot; --pack-extension=&quot;M:\\GIT\\Playground\\my-scripts\\chrome\\my_extension&quot; --pack-extension-key=&quot;M:\\GIT\\Playground\\my-scripts\\chrome\\my_extension.pem&quot;" dir="." logoutput="true" />

I’m curious if I can replace the paths that are hard coded with some kind of parameter… Something like %chrome%. The hard coded paths are ugly and won’t cross workstations very well (if I were to ever add another team member).

Two things to note:

  1. The --pack-extension and --pack-extension-key MUST be Full Paths (I tried relative, it fails to generate the crx files)
  2. It must create the crx within the my-scripts\chrome folder (which it does now).

Thoughts?

The way I do this is by using a properties file.

In build.xml put <property file="./build.properties" /> and create a file called build.properties with contents like so


chrome.exe=C:\\PortableApps\\GoogleChromePortable\\GoogleChromePortable.exe
chrome.ext_dir=M:\\GIT\\Playground\\my-scripts\\chrome\\my_extension
chrome.pem_file=M:\\GIT\\Playground\\my-scripts\\chrome\\my_extension.pem

and then in the original build.xml it becomes:


<exec command="&quot;${chrome.exe}&quot; --pack-extension=&quot;${chrome.ext_dir}&quot; --pack-extension-key=&quot;${chrome.pem_file}&quot;" dir="." logoutput="true" />

Cool, then do you usually set that file to ignore? and just checkin a basic example one for the other devs to use as a template?

Yup :slight_smile:

Sweet, that worked like a charm :slight_smile: