pantsbuild/pants — pull request #318 by mateor (2014-07-07 17:55:52+00:00)
Title: AndroidDistribution class

The Android SDK has two components that are modularly installable and used in Android BUILD files- the API level for the target, and the build-tools version used to construct the target. When a user has an SDK in their path, there is not guarantee that the API they want or the build-tools version they want has been installed into their sdk.

This class looks for an Android SDK on the machine's path (using common SDK aliases) and then checks to see if the requested API (target_sdk) and build-tools (build_tools_version) are installed. The SDK already provides a command-line tool to manage installation of these modules but the only way to really interface with it on the command line is through grepping output. Internally it doesn't seem to do much more than check for the presence of files/executables, so it seemed better to mimic that behavior as opposed to hacking up an output parser. But as the comments say, we can add more checks if we prefer.

I am working on a test class currently, but I thought I would send this along for comments while I worked.