2011-03-10 05:11:03 +00:00
|
|
|
class AndroidSdk < Formula
|
2015-03-10 14:42:06 +00:00
|
|
|
homepage "https://developer.android.com/index.html"
|
|
|
|
url "https://dl.google.com/android/android-sdk_r24.1.2-macosx.zip"
|
|
|
|
version "24.1.2"
|
|
|
|
sha256 "a4441a4770130aa841f350918a16db43aaee18f2d8e0c681a216e0381a763362"
|
2010-01-06 00:01:19 +00:00
|
|
|
|
2015-03-10 14:42:06 +00:00
|
|
|
conflicts_with "android-platform-tools",
|
2014-03-15 22:09:26 +00:00
|
|
|
:because => "The Android Platform-Tools need to be installed as part of the SDK."
|
2014-02-24 02:11:49 +00:00
|
|
|
|
2015-03-10 14:42:06 +00:00
|
|
|
resource "completion" do
|
|
|
|
url "https://raw.githubusercontent.com/CyanogenMod/android_sdk/938c8d70af7d77dfcd1defe415c1e0deaa7d301b/bash_completion/adb.bash"
|
|
|
|
sha256 "6ae8fae2a07c7a286d440d5f5bdafdd0c208284d7c8be21a0f59d96bb7426091"
|
2013-08-07 05:03:49 +00:00
|
|
|
end
|
|
|
|
|
2014-03-15 22:09:26 +00:00
|
|
|
# Version of the android-build-tools the wrapper scripts reference.
|
|
|
|
def build_tools_version
|
2014-12-31 22:40:25 +00:00
|
|
|
"21.1.2"
|
2014-03-15 22:09:26 +00:00
|
|
|
end
|
|
|
|
|
2010-01-06 00:01:19 +00:00
|
|
|
def install
|
2015-03-10 14:42:06 +00:00
|
|
|
prefix.install "tools", "SDK Readme.txt" => "README"
|
2010-01-06 00:01:19 +00:00
|
|
|
|
2014-06-29 19:57:27 +00:00
|
|
|
%w[android ddms draw9patch emulator
|
2015-03-10 14:42:06 +00:00
|
|
|
emulator-arm emulator-x86 hierarchyviewer lint mksdcard
|
|
|
|
monitor monkeyrunner traceview].each do |tool|
|
2012-03-22 09:33:21 +00:00
|
|
|
(bin/tool).write <<-EOS.undent
|
2014-03-15 22:09:26 +00:00
|
|
|
#!/bin/bash
|
2012-03-22 09:33:21 +00:00
|
|
|
TOOL="#{prefix}/tools/#{tool}"
|
|
|
|
exec "$TOOL" "$@"
|
|
|
|
EOS
|
2010-01-06 00:01:19 +00:00
|
|
|
end
|
2010-02-27 17:26:27 +00:00
|
|
|
|
2014-06-29 19:57:27 +00:00
|
|
|
%w[zipalign].each do |tool|
|
|
|
|
(bin/tool).write <<-EOS.undent
|
|
|
|
#!/bin/bash
|
|
|
|
TOOL="#{prefix}/build-tools/#{build_tools_version}/#{tool}"
|
|
|
|
exec "$TOOL" "$@"
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
%w[dmtracedump etc1tool hprof-conv].each do |tool|
|
|
|
|
(bin/tool).write <<-EOS.undent
|
|
|
|
#!/bin/bash
|
|
|
|
TOOL="#{prefix}/platform-tools/#{tool}"
|
|
|
|
exec "$TOOL" "$@"
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
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.
|
2014-02-24 02:11:49 +00:00
|
|
|
%w[platforms samples temp add-ons sources system-images extras].each do |d|
|
2014-03-26 22:27:10 +00:00
|
|
|
src = var/"lib/android-sdk"/d
|
|
|
|
src.mkpath
|
|
|
|
prefix.install_symlink src
|
2010-09-12 20:55:04 +00:00
|
|
|
end
|
2011-01-25 13:39:47 +00:00
|
|
|
|
2013-06-07 09:12:53 +00:00
|
|
|
%w[adb fastboot].each do |platform_tool|
|
2012-05-24 13:35:49 +00:00
|
|
|
(bin/platform_tool).write <<-EOS.undent
|
2014-03-15 22:09:26 +00:00
|
|
|
#!/bin/bash
|
2012-05-24 13:35:49 +00:00
|
|
|
PLATFORM_TOOL="#{prefix}/platform-tools/#{platform_tool}"
|
2014-03-15 22:09:26 +00:00
|
|
|
test -x "$PLATFORM_TOOL" && exec "$PLATFORM_TOOL" "$@"
|
|
|
|
echo "It appears you do not have 'Android SDK Platform-tools' installed."
|
|
|
|
echo "Use the 'android' tool to install them: "
|
|
|
|
echo " android update sdk --no-ui --filter 'platform-tools'"
|
2012-05-24 13:35:49 +00:00
|
|
|
EOS
|
|
|
|
end
|
2012-10-18 15:04:21 +00:00
|
|
|
|
2013-06-07 09:12:53 +00:00
|
|
|
%w[aapt aidl dexdump dx llvm-rs-cc].each do |build_tool|
|
|
|
|
(bin/build_tool).write <<-EOS.undent
|
2014-03-15 22:09:26 +00:00
|
|
|
#!/bin/bash
|
|
|
|
BUILD_TOOLS_VERSION='#{build_tools_version}'
|
|
|
|
BUILD_TOOL="#{prefix}/build-tools/$BUILD_TOOLS_VERSION/#{build_tool}"
|
|
|
|
test -x "$BUILD_TOOL" && exec "$BUILD_TOOL" "$@"
|
|
|
|
echo "It appears you do not have 'build-tools-$BUILD_TOOLS_VERSION' installed."
|
|
|
|
echo "Use the 'android' tool to install them: "
|
|
|
|
echo " android update sdk --no-ui --filter 'build-tools-$BUILD_TOOLS_VERSION'"
|
2013-06-07 09:12:53 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
2015-03-10 14:42:06 +00:00
|
|
|
bash_completion.install resource("completion").files("adb.bash" => "adb-completion.bash")
|
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
|
2014-03-15 22:09:26 +00:00
|
|
|
Now run the 'android' tool to install the actual SDK stuff.
|
2012-01-18 17:52:38 +00:00
|
|
|
|
2012-05-29 04:17:02 +00:00
|
|
|
The Android-SDK location for IDEs such as Eclipse, IntelliJ etc is:
|
|
|
|
#{prefix}
|
2012-01-18 17:52:38 +00:00
|
|
|
|
2012-03-22 09:33:21 +00:00
|
|
|
You will have to install the platform-tools and docs EVERY time this formula
|
|
|
|
updates. If you want to try and fix this then see the comment in this formula.
|
2012-03-01 16:54:53 +00:00
|
|
|
|
|
|
|
You may need to add the following to your .bashrc:
|
2013-06-07 08:42:17 +00:00
|
|
|
export ANDROID_HOME=#{opt_prefix}
|
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
|
|
|
|
2014-03-15 22:09:26 +00:00
|
|
|
# The 'android' tool insists on deleting #{prefix}/platform-tools
|
2011-01-25 13:39:47 +00:00
|
|
|
# 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
|
2012-03-06 16:00:47 +00:00
|
|
|
# freshly installed EVERY DANG time the base SDK updates.
|
2011-01-25 13:39:47 +00:00
|
|
|
|
|
|
|
# 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
|