forked from mogoweb/chromium_webview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sync.sh
executable file
·166 lines (136 loc) · 6.5 KB
/
sync.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/bin/bash
#
# Copyright (c) 2013 mogoweb. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# A script used to sync libraries and source from Chromium project.
# before execute this script, you should make android_webview_apk under
# chromium source. We assume this script is in the second level folder of
# chromium's main source directory. you may need modify this script
# according to your source structure.
#
# Use --help to print full usage instructions.
#
PROGNAME=$(basename "$0")
PROGDIR=$(dirname "$0")
# Location of Chromium-top-level sources.
CHROMIUM_SRC=$(cd "$PROGDIR"/.. && pwd 2>/dev/null)
BUILDTYPE=Debug
CHROMIUMVIEW_PROJECT_ROOT=java
SHELLVIEW_TEST_PROJECT_ROOT=testshell/javatests
for opt; do
optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
case $opt in
--help|-h|-?)
HELP=true
;;
--release)
BUILDTYPE=Release
;;
--debug)
BUILDTYPE=Debug
;;
--project_root=*)
CHROMIUMVIEW_PROJECT_ROOT=$optarg
;;
-*)
panic "Unknown option $OPT, see --help." >&2
;;
esac
done
if [ "$HELP" ]; then
cat <<EOF
Usage: $PROGNAME [options]
Sync libraries and source from Chromium project.
Valid options:
--help|-h|-? Print this message.
--debug Use libraries under out/Debug.
--release Use libraries under out/Release.
--project_root=<path> The root of ChromiumView project
EOF
exit 0
fi
# libchromeview
arm-linux-androideabi-strip --strip-unneeded -o ${CHROMIUMVIEW_PROJECT_ROOT}/libs/armeabi-v7a/libchromeview.so ${CHROMIUM_SRC}/out/${BUILDTYPE}/lib/libchromeview.so
# android_webview
rsync -avz ${CHROMIUM_SRC}/out/${BUILDTYPE}/android_webview_apk/assets/*.pak ${CHROMIUMVIEW_PROJECT_ROOT}/assets
rsync -avz ${CHROMIUM_SRC}/android_webview/java/src/ ${CHROMIUMVIEW_PROJECT_ROOT}/src/
## Dependencies inferred from android_webview/Android.mk
# Resources.
rsync -avz ${CHROMIUM_SRC}/content/public/android/java/resource_map/ ${CHROMIUMVIEW_PROJECT_ROOT}/src/
rsync -avz ${CHROMIUM_SRC}/ui/android/java/resource_map/ ${CHROMIUMVIEW_PROJECT_ROOT}/src/
# sync content resources
sync_content_resources() {
# Sync content resources such as drawable, layout, etc. Assume they are not duplicate.
local resfolders=(drawable drawable-hdpi drawable-xhdpi layout layout-land menu mipmap-hdpi mipmap-mdpi mipmap-xhdpi mipmap-xxhdpi)
for folder in ${resfolders[*]}
do
rsync -avz ${CHROMIUM_SRC}/content/public/android/java/res/$folder/ ${CHROMIUMVIEW_PROJECT_ROOT}/res/$folder/
done
# Sync content resource such as strings. They may have duplicated name, so rename it
local stringfolders=(values/attrs values/dimens values/strings values-v17/styles)
for stringfolder in ${stringfolders[*]}
do
rsync -avz ${CHROMIUM_SRC}/content/public/android/java/res/${stringfolder}.xml ${CHROMIUMVIEW_PROJECT_ROOT}/res/${stringfolder}_content.xml
done
# Sync content strings. They are generated form grit
local gritfolders=(values values-zh-rCN)
for gritfolder in ${gritfolders[*]}
do
rsync -avz ${CHROMIUM_SRC}/out/${BUILDTYPE}/gen/content_java/res_grit/$gritfolder/ ${CHROMIUMVIEW_PROJECT_ROOT}/res/$gritfolder/
done
}
# sync ui resources
sync_ui_resources() {
# Sync ui resources such as drawable, layout, etc. Assume they are not duplicate.
local resfolders=(drawable drawable-hdpi drawable-xhdpi layout)
for folder in ${resfolders[*]}
do
rsync -avz ${CHROMIUM_SRC}/ui/android/java/res/$folder/ ${CHROMIUMVIEW_PROJECT_ROOT}/res/$folder/
done
# Sync ui resource such as strings. They may have duplicated name, so rename it
local stringfolders=(values/colors values/dimens values/strings values/values values-v17/styles)
for stringfolder in ${stringfolders[*]}
do
rsync -avz ${CHROMIUM_SRC}/ui/android/java/res/${stringfolder}.xml ${CHROMIUMVIEW_PROJECT_ROOT}/res/${stringfolder}_ui.xml
done
# Sync ui strings. They are generated form grit
local gritfolders=(values values-zh-rCN)
for gritfolder in ${gritfolders[*]}
do
rsync -avz ${CHROMIUM_SRC}/out/${BUILDTYPE}/gen/ui_java/res_grit/$gritfolder/ ${CHROMIUMVIEW_PROJECT_ROOT}/res/$gritfolder/
done
}
sync_content_resources
sync_ui_resources
# ContentView dependencies.
rsync -avz ${CHROMIUM_SRC}/base/android/java/src/ ${CHROMIUMVIEW_PROJECT_ROOT}/src/
rsync -avz ${CHROMIUM_SRC}/content/public/android/java/src/ ${CHROMIUMVIEW_PROJECT_ROOT}/src/
rsync -avz ${CHROMIUM_SRC}/media/base/android/java/src/ ${CHROMIUMVIEW_PROJECT_ROOT}/src/
rsync -avz ${CHROMIUM_SRC}/net/android/java/src/ ${CHROMIUMVIEW_PROJECT_ROOT}/src/
rsync -avz ${CHROMIUM_SRC}/ui/android/java/src/ ${CHROMIUMVIEW_PROJECT_ROOT}/src/
rsync -avz ${CHROMIUM_SRC}/third_party/eyesfree/src/android/java/src/ ${CHROMIUMVIEW_PROJECT_ROOT}/src/
# Strip files that's not supposed to be here.
rm ${CHROMIUMVIEW_PROJECT_ROOT}/src/org/chromium/content/common/common.aidl
rm ${CHROMIUMVIEW_PROJECT_ROOT}/src/org/chromium/net/IRemoteAndroidKeyStoreInterface.aidl
# Get rid of the .svn directory in eyesfree.
rm -rf ${CHROMIUMVIEW_PROJECT_ROOT}/src/com/googlecode/eyesfree/braille/.svn
# Browser components.
rsync -avz ${CHROMIUM_SRC}/components/web_contents_delegate_android/android/java/src/ ${CHROMIUMVIEW_PROJECT_ROOT}/src/
rsync -avz ${CHROMIUM_SRC}/components/navigation_interception/android/java/src/ ${CHROMIUMVIEW_PROJECT_ROOT}/src/
# Generated files.
rsync -avz ${CHROMIUM_SRC}/out/${BUILDTYPE}/gen/templates/ ${CHROMIUMVIEW_PROJECT_ROOT}/src/
# Get rid of
rm -rf ${CHROMIUMVIEW_PROJECT_ROOT}/src/org.chromium.content.browser
rm -rf ${CHROMIUMVIEW_PROJECT_ROOT}/src/org.chromium.net
# JARs.
rsync -avz ${CHROMIUM_SRC}/out/${BUILDTYPE}/lib.java/guava_javalib.jar ${CHROMIUMVIEW_PROJECT_ROOT}/libs/
rsync -avz ${CHROMIUM_SRC}/out/${BUILDTYPE}/lib.java/jsr_305_javalib.jar ${CHROMIUMVIEW_PROJECT_ROOT}/libs/
# android_webview generated sources. Must come after all the other sources.
rsync -avz ${CHROMIUM_SRC}/out/${BUILDTYPE}/android_webview_apk/native_libraries_java/NativeLibraries.java ${CHROMIUMVIEW_PROJECT_ROOT}/src/org/chromium/base/library_loader/
# replase standalonelibwebviewchromium with chromeview
sed -i "s/standalonelibwebviewchromium/chromeview/g" ${CHROMIUMVIEW_PROJECT_ROOT}/src/org/chromium/base/library_loader/NativeLibraries.java
# sync test class
rsync -avz ${CHROMIUM_SRC}/base/test/android/javatests/src/ ${SHELLVIEW_TEST_PROJECT_ROOT}/src/
rsync -avz ${CHROMIUM_SRC}/content/public/test/android/javatests/src/ ${SHELLVIEW_TEST_PROJECT_ROOT}/src/