diff --git a/Makefile b/Makefile index 80cca6ecaab..3bc2ae9477b 100644 --- a/Makefile +++ b/Makefile @@ -115,6 +115,10 @@ ifeq ($(USE_MSBUILD),1) done endif # msbuild +prepare-image-dependencies: + $(MSBUILD) $(MSBUILD_FLAGS) build-tools/scripts/PrepareImageDependencies.targets /t:PrepareImageDependencies \ + /p:AndroidSupportedHostJitAbis=mxe-Win32:mxe-Win64 + include build-tools/scripts/BuildEverything.mk include tests/api-compatibility/api-compatibility.mk diff --git a/build-tools/scripts/PrepareImageDependencies.targets b/build-tools/scripts/PrepareImageDependencies.targets new file mode 100644 index 00000000000..551a57ee7dc --- /dev/null +++ b/build-tools/scripts/PrepareImageDependencies.targets @@ -0,0 +1,49 @@ + + + Debug + + + + + + + + <_Dir Include="sdk" /> + <_Dir Include="ndk" /> + <_Dir Include="ant" /> + + + <_Package + Condition=" '%(HostOS)' == '$(HostOS)' Or '%(HostOS)' == '' " + Include="@(AndroidSdkItem->'$(AndroidUri)/%(RelUrl)%(Identity) sdk/%(DestDir)')" + /> + <_Package + Condition=" '%(HostOS)' == '$(HostOS)' Or '%(HostOS)' == '' " + Include="@(AndroidNdkItem->'$(AndroidUri)/%(RelUrl)%(Identity) ndk/%(DestDir)')" + /> + <_Package + Condition=" '%(HostOS)' == '$(HostOS)' Or '%(HostOS)' == '' " + Include="@(AntItem->'$(AntUri)/%(RelUrl)%(Identity) ant/%(DestDir)')" + /> + + + <_Brew + Condition=" '$(HostOS)' == 'Darwin' And '%(RequiredProgram.Homebrew)' != '' " + Include="@(RequiredProgram->'%(Homebrew)')" + /> + + + <_Packages>@(_Package->'%(Identity)', ' +') + <_Dirs>@(_Dir->'%(Identity)', ' +') + <_Brews>@(_Brew->'%(Identity)', ' +') + + + + + \ No newline at end of file diff --git a/build-tools/scripts/prepare-image-dependencies.sh.in b/build-tools/scripts/prepare-image-dependencies.sh.in new file mode 100755 index 00000000000..13f672ac46f --- /dev/null +++ b/build-tools/scripts/prepare-image-dependencies.sh.in @@ -0,0 +1,72 @@ +#!/bin/bash -e +set -o xtrace + +ARCHIVE_PATH="$HOME/android-archives" +TOOLCHAIN_PATH="$HOME/android-toolchain" + +TOOLCHAIN_DIRS=" +@TOOLCHAIN_DIRS@ +" + +# format: URL path/under/$TOOLCHAIN_PATH +PACKAGES=" +@PACKAGES@ +" + +BREW_PACKAGES=" +@BREWS@ +" + +function Download () +{ + local url="$1" + local archive="$ARCHIVE_PATH/`basename "$url"`" + if [ -f "$archive" ]; then + return + fi + curl -o "$archive" "$url" +} + +function Install () +{ + local url="$1" + local subdir="$2" + + local file=`basename "$url"` + local archive="$ARCHIVE_PATH/$file" + local targetdir="$TOOLCHAIN_PATH/$subdir" + + local flagdir="$TOOLCHAIN_PATH/$(echo $subdir | sed 's#/.*$##g')" + local flagfile="$flagdir/.$file" + + mkdir -p "$targetdir" + if [ ! -f "$flagfile" ]; then + local extractdir=`mktemp -d` + unzip -d "$extractdir" "$ARCHIVE_PATH/$file" + mv "$extractdir"/*/* "$targetdir" + touch "$flagfile" + rm -Rf "$extractdir" + fi +} + +echo "$TOOLCHAIN_DIRS" | while read line ; do + if [ -z "$line" ]; then + continue + fi + rm -Rf "$TOOLCHAIN_PATH/$line" +done + +echo "$PACKAGES" | while read line ; do + if [ -z "$line" ]; then + continue + fi + Download $line + Install $line +done + +echo "$BREW_PACKAGES" | while read line ; do + if [ -z "$line" ]; then + continue + fi + brew install $line +done