Skip to content

Instantly share code, notes, and snippets.

@kuropen
Created December 18, 2014 02:02
Show Gist options
  • Save kuropen/43d25f3289707a643948 to your computer and use it in GitHub Desktop.
Save kuropen/43d25f3289707a643948 to your computer and use it in GitHub Desktop.
Building Multiple Android Studio Project in a Directory
#!/bin/zsh
foreach d ($(find . -depth 1 -type d))
echo Entering Directory: $d
if [ -f $d/build.gradle ]; then
echo build.gradle Found. Starting Build.
cd $d
./gradlew clean build
echo Exit status code: $?
if [ $? -eq 0 ]; then
targetBaseName=$(basename $d)
mkdir -p ../apk_$targetBaseName
foreach f ($(find . -type f | grep apk$))
cp $f ../apk_$targetBaseName
end
fi
cd -
else
echo build.gradle Not Found.
fi
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment