-
Notifications
You must be signed in to change notification settings - Fork 0
/
shade_external_libraries.sh
executable file
·28 lines (20 loc) · 1.14 KB
/
shade_external_libraries.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
export ZXING_SOURCE=https://github.com/zxing/zxing/archive/zxing-3.3.1.zip
set -x
set -e
if [ -d "experiences/src/main/java/io/rover/shaded/zxing" ]; then
echo "ZXing library already fetched and shaded into the build. Skipping."
exit
fi
mkdir -p shade/bits
curl -C - -L $ZXING_SOURCE -o shade/bits/zxing.zip
rm -rf shade/extracted
mkdir -p shade/extracted
unzip shade/bits/zxing.zip -d shade/extracted
# Now that we have all of our third party code downloaded locally, let's blow away our current shaded source directory and rebuild it:
rm -rf experiences/src/main/java/io/rover/shaded
mkdir -p experiences/src/main/java/io/rover/shaded
cp -R shade/extracted/zxing-zxing-3.3.1/core/src/main/java experiences/src/main/java/io/rover/shaded/zxing
# Now we want to patch all the java files (both package and import directives) to be their shaded equivalent: com.google.zxing -> io.rover.shaded.com.google.zxing
# I might be assuming BSD-like (cough-Apple-cough) userland here.
find experiences/src/main/java/io/rover/shaded/zxing -type f -print0 | xargs -0 -I {} sed -i.bak s/com.google.zxing/io.rover.shaded.zxing.com.google.zxing/g {}