Open Source & Free  

Build Hint Variables

Build Hint Variables

Header Image

This is a feature Steve added way back in June but I didn’t get around to documenting it. Build hints can sometimes get “unwieldy” e.g. in the case of ios.plistInject or android.xapplication we sometimes have pretty verbose values.

We now have a way to define a “build hint variable” which the build server substitutes seamlessly. This is useful for “key” values required by API’s that sometimes require boilerplate e.g. the Google Maps support has this:

android.xapplication=<meta-data android_name="" android_value="YOUR_ANDROID_API_KEY"/>

Notice that the one thing that actually matters here is YOUR_ANDROID_API_KEY which makes this problematic. We can’t add this string to the build hints automatically because this is a value you need to set…​

The variables allow us to do this instead:

android.xapplication=<meta-data android_name="" android_value="${var.androidAPIKey}"/>

This might seem more verbose but notice that the cn1lib can now inject the second line automatically and you will need to add this single line: var.androidAPIKey=YOUR_ANDROID_API_KEY

That is far simpler than before and less error prone.

Most cn1libs still don’t take advantage of this syntax but hopefully we’ll move them in that direction as we move forward.


Leave a Reply