2010-01-06 00:01:19 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class AndroidSdk < Formula
|
2011-07-14 21:02:20 +00:00
|
|
|
url 'http://dl.google.com/android/android-sdk_r12-mac_x86.zip'
|
2010-01-06 00:01:19 +00:00
|
|
|
homepage 'http://developer.android.com/index.html'
|
2011-07-14 21:02:20 +00:00
|
|
|
md5 '341544e4572b4b1afab123ab817086e7'
|
|
|
|
version 'r12'
|
2010-01-06 00:01:19 +00:00
|
|
|
|
2010-12-10 12:37:25 +00:00
|
|
|
def self.var_dirs
|
2011-07-05 20:47:18 +00:00
|
|
|
%w[platforms samples temp add-ons bin]
|
2011-01-25 13:39:47 +00:00
|
|
|
# TODO docs, google-market_licensing and platform-tools
|
|
|
|
# See the long comment below for the associated problems
|
2010-12-10 12:37:25 +00:00
|
|
|
end
|
2010-09-12 20:55:04 +00:00
|
|
|
|
2010-12-10 12:37:25 +00:00
|
|
|
skip_clean var_dirs
|
2010-01-06 00:01:19 +00:00
|
|
|
|
|
|
|
def install
|
2010-09-12 20:55:04 +00:00
|
|
|
mkdir bin
|
2010-01-06 00:01:19 +00:00
|
|
|
|
2010-09-12 20:55:04 +00:00
|
|
|
mv 'SDK Readme.txt', prefix/'README'
|
|
|
|
mv 'tools', prefix
|
2010-01-06 00:01:19 +00:00
|
|
|
|
2010-12-10 12:37:25 +00:00
|
|
|
%w[android apkbuilder ddms dmtracedump draw9patch emulator
|
2011-08-15 15:23:54 +00:00
|
|
|
hierarchyviewer hprof-conv layoutopt monkeyrunner mksdcard traceview
|
2010-01-06 00:01:19 +00:00
|
|
|
zipalign].each do |tool|
|
2010-09-12 20:55:04 +00:00
|
|
|
(bin/tool).make_link(prefix/'tools'/tool)
|
2010-01-06 00:01:19 +00:00
|
|
|
end
|
2010-02-27 17:26:27 +00:00
|
|
|
|
2010-09-12 20:55:04 +00:00
|
|
|
# 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.
|
2010-12-10 12:37:25 +00:00
|
|
|
AndroidSdk.var_dirs.each do |d|
|
2010-09-12 20:55:04 +00:00
|
|
|
dst = prefix/d
|
|
|
|
src = var/'lib/android-sdk'/d
|
|
|
|
src.mkpath unless src.directory?
|
|
|
|
dst.make_relative_symlink src
|
|
|
|
end
|
2011-01-25 13:39:47 +00:00
|
|
|
|
2011-07-26 03:45:02 +00:00
|
|
|
(bin+'adb').write <<-EOS.undent
|
2011-01-25 13:39:47 +00:00
|
|
|
#!/bin/sh
|
|
|
|
ADB="#{prefix}/platform-tools/adb"
|
2011-02-25 22:15:49 +00:00
|
|
|
test -f "$ADB" && exec "$ADB" "$@"
|
2011-01-25 13:39:47 +00:00
|
|
|
echo Use the \\`android\\' tool to install adb.
|
|
|
|
EOS
|
2011-07-26 03:45:02 +00:00
|
|
|
(bin+'adb').chmod 0755
|
2010-09-12 20:55:04 +00:00
|
|
|
end
|
2010-02-27 17:26:27 +00:00
|
|
|
|
2010-12-10 12:37:25 +00:00
|
|
|
def caveats; <<-EOS.undent
|
2011-01-25 13:39:47 +00:00
|
|
|
Now run the `android' tool to install the actual SDK stuff.
|
|
|
|
You will have to install the platform-tools EVERY time this formula updates.
|
|
|
|
If you want to try and fix this then see the comment in this formula.
|
2010-02-27 17:26:27 +00:00
|
|
|
EOS
|
2010-01-06 00:01:19 +00:00
|
|
|
end
|
2011-01-25 13:39:47 +00:00
|
|
|
|
|
|
|
# The `android' tool insists on deleting /usr/local/Cellar/android-sdl/rx/platform-tools
|
|
|
|
# and then installing the new one. So it is impossible for us to redirect
|
|
|
|
# the SDK location to var so that the platform-tools don't have to be
|
|
|
|
# freshly installed EVERY FUCKING time the base SDK updates.
|
|
|
|
# My disgust at Google's ineptitude here knows NO bounds. I can only LOL.
|
|
|
|
# And I do LOL. A lot. In Google's general direction. I can't stop LOLing.
|
|
|
|
# In fact, I may have LOLd myself into insanity.
|
|
|
|
|
|
|
|
# Ideas: make android a script that calls the actual android tool, but after
|
|
|
|
# that tool exits it repairs the directory locations?
|
2010-01-06 00:01:19 +00:00
|
|
|
end
|