Mobile/Fennec/Android/Updating SDK on builders

From MozillaWiki
< Mobile‎ | Fennec‎ | Android
Jump to: navigation, search

This page details how to update the remote builders' SDK versions for Nightly builds, Treeherder, etc.

Legal notes

The Android SDK must have "internal" access rights because we are not allowed to distribute the SDK.

Requirements

Procedure

(If you're updating Gradle dependencies instead of the SDK, you can run a TaskCluster job to create the new build dependencies. Otherwise...)

  • Download the packages necessary for building. On Linux, this can be done via the `android` utility (in the downloaded SDK, not locally!). For other platforms, see below. You can verify which packages need to be installed by comparing with the android SDK currently available for the builders on tooltool (see the downloading section below). Currently (6/4/15), these tools are:
    • Tools (the version supplied with the SDK may be outdated)
    • Platform
    • Platform tools
    • Build tools
    • Android Support Library
    • Google Play services
  • Place the downloaded packages into the downloaded SDK, following the pattern of an existing SDK (either from tooltool, or your own local install). Note that the packages often rename themselves after unzipping (e.g. mine were called "android-5.1). Currently (6/4/15), this looks like:
    • build-tools/<version>
    • extras/android/support
    • extras/google/google_play_services
    • platforms/android-<#>
    • platform-tools/
    • tools/
  • Compress the SDK! The filename is currently android-sdk.tar.xz (i.e. compressed with xz, unclear if this is a requirement). To tar (because, you know, those flags): `tar -cJf android-sdk.tar.xz android-sdk-linux`. On OS X, tar does not support xz by default - you can download gnu-tar (`brew install gnu-tar`) and run the command above, substituting `gtar` for `tar`. Note: this can take a while.
  • Upload the SDK via tooltool.
    • Get (or update) tooltool: `git clone http://github.com/mozilla/build-tooltool`
    • Add the SDK to the upload manifest: `python <path-to-tooltool>/tooltool.py add --visibility internal android-sdk.tar.xz`. This will output a new manifest.tt file or amend an existing one. Note that the `--visibility internal` is critical for compliance with Google's license!
    • Get an upload authentication token via https://mozilla-releng.net/tokens/ (provided you have the permissions - ping garbas on IRC to get it)
    • Upload the SDK: `python <path-to-tooltool>/tooltool.py upload --authentication-file=<path-to-auth-token> --message "Bug ###: <message>"`
  • Update the builder configuration files to point at the new uploaded SDK: follow the model of bug 1165422. Use the information in the manifest.tt file update the configs.
  • Consider if there's anything else to update (e.g. gradle build versions. see also bug 1165422)
  • (Maybe? I did) Add a CLOBBER (i.e. edit the CLOBBER file)
  • Test it! Push it to try.
  • Green? Land it!

Downloading tools on non-Linux machines

You can't run the `android` binary locally so you'll have to download the tools from the URLs directly:

  • Run `android list sdk` - it'll output it the source XML for the various tools it can install. For the primary packages, this is currently located here.
  • Open the url (e.g. `curl <url> | less`) and look through the XML for the tools at the versions you need them. The XML tags follow a pattern:
    • Tools: <sdk:tool>
    • Platform: <sdk:platform>
    • Platform tools: <sdk:platform-tool>
    • Build tools: <sdk:build-tool>
    • Android Support Library: (separate xml file) <sdk:extra>
    • Google Play services: (separate xml file) <sdk:extra>
  • Look for an <sdk:url> tag. If it's a full url, you're in! Otherwise, guess at the URL based on where you downloaded the SDK and look at some other urls in the file. See the example URLs.

Example URLs

Downloading previously uploaded files

Motivation: maybe you need to double-check the format of the previous SDK.

Note that you'll need an auth token because the access rights on the SDK are internal.

  • For the most recent SDK, look here.
    • Alternatively, for older files, go to tooltool and find the file you want to download. For the SDK, searching for the bug number seems most optimal. There may also be a download button on the page, in order to skip the steps through the tooltool script below.
  • Write a manifest file using the info collected on tooltool (note: sha512 is always used), e.g.:
[
{
"size": 329217868,
"digest": "1cf54f12c271a2eea8f03caafa458207768ba12400cf53d742e3c4654a32b18fb75d8e0dece95e27691695751a6f6514ccb724b1a74958948c5f111c5c00da4f",
"algorithm": "sha512",
"filename": "android-sdk.tar.xz"
}
]
  • Download the file! e.g.
python <path-to-tooltool>/tooltool.py fetch --url https://mozilla-releng.net/tooltool/ \
  -m <path-to-manifest> --authentication-file=<path-to-auth-file>