Last active
August 29, 2015 14:13
-
-
Save youpy/2693376da58365fa361b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# required | |
# - scala | |
# - sbt (0.13.7 or higher) | |
# - Android SDK | |
set -e -x -u | |
target=$1 | |
name=$2 | |
package=$3 | |
android create project \ | |
--target $target \ | |
--name $name \ | |
--path `pwd` \ | |
--activity MainActivity \ | |
--package $package | |
main_java=$(find . -name MainActivity.java) | |
main_scala=$(echo $main_java | sed 's/java/scala/') | |
echo "package $package | |
import android.app.Activity | |
import android.os.Bundle | |
class MainActivity extends Activity { | |
override def onCreate(savedInstanceState:Bundle){ | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.main) | |
} | |
} | |
" > $main_scala | |
echo "import android.Keys._ | |
android.Plugin.androidBuild | |
name := \"$name\" | |
platformTarget in Android := \"$target\" | |
run <<= run in Android | |
install <<= install in Android | |
" > build.sbt | |
mkdir project | |
echo "addSbtPlugin(\"com.hanhuy.sbt\" % \"android-sdk-plugin\" % \"1.3.16\") | |
" > project/plugin.sbt | |
echo ".DS_Store | |
*.log | |
*~ | |
*#* | |
*.class | |
.classpath | |
.project | |
bin | |
build.xml | |
local.properties | |
proguard.cfg | |
.settings | |
target/ | |
tmp | |
gen | |
ant.properties | |
" > .gitignore | |
rm -rf build.xml ant.properties bin $main_java | |
git init | |
git add . | |
git ci -m 'initial commit' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment