Skip to content

Commit 7f89148

Browse files
committed
added script to deal with GVR SDK
1 parent fb3fd58 commit 7f89148

File tree

2 files changed

+137
-1
lines changed

2 files changed

+137
-1
lines changed

scripts/gvrsdk-update.sh

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
#!/bin/bash
2+
3+
# This script downloads the GVR SDK, explodes the AAR files, and creates zip packages than
4+
# can be used by the mode to generate the required libraries to build a cardboard sketch.
5+
# The steps in the AAR to ZIP conversion were based on this blogpost:
6+
# https://commonsware.com/blog/2014/07/03/consuming-aars-eclipse.html
7+
8+
# Usage:
9+
# call with the version number of the GVR SDK package to download and extract, i.e.:
10+
# ./gvrsdk-update.sh 1.0.1
11+
12+
ver=$1
13+
sdk=v$1
14+
15+
mkdir ../libraries/cardboard/gvrsdk/$ver
16+
17+
wget https://github.com/googlevr/gvr-android-sdk/archive/$sdk.zip
18+
19+
unzip $sdk.zip
20+
21+
#Explode the aars and create the corresponding zip packages to use in the mode
22+
unzip gvr-android-sdk-$ver/libraries/base/base.aar -d base.aar
23+
unzip gvr-android-sdk-$ver/libraries/common/common.aar -d common.aar
24+
unzip gvr-android-sdk-$ver/libraries/audio/audio.aar -d audio.aar
25+
26+
################################################
27+
# Base package
28+
mkdir base
29+
30+
# Start by copying manifest and resources
31+
cp base.aar/AndroidManifest.xml base
32+
cp -R base.aar/res/ base/res
33+
34+
# Extract classes from library's jar
35+
unzip base.aar/classes.jar -d base.aar/classes
36+
mkdir base/libs
37+
mkdir base/libs/base
38+
# Copy classes
39+
cp -R base.aar/classes/com base/libs/base/com
40+
# Copy native libs
41+
cp -R base.aar/jni base/libs/base/lib
42+
# Create the jar file
43+
jar cf base.jar -C base/libs/base .
44+
45+
# Remove original folder and put jar file in its final location
46+
rm -Rf base/libs/base
47+
mv base.jar base/libs
48+
49+
# Need the jar also in cardboard's lib folder
50+
cp base/libs/base.jar ../libraries/cardboard/lib
51+
52+
# Finally, create zip file and mode to the sdk location
53+
zip -r base.zip base
54+
mv base.zip ../libraries/cardboard/gvrsdk/$ver
55+
56+
57+
################################################
58+
# Common package
59+
mkdir common
60+
61+
# Start by copying manifest and resources
62+
cp common.aar/AndroidManifest.xml common
63+
cp -R common.aar/res/ common/res
64+
65+
# Extract classes from library's jar
66+
unzip common.aar/classes.jar -d common.aar/classes
67+
mkdir common/libs
68+
mkdir common/libs/common
69+
# Copy classes
70+
cp -R common.aar/classes/com common/libs/common/com
71+
# Create the jar file
72+
jar cf common.jar -C common/libs/common .
73+
74+
# Remove original folder and put jar file in its final location
75+
rm -Rf common/libs/common
76+
mv common.jar common/libs
77+
78+
# Need the jar also in cardboard's lib folder
79+
cp common/libs/common.jar ../libraries/cardboard/lib
80+
81+
# Finally, create zip file and mode to the sdk location
82+
zip -r common.zip common
83+
mv common.zip ../libraries/cardboard/gvrsdk/$ver
84+
85+
################################################
86+
# Audio package
87+
mkdir audio
88+
89+
# Start by copying manifest and resources
90+
cp audio.aar/AndroidManifest.xml audio
91+
cp -R audio.aar/res/ audio/res
92+
93+
# Extract classes from library's jar
94+
unzip audio.aar/classes.jar -d audio.aar/classes
95+
mkdir audio/libs
96+
mkdir audio/libs/audio
97+
# Copy classes
98+
cp -R audio.aar/classes/com audio/libs/audio/com
99+
# Copy native libs
100+
cp -R audio.aar/jni audio/libs/audio/lib
101+
# Create the jar file
102+
jar cf audio.jar -C audio/libs/audio .
103+
104+
# Remove original folder and put jar file in its final location
105+
rm -Rf audio/libs/audio
106+
mv audio.jar audio/libs
107+
108+
# Need the jar also in cardboard's lib folder
109+
cp audio/libs/audio.jar ../libraries/cardboard/lib
110+
111+
# Finally, create zip file and mode to the sdk location
112+
zip -r audio.zip audio
113+
mv audio.zip ../libraries/cardboard/gvrsdk/$ver
114+
115+
################################################
116+
# Cleanup
117+
rm -Rf base
118+
rm -Rf base.aar
119+
120+
rm -Rf common
121+
rm -Rf common.aar
122+
123+
rm -Rf audio
124+
rm -Rf audio.aar
125+
126+
rm -Rf gvr-android-sdk-$ver
127+
rm $sdk.zip
128+
129+
# Done, print out reminder...
130+
echo ""
131+
echo "Done!"
132+
echo "Remember to update the GVR path jar in the mode's source code"

scripts/info.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
Collection of utility scripts that I put here for the lack of a better place.
1+
Collection of utility scripts that I put here for the lack of a better place. They
2+
probably should become tasks/targets in the gradle/ant build scripts at some point.
23

34
compat-update.sh: generates the appcompat zip file containing the appcompat v7 package
45
found in the Android SDK's extras folder
56

7+
gvrsdk-update.sh: downloads the Google VR SDK and generates all required packages and jar
8+
files needed to build and run cardboard sketches from Processing
9+
610
perm-parse.py: generates the array of permissions for a given SDK level, to be pasted in
711
Permissions.java
812

0 commit comments

Comments
 (0)