Skip to content

Instantly share code, notes, and snippets.

@arnaudbesnier
Last active September 14, 2015 12:13
Show Gist options
  • Save arnaudbesnier/7fcf60a2c6ba8465336b to your computer and use it in GitHub Desktop.
Save arnaudbesnier/7fcf60a2c6ba8465336b to your computer and use it in GitHub Desktop.
Script to compile the Titanium SDK and generate a Java lib based on a simple Titanium app
if [ $# -eq 1 ]; then
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
# NOTICE: Compile modified SDK
cd ~/Dev/titanium_mobile/
scons
tar -xf dist/mobilesdk-3.5.1.S2-osx.zip
cp -r dist/mobilesdk/osx/3.5.1.S2 ~/Library/Application\ Support/Titanium/mobilesdk/osx/
echo "== SDK built\n"
# NOTICE: Compile Titanium app
cd ~/Dev/androidHybrid/
ti build -p android --target device --build-only
echo "== Titanium app built\n"
# NOTICE: Create the library
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home
sh ~/Downloads/dex2jar-2.0/d2j-dex2jar.sh ~/Dev/androidHybrid/build/android/bin/classes.dex
mkdir generatelib
mv classes-dex2jar.jar generatelib/lib.zip
echo "== Library generated\n"
# NOTICE: Remove Android support libs from
cd generatelib/
tar -xf lib.zip
rm -rf android/support/
rm -rf lib.zip
zip -r lib android/ com/ kankan/ org/ ti/
mv lib.zip ~/Dev/$1/app/libs/lib.jar
cd ..
rm -rf generatelib/
echo "== Library moved\n"
else
echo "Missing argument: project name (ex: Jar3)"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment