Skip to content

Commit c975ab4

Browse files
authored
Fix the packaged build to have the correct generated headers, and also include instance ID impl. (#217)
Add missing desktop instance ID impl file and missing generated headers to desktop packaging.
1 parent 03e6698 commit c975ab4

File tree

1 file changed

+84
-74
lines changed

1 file changed

+84
-74
lines changed

build_scripts/desktop/package.sh

Lines changed: 84 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ usage(){
88
options:
99
-b, built sdk path or tar file required
1010
-o, output path required
11-
-p, platform to package required, one of: linux windows darwin
11+
-p, platform to package required, one of: linux windows darwin
1212
-d, build variant directory to create default: .
1313
-m, merge_libraries.py path default: <script dir>/../../scripts/merge_libraries.py
1414
-P, python command default: python
@@ -36,9 +36,9 @@ readonly SUPPORTED_PLATFORMS=(linux windows darwin)
3636

3737
abspath(){
3838
if [[ -d $1 ]]; then
39-
echo "$(cd "$1"; pwd -P)"
39+
echo "$(cd "$1"; pwd -P)"
4040
else
41-
echo "$(cd "$(dirname "$1")"; pwd -P)/$(basename "$1")"
41+
echo "$(cd "$(dirname "$1")"; pwd -P)/$(basename "$1")"
4242
fi
4343
}
4444

@@ -58,31 +58,31 @@ while getopts ":b:o:p:d:m:P:t:hv" opt; do
5858
exit 2
5959
fi
6060
;;
61-
v)
62-
verbose=1
63-
;;
61+
v)
62+
verbose=1
63+
;;
6464
d)
6565
variant=$OPTARG
6666
;;
6767
m)
6868
merge_libraries_script=$OPTARG
69-
if [[ ! -r "${merge_libraries_script}" ]]; then
69+
if [[ ! -r "${merge_libraries_script}" ]]; then
7070
echo "Script not found: ${merge_libraries_script}"
7171
exit 2
72-
fi
72+
fi
7373
;;
7474
P)
75-
python_cmd=$OPTARG
75+
python_cmd=$OPTARG
76+
;;
77+
t)
78+
tools_path=$OPTARG
79+
;;
80+
h)
81+
usage
82+
exit 0
7683
;;
77-
t)
78-
tools_path=$OPTARG
79-
;;
80-
h)
81-
usage
82-
exit 0
83-
;;
8484
*)
85-
usage
85+
usage
8686
exit 2
8787
;;
8888
esac
@@ -131,11 +131,11 @@ fi
131131
# Desktop packaging settings.
132132
if [[ "${platform}" == "windows" ]]; then
133133
if [[ "${variant}" == *'Debug'* ]]; then
134-
subdir='Debug/'
135-
suffix='-d'
134+
subdir='Debug/'
135+
suffix='-d'
136136
else
137-
subdir='Release/'
138-
suffix=''
137+
subdir='Release/'
138+
suffix=''
139139
fi
140140
prefix=''
141141
ext='lib'
@@ -149,7 +149,7 @@ fi
149149

150150
# Library dependencies to merge. Each should be a whitespace-delimited list of path globs.
151151
readonly deps_firebase_app="
152-
*/${prefix}firebase_instance_id*.${ext}
152+
*/${prefix}firebase_instance_id_desktop_impl*.${ext}
153153
*/${prefix}firebase_rest_lib.${ext}
154154
"
155155
readonly deps_hidden_firebase_app="
@@ -176,25 +176,25 @@ readonly deps_hidden_firebase_firestore="
176176
# List of C++ namespaces to be renamed, so as to not conflict with the
177177
# developer's own dependencies.
178178
readonly -a rename_namespaces=(flatbuffers flexbuffers reflection ZLib bssl uWS absl google
179-
base_raw_logging ConnectivityWatcher grpc
180-
grpc_access_token_credentials grpc_alts_credentials
181-
grpc_alts_server_credentials grpc_auth_context
182-
grpc_channel_credentials grpc_channel_security_connector
183-
grpc_chttp2_hpack_compressor grpc_chttp2_stream grpc_chttp2_transport
184-
grpc_client_security_context grpc_composite_call_credentials
185-
grpc_composite_channel_credentials grpc_core grpc_deadline_state
186-
grpc_google_default_channel_credentials grpc_google_iam_credentials
187-
grpc_google_refresh_token_credentials grpc_impl grpc_local_credentials
188-
grpc_local_server_credentials grpc_md_only_test_credentials
189-
grpc_message_compression_algorithm_for_level
190-
grpc_oauth2_token_fetcher_credentials grpc_plugin_credentials
191-
grpc_server_credentials grpc_server_security_connector
192-
grpc_server_security_context
193-
grpc_service_account_jwt_access_credentials grpc_ssl_credentials
194-
grpc_ssl_server_credentials grpc_tls_credential_reload_config
195-
grpc_tls_server_authorization_check_config GrpcUdpListener leveldb
196-
leveldb_filterpolicy_create_bloom leveldb_writebatch_iterate strings
197-
TlsCredentials TlsServerCredentials tsi)
179+
base_raw_logging ConnectivityWatcher grpc
180+
grpc_access_token_credentials grpc_alts_credentials
181+
grpc_alts_server_credentials grpc_auth_context
182+
grpc_channel_credentials grpc_channel_security_connector
183+
grpc_chttp2_hpack_compressor grpc_chttp2_stream grpc_chttp2_transport
184+
grpc_client_security_context grpc_composite_call_credentials
185+
grpc_composite_channel_credentials grpc_core grpc_deadline_state
186+
grpc_google_default_channel_credentials grpc_google_iam_credentials
187+
grpc_google_refresh_token_credentials grpc_impl grpc_local_credentials
188+
grpc_local_server_credentials grpc_md_only_test_credentials
189+
grpc_message_compression_algorithm_for_level
190+
grpc_oauth2_token_fetcher_credentials grpc_plugin_credentials
191+
grpc_server_credentials grpc_server_security_connector
192+
grpc_server_security_context
193+
grpc_service_account_jwt_access_credentials grpc_ssl_credentials
194+
grpc_ssl_server_credentials grpc_tls_credential_reload_config
195+
grpc_tls_server_authorization_check_config GrpcUdpListener leveldb
196+
leveldb_filterpolicy_create_bloom leveldb_writebatch_iterate strings
197+
TlsCredentials TlsServerCredentials tsi)
198198

199199
# String to prepend to all hidden symbols.
200200
readonly rename_string=f_b_
@@ -256,12 +256,12 @@ for product in ${product_list[*]}; do
256256
libfile_src="${product}/${subdir}${prefix}firebase_${product}.${ext}"
257257
libfile_out=$(basename "${libfile_src}")
258258
if [[ ! -r "${libfile_src}" ]]; then
259-
# Windows names some debug libraries with a "-d.lib" suffix.
260-
libfile_src="${product}/${subdir}${prefix}firebase_${product}${suffix}.${ext}"
261-
# Don't change libfile_out though.
262-
if [[ ! -r "${libfile_src}" ]]; then
263-
continue
264-
fi
259+
# Windows names some debug libraries with a "-d.lib" suffix.
260+
libfile_src="${product}/${subdir}${prefix}firebase_${product}${suffix}.${ext}"
261+
# Don't change libfile_out though.
262+
if [[ ! -r "${libfile_src}" ]]; then
263+
continue
264+
fi
265265
fi
266266

267267
# Look up the previously-set deps_firebase_* and deps_hidden_firebase_* vars.
@@ -271,52 +271,62 @@ for product in ${product_list[*]}; do
271271
deps=() # List of all dependencies, both hidden and visible.
272272
deps_basenames=() # Same as above but only filenames, for more readable logging to console.
273273
for dep in ${!deps_var} ${!deps_hidden_var}; do
274-
for found in $(find . -path ${dep}); do
275-
deps[${#deps[@]}]="${found}"
276-
deps_basenames[${#deps_basenames[@]}]=$(basename "${found}")
277-
done
274+
for found in $(find . -path "${dep}"); do
275+
deps[${#deps[@]}]="${found}"
276+
deps_basenames[${#deps_basenames[@]}]=$(basename "${found}")
277+
done
278278
done
279279
deps_hidden='' # comma-separated list of hidden deps only
280280
for dep in ${!deps_hidden_var}; do
281-
for found in $(find . -path ${dep}); do
282-
if [[ ! -z ${deps_hidden} ]]; then deps_hidden+=","; fi
283-
deps_hidden+="${found}"
284-
done
281+
for found in $(find . -path "${dep}"); do
282+
if [[ ! -z ${deps_hidden} ]]; then deps_hidden+=","; fi
283+
deps_hidden+="${found}"
284+
done
285285
done
286286
if [[ "${product}" != "app" ]]; then
287-
# For any library other than app, also rename some symbols that were already renamed in app
288-
# that are used by other libraries (e.g. zlib is used in Firestore).
289-
for dep in ${deps_hidden_firebase_app}; do
290-
for found in $(find . -path ${dep}); do
291-
if [[ ! -z ${deps_hidden} ]]; then deps_hidden+=","; fi
292-
deps_hidden+="${found}"
287+
# For any library other than app, also rename some symbols that were already renamed in app
288+
# that are used by other libraries (e.g. zlib is used in Firestore).
289+
for dep in ${deps_hidden_firebase_app}; do
290+
for found in $(find . -path ${dep}); do
291+
if [[ ! -z ${deps_hidden} ]]; then deps_hidden+=","; fi
292+
deps_hidden+="${found}"
293+
done
293294
done
294-
done
295295
fi
296296
echo -n "${libfile_out}"
297297
if [[ ! -z ${deps_basenames[*]} ]]; then
298-
echo -n " <- ${deps[*]}"
298+
echo -n " <- ${deps[*]}"
299299
fi
300300
echo
301301
outfile="${full_output_path}/${libfile_out}"
302302
rm -f "${outfile}"
303303
if [[ ${verbose} -eq 1 ]]; then
304-
echo "${python_cmd}" "${merge_libraries_script}" \
305-
${merge_libraries_params[*]} \
306-
--output="${outfile}" \
307-
--scan_libs="${allfiles}" \
308-
--hide_c_symbols="${deps_hidden}" \
309-
${libfile_src} ${deps[*]}
304+
echo "${python_cmd}" "${merge_libraries_script}" \
305+
${merge_libraries_params[*]} \
306+
--output="${outfile}" \
307+
--scan_libs="${allfiles}" \
308+
--hide_c_symbols="${deps_hidden}" \
309+
${libfile_src} ${deps[*]}
310310
fi
311311
"${python_cmd}" "${merge_libraries_script}" \
312-
${merge_libraries_params[*]} \
313-
--output="${outfile}" \
314-
--scan_libs="${allfiles}" \
315-
--hide_c_symbols="${deps_hidden}" \
316-
${libfile_src} ${deps[*]}
312+
${merge_libraries_params[*]} \
313+
--output="${outfile}" \
314+
--scan_libs="${allfiles}" \
315+
--hide_c_symbols="${deps_hidden}" \
316+
${libfile_src} ${deps[*]}
317317
done
318318
cd "${run_path}"
319319

320+
# Copy generated headers for app and analytics into the package's include directory.
321+
mkdir -p "${output_package_path}/include/firebase"
322+
cp -av \
323+
"${built_sdk_path}/generated/app/src/include/firebase/version.h" \
324+
"${output_package_path}/include/firebase"
325+
mkdir -p "${output_package_path}/include/firebase/analytics"
326+
cp -av \
327+
"${built_sdk_path}/generated/analytics/src/include/firebase/analytics/"* \
328+
"${output_package_path}/include/firebase/analytics"
329+
320330
# Copy Firestore core headers into the package's include directory.
321331
mkdir -p "${output_package_path}/include/firebase/firestore"
322332
cp -av \

0 commit comments

Comments
 (0)