mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-20 11:05:14 +00: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:
parent
6896a895c3
commit
24d9e59cbb
@ -22,8 +22,8 @@ stdenv.mkDerivation {
|
|||||||
else throw "platform not ${stdenv.system} supported!";
|
else throw "platform not ${stdenv.system} supported!";
|
||||||
|
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
mkdir -p $out
|
mkdir -p $out/libexec
|
||||||
cd $out
|
cd $out/libexec
|
||||||
unpackFile $src;
|
unpackFile $src;
|
||||||
|
|
||||||
cd android-sdk-*/tools
|
cd android-sdk-*/tools
|
||||||
@ -147,6 +147,34 @@ stdenv.mkDerivation {
|
|||||||
''
|
''
|
||||||
else ""
|
else ""
|
||||||
) platformVersions}
|
) 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 ];
|
buildInputs = [ shebangfix unzip makeWrapper ];
|
||||||
|
@ -15,7 +15,7 @@ in
|
|||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
inherit name src;
|
inherit name src;
|
||||||
|
|
||||||
ANDROID_HOME = "${androidsdkComposition}/android-sdk-${platformName}";
|
ANDROID_HOME = "${androidsdkComposition}/libexec/android-sdk-${platformName}";
|
||||||
|
|
||||||
buildInputs = [ jdk ant ];
|
buildInputs = [ jdk ant ];
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ stdenv.mkDerivation {
|
|||||||
|
|
||||||
for i in $(seq 5554 2 5584)
|
for i in $(seq 5554 2 5584)
|
||||||
do
|
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
|
then
|
||||||
port=$i
|
port=$i
|
||||||
break
|
break
|
||||||
@ -46,27 +46,27 @@ stdenv.mkDerivation {
|
|||||||
export ANDROID_SERIAL="emulator-$port"
|
export ANDROID_SERIAL="emulator-$port"
|
||||||
|
|
||||||
# Create a virtual android device
|
# 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
|
# 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
|
# Wait until the device has completely booted
|
||||||
|
|
||||||
echo "Waiting until the emulator has booted the device and the package manager is ready..."
|
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"
|
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
|
do
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "dev.bootcomplete property is 1"
|
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
|
#do
|
||||||
#sleep 5
|
#sleep 5
|
||||||
#done
|
#done
|
||||||
@ -76,10 +76,10 @@ stdenv.mkDerivation {
|
|||||||
echo "ready"
|
echo "ready"
|
||||||
|
|
||||||
# Install the App through the debugger
|
# 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
|
# 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
|
EOF
|
||||||
|
|
||||||
chmod +x $out/bin/run-test-emulator
|
chmod +x $out/bin/run-test-emulator
|
||||||
|
Loading…
Reference in New Issue
Block a user