1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

Implemented some sanity - the SDK resides in libexec/ now. I have added wrappers in bin/ that allow users to run the tools by installing an SDK composition in their profile

This commit is contained in:
Sander van der Burg 2012-11-08 15:01:06 +01:00
parent 6896a895c3
commit 24d9e59cbb
3 changed files with 39 additions and 11 deletions

View file

@ -22,8 +22,8 @@ stdenv.mkDerivation {
else throw "platform not ${stdenv.system} supported!";
buildCommand = ''
mkdir -p $out
cd $out
mkdir -p $out/libexec
cd $out/libexec
unpackFile $src;
cd android-sdk-*/tools
@ -147,6 +147,34 @@ stdenv.mkDerivation {
''
else ""
) platformVersions}
# Create wrappers to the most important tools and platform tools so that we can run them if the SDK is in our PATH
ensureDir $out/bin
for i in $out/libexec/android-sdk-*/tools/*
do
if [ ! -d $i ] && [ -x $i ]
then
( echo '#! ${stdenv.shell} -e'
echo "cd $out/libexec/android-sdk-*/tools"
echo "./$(basename $i) \"\$@\"" ) > $out/bin/$(basename $i)
chmod +x $out/bin/$(basename $i)
fi
done
for i in $out/libexec/android-sdk-*/platform-tools/*
do
if [ ! -d $i ] && [ -x $i ]
then
( echo '#! ${stdenv.shell} -e'
echo "cd $out/libexec/android-sdk-*/platform-tools"
echo "./$(basename $i) \"\$@\"") > $out/bin/$(basename $i)
chmod +x $out/bin/$(basename $i)
fi
done
'';
buildInputs = [ shebangfix unzip makeWrapper ];

View file

@ -15,7 +15,7 @@ in
stdenv.mkDerivation {
inherit name src;
ANDROID_HOME = "${androidsdkComposition}/android-sdk-${platformName}";
ANDROID_HOME = "${androidsdkComposition}/libexec/android-sdk-${platformName}";
buildInputs = [ jdk ant ];

View file

@ -28,7 +28,7 @@ stdenv.mkDerivation {
for i in $(seq 5554 2 5584)
do
if [ -z "$(${androidsdkComposition}/android-sdk-*/platform-tools/adb devices | grep emulator-$i)" ]
if [ -z "$(${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb devices | grep emulator-$i)" ]
then
port=$i
break
@ -46,27 +46,27 @@ stdenv.mkDerivation {
export ANDROID_SERIAL="emulator-$port"
# Create a virtual android device
${androidsdkComposition}/android-sdk-*/tools/android create avd -n device -t ${if useGoogleAPIs then "'Google Inc.:Google APIs:"+platformVersion+"'" else "android-"+platformVersion}
${androidsdkComposition}/libexec/android-sdk-*/tools/android create avd -n device -t ${if useGoogleAPIs then "'Google Inc.:Google APIs:"+platformVersion+"'" else "android-"+platformVersion}
# Launch the emulator
${androidsdkComposition}/android-sdk-*/tools/emulator -avd device -no-boot-anim -port $port &
${androidsdkComposition}/libexec/android-sdk-*/tools/emulator -avd device -no-boot-anim -port $port &
# Wait until the device has completely booted
echo "Waiting until the emulator has booted the device and the package manager is ready..."
${androidsdkComposition}/android-sdk-*/platform-tools/adb -s emulator-$port wait-for-device
${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb -s emulator-$port wait-for-device
echo "Device state has been reached"
while [ -z "$(${androidsdkComposition}/android-sdk-*/platform-tools/adb -s emulator-$port shell getprop dev.bootcomplete | grep 1)" ]
while [ -z "$(${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb -s emulator-$port shell getprop dev.bootcomplete | grep 1)" ]
do
sleep 5
done
echo "dev.bootcomplete property is 1"
#while [ -z "$(${androidsdkComposition}/android-sdk-*/platform-tools/adb -s emulator-$port shell getprop sys.boot_completed | grep 1)" ]
#while [ -z "$(${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb -s emulator-$port shell getprop sys.boot_completed | grep 1)" ]
#do
#sleep 5
#done
@ -76,10 +76,10 @@ stdenv.mkDerivation {
echo "ready"
# Install the App through the debugger
${androidsdkComposition}/android-sdk-*/platform-tools/adb -s emulator-$port install ${app}/*.apk
${androidsdkComposition}/android-sdk-*/libexec/platform-tools/adb -s emulator-$port install ${app}/*.apk
# Start the application
${androidsdkComposition}/android-sdk-*/platform-tools/adb -s emulator-$port shell am start -a android.intent.action.MAIN -n ${package}/.${activity}
${androidsdkComposition}/android-sdk-*/libexec/platform-tools/adb -s emulator-$port shell am start -a android.intent.action.MAIN -n ${package}/.${activity}
EOF
chmod +x $out/bin/run-test-emulator