Skip to content

Commit 6ba94af

Browse files
committed
Modify build scripts to install Cordova
- Add Cordova and JDK installation to install.sh - Build Android template project building - Set android build tools paths in base.sh List of Dependencies for Android Exports - - Cordova >= 6.2.2 - Android Build Tools - Android SDK >= 19 - Gradle >= 3.4 - All executables in path and $ANROID_HOME set
1 parent 38d87dd commit 6ba94af

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

base.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ export PATH=$BUILD/bin:$PATH
1919
export LANG=${LANG:-C.UTF-8}
2020
export PREFIX=$BUILD
2121

22+
export ANDROID_HOME=$BUILD/Android/Sdk
23+
export PATH=$BUILD/Android/Sdk/tools:$PATH
24+
export PATH=$BUILD/Android/Sdk/platform-tools:$PATH
25+
export PATH=$BUILD/Android/Sdk/tools/bin:$PATH
26+
export PATH=$BUILD/Android/Sdk/tools/lib:$PATH
27+
28+
export PATH=$BUILD/Cordova/node_modules/cordova/bin:$PATH
29+
2230
function run {
2331
OLD_PWD=$PWD
2432
cd $1
@@ -38,3 +46,4 @@ function run {
3846
function cabal_install {
3947
cabal install --force-reinstalls --global --prefix=$BUILD $@
4048
}
49+

build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ cwd=$(pwd)
1818

1919
source base.sh
2020

21+
# Create Cordova template
22+
run ./android-template cordova build android
23+
2124
run . cabal update
2225

2326
# Install the codeworld-base and codeworld-api packages
@@ -53,3 +56,4 @@ run . cabal_install ./codeworld-server \
5356

5457
# Build the JavaScript client code for FunBlocks, the block-based UI.
5558
run . cabal_install --ghcjs ./funblocks-client
59+

install.sh

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ then
5252
run . sudo yum install -y patch
5353
run . sudo yum install -y autoconf
5454
run . sudo yum install -y automake
55+
56+
# Needed for Cordova
57+
run . sudo yum install -y java-1.8.0-openjdk
58+
# TODO: Gradle for yum
59+
5560
elif type apt-get > /dev/null 2> /dev/null
5661
then
5762
echo Detected 'apt-get': Installing packages from there.
@@ -84,6 +89,11 @@ then
8489
run . sudo apt-get install -y autoconf
8590
run . sudo apt-get install -y automake
8691
run . sudo apt-get install -y libtinfo-dev
92+
93+
# Needed for Cordova
94+
run . sudo apt-get install -y default-jdk
95+
run . sudo apt-get install -y gradle
96+
8797
elif type zypper > /dev/null 2> /dev/null
8898
then
8999
echo Detected 'zypper': Installing packages from there.
@@ -113,9 +123,13 @@ then
113123
run . sudo zypper -n install patch
114124
run . sudo zypper -n install autoconf
115125
run . sudo zypper -n install automake
126+
127+
# Needed for Cordova
128+
# TODO: OpenJDK, JRE and Gradle for Zypper
116129
else
117130
echo "WARNING: Could not find package manager."
118131
echo "Make sure necessary packages are installed."
132+
119133
fi
120134

121135
# Choose the right GHC download
@@ -169,7 +183,6 @@ run $BUILD cabal_install ./ghcjs
169183
run $BUILD rm -rf ghcjs
170184
run . ghcjs-boot --dev --ghcjs-boot-dev-branch ghc-8.0 --shims-dev-branch ghc-8.0 --no-prof --no-haddock
171185

172-
run $BUILD rm -rf downloads
173186

174187
# Install and build CodeMirror editor.
175188

@@ -187,5 +200,30 @@ function build_codemirror {
187200

188201
run $BUILD/CodeMirror build_codemirror
189202

203+
# Install Android SDK
204+
205+
run $DOWNLOADS wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
206+
run $BUILD unzip $DOWNLOADS/sdk-tools-linux-3859397.zip
207+
run $BUILD mkdir -p Android/Sdk
208+
run $BUILD mv tools Android/Sdk/
209+
run $BUILD yes | ./Android/Sdk/tools/android update
210+
211+
# Install Apache Cordova
212+
run $BUILD mkdir Cordova
213+
run $BUILD/Cordova npm install -s cordova
214+
215+
# Create a fresh template project and copy in files
216+
run . cordova create android-template
217+
run android-template cordova platform add android
218+
run . rm -rf android-template/www android-template/res
219+
run . cp android-resources/* android-template/ -rf
220+
221+
# Install the Android SDK
222+
run $BUILD sdkmanager "build-tools;26.0.0"
223+
224+
## Remove downloads directory
225+
run $BUILD rm -rf downloads
226+
190227
# Go ahead and run a first build, which installs more local packages.
191228
./build.sh
229+

0 commit comments

Comments
 (0)