aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/android-sdk.rb
blob: d0921c36e62824c2c6bb74ddabdd050e70caf2d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require 'formula'

class AndroidSdk <Formula
  url 'http://dl.google.com/android/android-sdk_r08-mac_86.zip'
  homepage 'http://developer.android.com/index.html'
  md5 'd2e392c4e4680cbf2dfd6dbf82b662c7'
  version 'r8'

  def self.var_dirs
    %w[platforms docs samples temp add-ons]
  end

  skip_clean var_dirs

  def install
    mkdir bin

    mv 'SDK Readme.txt', prefix/'README'
    mv 'tools', prefix

    %w[android apkbuilder ddms dmtracedump draw9patch emulator
           hierarchyviewer hprof-conv layoutopt mksdcard traceview
           zipalign].each do |tool|
      (bin/tool).make_link(prefix/'tools'/tool)
    end

    # this is data that should be preserved across upgrades, but the Android
    # SDK isn't too smart, so we still have to symlink it back into its tree.
    AndroidSdk.var_dirs.each do |d|
      dst = prefix/d
      src = var/'lib/android-sdk'/d
      src.mkpath unless src.directory?
      dst.make_relative_symlink src
    end
  end

  def caveats; <<-EOS.undent
    We put the useful tools in the PATH. Like the `android` tool. You probably
    want to run that now.
    EOS
  end
end