androidsdk: fix buildApp and emulateApp functions by providing the right executable paths + fix android emulator by adding dbus to the library path
This commit is contained in:
parent
c2841f1c1d
commit
b17cd148ba
@ -1,7 +1,7 @@
|
|||||||
{ stdenv, stdenv_32bit, fetchurl, unzip, makeWrapper
|
{ stdenv, stdenv_32bit, fetchurl, unzip, makeWrapper
|
||||||
, platformTools, buildTools, support, supportRepository, platforms, sysimages, addons
|
, platformTools, buildTools, support, supportRepository, platforms, sysimages, addons
|
||||||
, libX11, libXext, libXrender, libxcb, libXau, libXdmcp, libXtst, mesa, alsaLib
|
, libX11, libXext, libXrender, libxcb, libXau, libXdmcp, libXtst, mesa, alsaLib
|
||||||
, freetype, fontconfig, glib, gtk, atk, file, jdk, coreutils, libpulseaudio
|
, freetype, fontconfig, glib, gtk, atk, file, jdk, coreutils, libpulseaudio, dbus
|
||||||
, zlib, glxinfo, xkeyboardconfig
|
, zlib, glxinfo, xkeyboardconfig
|
||||||
}:
|
}:
|
||||||
{ platformVersions, abiVersions, useGoogleAPIs, useExtraSupportLibs ? false, useGooglePlayServices ? false }:
|
{ platformVersions, abiVersions, useGoogleAPIs, useExtraSupportLibs ? false, useGooglePlayServices ? false }:
|
||||||
@ -84,7 +84,7 @@ stdenv.mkDerivation rec {
|
|||||||
do
|
do
|
||||||
wrapProgram `pwd`/$i \
|
wrapProgram `pwd`/$i \
|
||||||
--prefix PATH : ${stdenv.lib.makeBinPath [ file glxinfo ]} \
|
--prefix PATH : ${stdenv.lib.makeBinPath [ file glxinfo ]} \
|
||||||
--suffix LD_LIBRARY_PATH : `pwd`/lib64:`pwd`/lib64/qt/lib:${makeLibraryPath [ stdenv.cc.cc libX11 libxcb libXau libXdmcp libXext mesa alsaLib zlib libpulseaudio ]} \
|
--suffix LD_LIBRARY_PATH : `pwd`/lib64:`pwd`/lib64/qt/lib:${makeLibraryPath [ stdenv.cc.cc libX11 libxcb libXau libXdmcp libXext mesa alsaLib zlib libpulseaudio dbus.lib ]} \
|
||||||
--suffix QT_XKB_CONFIG_ROOT : ${xkeyboardconfig}/share/X11/xkb
|
--suffix QT_XKB_CONFIG_ROOT : ${xkeyboardconfig}/share/X11/xkb
|
||||||
done
|
done
|
||||||
''}
|
''}
|
||||||
|
@ -19,7 +19,7 @@ in
|
|||||||
stdenv.mkDerivation ({
|
stdenv.mkDerivation ({
|
||||||
name = stdenv.lib.replaceChars [" "] [""] name;
|
name = stdenv.lib.replaceChars [" "] [""] name;
|
||||||
|
|
||||||
ANDROID_HOME = "${androidsdkComposition}/libexec/android-sdk-${platformName}";
|
ANDROID_HOME = "${androidsdkComposition}/libexec";
|
||||||
|
|
||||||
buildInputs = [ jdk ant ] ++
|
buildInputs = [ jdk ant ] ++
|
||||||
stdenv.lib.optional useNDK [ androidndk gnumake gawk file which ];
|
stdenv.lib.optional useNDK [ androidndk gnumake gawk file which ];
|
||||||
|
@ -40,7 +40,7 @@ rec {
|
|||||||
|
|
||||||
androidsdk = import ./androidsdk.nix {
|
androidsdk = import ./androidsdk.nix {
|
||||||
inherit (pkgs) stdenv fetchurl unzip makeWrapper;
|
inherit (pkgs) stdenv fetchurl unzip makeWrapper;
|
||||||
inherit (pkgs) zlib glxinfo freetype fontconfig glib gtk atk mesa file alsaLib jdk coreutils libpulseaudio;
|
inherit (pkgs) zlib glxinfo freetype fontconfig glib gtk atk mesa file alsaLib jdk coreutils libpulseaudio dbus;
|
||||||
inherit (pkgs.xorg) libX11 libXext libXrender libxcb libXau libXdmcp libXtst xkeyboardconfig;
|
inherit (pkgs.xorg) libX11 libXext libXrender libxcb libXau libXdmcp libXtst xkeyboardconfig;
|
||||||
|
|
||||||
inherit platformTools buildTools support supportRepository platforms sysimages addons;
|
inherit platformTools buildTools support supportRepository platforms sysimages addons;
|
||||||
|
@ -42,7 +42,7 @@ stdenv.mkDerivation {
|
|||||||
|
|
||||||
for i in $(seq 5554 2 5584)
|
for i in $(seq 5554 2 5584)
|
||||||
do
|
do
|
||||||
if [ -z "$(${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb devices | grep emulator-$i)" ]
|
if [ -z "$(${androidsdkComposition}/libexec/platform-tools/adb devices | grep emulator-$i)" ]
|
||||||
then
|
then
|
||||||
port=$i
|
port=$i
|
||||||
break
|
break
|
||||||
@ -61,10 +61,10 @@ stdenv.mkDerivation {
|
|||||||
|
|
||||||
# Create a virtual android device for testing if it does not exists
|
# Create a virtual android device for testing if it does not exists
|
||||||
|
|
||||||
if [ "$(${androidsdkComposition}/libexec/android-sdk-*/tools/android list avd | grep 'Name: device')" = "" ]
|
if [ "$(${androidsdkComposition}/libexec/tools/android list avd | grep 'Name: device')" = "" ]
|
||||||
then
|
then
|
||||||
# Create a virtual android device
|
# Create a virtual android device
|
||||||
yes "" | ${androidsdkComposition}/libexec/android-sdk-*/tools/android create avd -n device -t ${if useGoogleAPIs then "'Google Inc.:Google APIs:"+platformVersion+"'" else "android-"+platformVersion} $NIX_ANDROID_AVD_FLAGS
|
yes "" | ${androidsdkComposition}/libexec/tools/android create avd -n device -t ${if useGoogleAPIs then "'Google Inc.:Google APIs:"+platformVersion+"'" else "android-"+platformVersion} $NIX_ANDROID_AVD_FLAGS
|
||||||
|
|
||||||
${stdenv.lib.optionalString enableGPU ''
|
${stdenv.lib.optionalString enableGPU ''
|
||||||
# Enable GPU acceleration
|
# Enable GPU acceleration
|
||||||
@ -77,24 +77,24 @@ stdenv.mkDerivation {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Launch the emulator
|
# Launch the emulator
|
||||||
${androidsdkComposition}/libexec/android-sdk-*/tools/emulator -avd device -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS &
|
${androidsdkComposition}/libexec/tools/emulator -avd device -no-boot-anim -port $port $NIX_ANDROID_EMULATOR_FLAGS &
|
||||||
|
|
||||||
# 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..." >&2
|
echo "Waiting until the emulator has booted the device and the package manager is ready..." >&2
|
||||||
|
|
||||||
${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb -s emulator-$port wait-for-device
|
${androidsdkComposition}/libexec/platform-tools/adb -s emulator-$port wait-for-device
|
||||||
|
|
||||||
echo "Device state has been reached" >&2
|
echo "Device state has been reached" >&2
|
||||||
|
|
||||||
while [ -z "$(${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb -s emulator-$port shell getprop dev.bootcomplete | grep 1)" ]
|
while [ -z "$(${androidsdkComposition}/libexec/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" >&2
|
echo "dev.bootcomplete property is 1" >&2
|
||||||
|
|
||||||
#while [ -z "$(${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb -s emulator-$port shell getprop sys.boot_completed | grep 1)" ]
|
#while [ -z "$(${androidsdkComposition}/libexec/platform-tools/adb -s emulator-$port shell getprop sys.boot_completed | grep 1)" ]
|
||||||
#do
|
#do
|
||||||
#sleep 5
|
#sleep 5
|
||||||
#done
|
#done
|
||||||
@ -106,7 +106,7 @@ stdenv.mkDerivation {
|
|||||||
${stdenv.lib.optionalString (app != null) ''
|
${stdenv.lib.optionalString (app != null) ''
|
||||||
# Install the App through the debugger, if it has not been installed yet
|
# Install the App through the debugger, if it has not been installed yet
|
||||||
|
|
||||||
if [ -z "${package}" ] || [ "$(${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb -s emulator-$port shell pm list packages | grep package:${package})" = "" ]
|
if [ -z "${package}" ] || [ "$(${androidsdkComposition}/libexec/platform-tools/adb -s emulator-$port shell pm list packages | grep package:${package})" = "" ]
|
||||||
then
|
then
|
||||||
if [ -d "${app}" ]
|
if [ -d "${app}" ]
|
||||||
then
|
then
|
||||||
@ -115,12 +115,12 @@ stdenv.mkDerivation {
|
|||||||
appPath="${app}"
|
appPath="${app}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb -s emulator-$port install "$appPath"
|
${androidsdkComposition}/libexec/platform-tools/adb -s emulator-$port install "$appPath"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the application
|
# Start the application
|
||||||
${stdenv.lib.optionalString (package != null && activity != null) ''
|
${stdenv.lib.optionalString (package != null && activity != null) ''
|
||||||
${androidsdkComposition}/libexec/android-sdk-*/platform-tools/adb -s emulator-$port shell am start -a android.intent.action.MAIN -n ${package}/${activity}
|
${androidsdkComposition}/libexec/platform-tools/adb -s emulator-$port shell am start -a android.intent.action.MAIN -n ${package}/${activity}
|
||||||
''}
|
''}
|
||||||
''}
|
''}
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user