Skip to content

Instantly share code, notes, and snippets.

@jayridge
Last active August 29, 2015 14:17
Show Gist options
  • Save jayridge/e318b9e0b3935626ee9e to your computer and use it in GitHub Desktop.
Save jayridge/e318b9e0b3935626ee9e to your computer and use it in GitHub Desktop.
xcode ant wrapper
#!/bin/bash
ANT=/usr/local/bin/ant
ACTION=${ACTION:-build}
CONFIGURATION=${CONFIGURATION:-Debug}
PATTERN='s/^.*\[javac\] //'
if [ "$#" -gt 0 ];then
ACTION=$1
fi
if [ "$#" -gt 1 ];then
CONFIGURATION=$2
fi
>&2 echo "xant $ACTION $CONFIGURATION"
case $ACTION in
build*)
if [ $CONFIGURATION == "Release" ]; then
$ANT release | sed -e "$PATTERN"
else
$ANT debug | sed -e "$PATTERN"
fi
;;
install*)
if [ $CONFIGURATION == "Release" ]; then
$ANT installr | sed -e "$PATTERN"
else
$ANT installd | sed -e "$PATTERN"
fi
;;
clean*)
$ANT clean
;;
*)
echo "usage: `basename $0` [ build | install | clean ] [ Debug | Release ]"
exit 1
;;
esac
exit ${PIPESTATUS[0]} || 0
@jayridge
Copy link
Author

Wraps ant for build and install of android projects under XCode 6.

N.B. XCode will erase the contents of the project directory. Select a new directory if your project exists.

  1. File->New->Project select External Build System
  2. Type ./xant as build tool
  3. Open project in assistant editor and select the target, then info
  4. Ensure build tool is ./xant, arguments $(ACTION), directory is set and pass build settings is selected
  5. Product->Scheme->Manage Schemes, select scheme and edit
  6. Run->Arguments
  7. Add install $(CONFIGURATION) to Arguments Passed On Launch, repeat with Test
  8. Copy or create android files ( http://developer.android.com/training/basics/firstapp/creating-project.html#CommandLine )
  9. Add files to project

seed http://code.davidjanes.com/blog/2009/11/20/how-to-use-xcode-for-android-projects/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment