I'm completely new to scripting, but I'm tired of compiling my own Android code manually, so I wrote a little .sh script and a .bat file to run this script in cygwin. Both files are placed in the root of the project, the NDK directory is installed in the .sh file, and then, by running the .bat file, I will compile my own code.
The problem is that I want to do this dynamically, so I use% CD% to get the current directory (which should be the project folder) and run the .sh file in that directory.
Here are both files:
.bat:
@echo off
::Used to surpess a warning about dos directory format.
set CYGWIN=nodosfilewarning
C:\cygwin\bin\bash
pause
.sh:
#!/bin/bash
NDKDIR=C:/Android/NDK/
BASEDIR=`dirname $0`
echo
echo Compiling Native code. Refresh Workspace after this is done!
echo
cd $BASEDIR
$NDKDIR./ndk-build
.bat , . , , % CD% "C:/Eclipse". , , .
, : % CD% . , . , .
.