forked from firebase/firebase-cpp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
610 lines (566 loc) · 38.5 KB
/
bcny-firebase.yml
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
name: firebase
on:
pull_request:
workflow_dispatch:
jobs:
windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- arch: 'amd64'
platform: 'x64'
- arch: 'arm64'
platform: 'ARM64'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
path: ${{ github.workspace }}/SourceCache/flatbuffers
ref: 99aa1ef21dd9dc3f9d4fb0eb82f4b59d0bb5e4c5
repository: google/flatbuffers
- uses: actions/checkout@v3
with:
fetch-depth: 1
path: ${{ github.workspace }}/SourceCache/firebase-cpp-sdk
repository: thebrowsercompany/firebase-cpp-sdk
- uses: compnerd/gha-setup-vsdevenv@main
with:
host_arch: amd64
components: 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64;Microsoft.VisualStudio.Component.VC.Tools.ARM64'
arch: ${{ matrix.arch }}
- uses: actions/setup-python@v4
id: python
with:
python-version: 3.9
architecture: 'x64'
- name: Install absl-py
run: pip install absl-py
- name: Configure flatbuffers
run:
exit 0
cmake -B ${{ github.workspace }}/BinaryCache/flatbuffers `
-D CMAKE_BUILD_TYPE=Release `
-G "Visual Studio 17 2022" `
-A x64 `
-S ${{ github.workspace }}/SourceCache/flatbuffers
- name: Build flatc
run: cmake --build ${{ github.workspace }}/BinaryCache/flatbuffers --config Release --target flatc
- name: Adjust cmake build settings for debugging
run: powershell ${{ github.workspace }}/SourceCache/firebase-cpp-sdk/build_scripts/windows/fix_cmake_debugflags.ps1 ${{ github.workspace }}/SourceCache/firebase-cpp-sdk/CMakeLists.txt
# For curl we set '-D HAVE_IOCTLSOCKET_FIONBIO=1'. This should automatically be set to 1 by
# https://github.com/curl/curl/blob/60580f9f214869b501ba0caaa5a6bf335e6aee1d/CMake/Platforms/WindowsCache.cmake
# but this is not what we observe in CI.
- name: Configure firebase
run:
cmake -B ${{ github.workspace }}/BinaryCache/firebase `
-D BUILD_SHARED_LIBS=NO `
-D CMAKE_BUILD_TYPE=Release `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/firebase/usr `
-G "Visual Studio 17 2022" `
-A ${{ matrix.platform }} `
-S ${{ github.workspace }}/SourceCache/firebase-cpp-sdk `
-D FLATBUFFERS_BUILD_FLATC=NO `
-D FIREBASE_CPP_BUILD_PACKAGE=YES `
-D FIREBASE_GITHUB_ACTION_BUILD=YES `
-D FIREBASE_INCLUDE_LIBRARY_DEFAULT=OFF `
-D FIREBASE_INCLUDE_AUTH=YES `
-D FIREBASE_INCLUDE_FIRESTORE=YES `
-D FIREBASE_INCLUDE_FUNCTIONS=YES `
-D FIREBASE_INCLUDE_STORAGE=YES `
-D FIREBASE_USE_BORINGSSL=YES `
-D MSVC_RUNTIME_LIBRARY_STATIC=NO `
-D CMAKE_C_FLAGS="/D_HAS_EXCEPTIONS=0 /EHsc- /arch:AVX2" `
-D CMAKE_CXX_FLAGS="/D_HAS_EXCEPTIONS=0 /EHsc- /arch:AVX2" `
-D CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded `
-D HAVE_IOCTLSOCKET_FIONBIO=1 `
-D FIREBASE_PYTHON_HOST_EXECUTABLE:FILEPATH=${{ steps.python.outputs.python-path }} `
-D FLATBUFFERS_FLATC_EXECUTABLE=${{ github.workspace }}/BinaryCache/flatbuffers/Release/flatc.exe
- name: Adjust external project build settings for debugging
run: |
$names = Get-ChildItem -Path "${{ github.workspace }}/BinaryCache/firebase" -File -Recurse -Filter CMakeLists.txt
foreach ($name in $names) {
$fullName = $name.FullName
powershell ${{ github.workspace }}/SourceCache/firebase-cpp-sdk/build_scripts/windows/fix_cmake_debugflags.ps1 $fullName
Write-Host "... fixed up debug options for ${fullName}"
}
- name: Configure firebase after build setting adjustments
run:
cmake -B ${{ github.workspace }}/BinaryCache/firebase `
-D BUILD_SHARED_LIBS=NO `
-D CMAKE_BUILD_TYPE=Release `
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/firebase/usr `
-G "Visual Studio 17 2022" `
-A ${{ matrix.platform }} `
-S ${{ github.workspace }}/SourceCache/firebase-cpp-sdk `
-D FLATBUFFERS_BUILD_FLATC=NO `
-D FIREBASE_CPP_BUILD_PACKAGE=YES `
-D FIREBASE_GITHUB_ACTION_BUILD=YES `
-D FIREBASE_INCLUDE_LIBRARY_DEFAULT=OFF `
-D FIREBASE_INCLUDE_AUTH=YES `
-D FIREBASE_INCLUDE_FIRESTORE=YES `
-D FIREBASE_INCLUDE_FUNCTIONS=YES `
-D FIREBASE_INCLUDE_STORAGE=YES `
-D FIREBASE_USE_BORINGSSL=YES `
-D MSVC_RUNTIME_LIBRARY_STATIC=NO `
-D CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded `
-D FIREBASE_PYTHON_HOST_EXECUTABLE:FILEPATH=${{ steps.python.outputs.python-path }} `
-D FLATBUFFERS_FLATC_EXECUTABLE=${{ github.workspace }}/BinaryCache/flatbuffers/Release/flatc.exe
# The step below is necessary since Snappy detects if it should use BMI2 instructions on x64 based only on its ability to
# compile BMI2 code on the host machine, but we need to disable BMI2 instructions so that the resulting nuget package
# can be used on target machines without BMI2 support. Unfortunately Snappy is pulled indirectly from
# another dependency (firebase-ios-sdk) in a very involved dependency chain and there is no good way to
# set SNAPPY_HAVE_BMI2 without patching its code since compiler directives have less precendence than
# the result of the host machine's check_cxx_source_compiles (which ends up in the config.h file).
# So, the less messy solution seems to be to patch the config.h file after the configure step, which is what we do below.
- name: Change SNAPPY_HAVE_BMI2 in snappy config.h
# BMI2 instructions are only relevant in amd64
if: matrix.arch == 'amd64'
run: |
$snappy_config = "${{ github.workspace }}\BinaryCache\firebase\external\src\firestore-build\external\src\snappy-build\config.h"
if (-not (Select-String -Path $snappy_config -Pattern "#define SNAPPY_HAVE_BMI2 1")) {
Write-Error "String '#define SNAPPY_HAVE_BMI2 1' expected but not found in $snappy_config"
exit 1
}
(Get-Content $snappy_config) -replace '#define SNAPPY_HAVE_BMI2 1', '#define SNAPPY_HAVE_BMI2 0' | Set-Content $snappy_config
- name: Build firebase
run: cmake --build ${{ github.workspace }}/BinaryCache/firebase --config RelWithDebInfo
- name: Install firebase
run: cmake --build ${{ github.workspace }}/BinaryCache/firebase --config RelWithDebInfo --target install
- name: Install firebase (manual)
run: |
Copy-Item "${{ github.workspace }}/BinaryCache/firebase/external/src/firestore/Firestore/core/include/firebase/firestore/firestore_errors.h" "${{ github.workspace }}/BuildRoot/Library/firebase/usr/include/firebase/firestore/firestore_errors.h"
Copy-Item "${{ github.workspace }}/BinaryCache/firebase/external/src/firestore/Firestore/core/include/firebase/firestore/geo_point.h" "${{ github.workspace }}/BuildRoot/Library/firebase/usr/include/firebase/firestore/geo_point.h"
Copy-Item "${{ github.workspace }}/BinaryCache/firebase/external/src/firestore/Firestore/core/include/firebase/firestore/timestamp.h" "${{ github.workspace }}/BuildRoot/Library/firebase/usr/include/firebase/firestore/timestamp.h"
Write-Host "Copying static libraries ..."
$source = "${{ github.workspace }}/BinaryCache/firebase"
$libraries = Get-ChildItem -Path $source -File -Recurse -Filter *.lib
foreach ($library in $libraries) {
$destination = Join-Path -Path "${{ github.workspace }}/BuildRoot/Library/firebase/usr/libs/windows" -ChildPath $library.Name
Copy-Item -Path $library.FullName -Destination $destination -Force
Write-Host "... copied ${destination}"
}
# We need this library to be used on CPUs without BMI2 support, so we check that snappy.lib was built correctly,
# and fail if it contains BMI2 instructions.
#
# Note: We explicitly check for bzhi because that is the BMI2 instruction used in snappy source code if BMI2 is enabled:
# https://github.com/google/snappy/blob/2c94e11145f0b7b184b831577c93e5a41c4c0346/snappy.cc#L1197
# It may be possible that the compiler decides to add other BMI2 instructions automatically, but by checking
# for the absense of 'bzhi' we are at least ensuring that the explicit SNAPPY_HAVE_BMI2 change in config.h is
# being respected.
- name: Check for Snappy BMI2 instructions
# BMI2 instructions are only relevant in amd64
if: matrix.arch == 'amd64'
run: |
Write-Host "Checking for BMI2 instructions on Snappy.lib..."
$snappy_lib = "${{ github.workspace }}/BuildRoot/Library/firebase/usr/libs/windows/snappy.lib"
$output = dumpbin /DISASM "$snappy_lib" | Select-String -Pattern "bzhi"
if ($output) {
Write-Host $output
Write-Error "ERROR: A BMI2 instruction ('bzhi') was not supposed to be found in $snappy_lib."
exit 1
} else {
Write-Output "Success! No BMI2 instructions were found in snappy.lib."
}
- uses: actions/upload-artifact@v3
with:
name: firebase-windows-${{ matrix.arch }}
path: ${{ github.workspace }}/BuildRoot/Library/firebase
- name: Print built libraries
run: Get-ChildItem -Recurse -Name -Path ${{ github.workspace }}\BuildRoot\Library\firebase -Include *.lib
- name: Package firebase-cpp-sdk
run: |
@"
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>com.google.firebase.windows.${{ matrix.arch }}</id>
<version>0.0.0.0</version>
<title>Firebase C++ SDK</title>
<description>C++ Firebase SDK</description>
<authors>Google, Inc.</authors>
<projectUrl>https://firebase.google.com</projectUrl>
<repository type="git" url="https://github.com/google/firebase-cpp-sdk" branch="main" />
</metadata>
<files>
<file src="`$BUILDROOT`$\usr\include\firebase\app.h" target="include/firebase" />
<file src="`$BUILDROOT`$\usr\include\firebase\auth.h" target="include/firebase" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore.h" target="include/firebase" />
<file src="`$BUILDROOT`$\usr\include\firebase\functions.h" target="include/firebase" />
<file src="`$BUILDROOT`$\usr\include\firebase\future.h" target="include/firebase" />
<file src="`$BUILDROOT`$\usr\include\firebase\log.h" target="include/firebase" />
<file src="`$BUILDROOT`$\usr\include\firebase\storage.h" target="include/firebase" />
<file src="`$BUILDROOT`$\usr\include\firebase\util.h" target="include/firebase" />
<file src="`$BUILDROOT`$\usr\include\firebase\variant.h" target="include/firebase" />
<file src="`$BUILDROOT`$\usr\include\firebase\auth\credential.h" target="include/firebase/auth" />
<file src="`$BUILDROOT`$\usr\include\firebase\auth\types.h" target="include/firebase/auth" />
<file src="`$BUILDROOT`$\usr\include\firebase\auth\user.h" target="include/firebase/auth" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\aggregate_query.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\aggregate_query_snapshot.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\aggregate_source.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\collection_reference.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\document_change.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\document_reference.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\document_snapshot.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\field_path.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\field_value.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\filter.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\firestore_errors.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\geo_point.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\listener_registration.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\load_bundle_task_progress.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\map_field_value.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\metadata_changes.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\query.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\query_snapshot.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\settings.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\set_options.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\snapshot_metadata.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\source.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\timestamp.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\transaction.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\transaction_options.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\firestore\write_batch.h" target="include/firebase/firestore" />
<file src="`$BUILDROOT`$\usr\include\firebase\functions\callable_reference.h" target="include/firebase/functions" />
<file src="`$BUILDROOT`$\usr\include\firebase\functions\callable_result.h" target="include/firebase/functions" />
<file src="`$BUILDROOT`$\usr\include\firebase\functions\common.h" target="include/firebase/functions" />
<file src="`$BUILDROOT`$\usr\include\firebase\storage\common.h" target="include/firebase/storage" />
<file src="`$BUILDROOT`$\usr\include\firebase\storage\controller.h" target="include/firebase/storage" />
<file src="`$BUILDROOT`$\usr\include\firebase\storage\listener.h" target="include/firebase/storage" />
<file src="`$BUILDROOT`$\usr\include\firebase\storage\metadata.h" target="include/firebase/storage" />
<file src="`$BUILDROOT`$\usr\include\firebase\storage\storage_reference.h" target="include/firebase/storage" />
<file src="`$BUILDROOT`$\usr\include\firebase\internal\common.h" target="include/firebase/internal" />
<file src="`$BUILDROOT`$\usr\include\firebase\internal\future_impl.h" target="include/firebase/internal" />
<file src="`$BUILDROOT`$\usr\include\firebase\internal\mutex.h" target="include/firebase/internal" />
<file src="`$BUILDROOT`$\usr\include\firebase\internal\platform.h" target="include/firebase/internal" />
<file src="`$BUILDROOT`$\usr\include\firebase\internal\type_traits.h" target="include/firebase/internal" />
<!-- FIXME(compnerd) is this header actually required? -->
<file src="`$BUILDROOT`$\usr\include\google_play_services\availability.h" target="include/google_play_services" />
<file src="`$BUILDROOT`$\usr\libs\windows\firebase_app.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\firebase_auth.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\firebase_firestore.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\firebase_functions.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\firebase_storage.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\firebase_rest_lib.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\firestore_core.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\firestore_nanopb.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\firestore_protos_nanopb.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\firestore_util.lib" target="lib" />
<!-- dependencies -->
<file src="`$BUILDROOT`$\usr\libs\windows\absl_bad_optional_access.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_bad_variant_access.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_base.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_city.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_civil_time.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_cord.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_cord_internal.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_cordz_functions.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_cordz_handle.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_cordz_info.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_crc_cord_state.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_crc_cpu_detect.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_crc_internal.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_crc32c.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_debugging_internal.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_demangle_internal.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_exponential_biased.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_flags_commandlineflag_internal.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_flags_commandlineflag.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_flags_config.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_flags_internal.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_flags_marshalling.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_flags_private_handle_accessor.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_flags_program_name.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_flags_reflection.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_graphcycles_internal.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_hash.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_hashtablez_sampler.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_int128.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_kernel_timeout_internal.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_log_severity.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_low_level_hash.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_malloc_internal.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_random_distributions.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_random_internal_seed_material.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_random_internal_platform.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_random_internal_pool_urbg.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_random_internal_randen.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_random_internal_randen_hwaes.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_random_internal_randen_hwaes_impl.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_random_internal_randen_slow.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_random_seed_gen_exception.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_random_seed_sequences.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_raw_hash_set.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_raw_logging_internal.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_spinlock_wait.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_stacktrace.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_status.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_statusor.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_str_format_internal.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_strerror.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_string_view.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_strings.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_strings_internal.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_symbolize.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_synchronization.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_throw_delegate.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_time.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\absl_time_zone.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\address_sorting.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\cares.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\crypto.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\fipsmodule.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\flatbuffers.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\gpr.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\grpc.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\grpc++.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\leveldb.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\libcurl.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\libprotobuf.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\libuWS.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\protobuf-nanopb.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\re2.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\snappy.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\ssl.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\uv_a.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\upb_base_lib.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\upb_json_lib.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\upb_mem_lib.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\upb_message_lib.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\upb_textformat_lib.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\utf8_range_lib.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\utf8_validity.lib" target="lib" />
<file src="`$BUILDROOT`$\usr\libs\windows\zlibstatic.lib" target="lib" />
</files>
</package>
"@ | Out-File -Encoding UTF8 firebase.nuspec
nuget pack -Properties BUILDROOT=${{ github.workspace }}\BuildRoot\Library\firebase -Suffix (git -C ${{ github.workspace }}/SourceCache/firebase-cpp-sdk log -1 --format=%h) firebase.nuspec
shell: pwsh
- uses: actions/upload-artifact@v3
if: github.event_name != 'pull_request'
with:
name: windows-${{ matrix.arch }}.nupkg
path: com.google.firebase.windows.${{ matrix.arch }}.*.nupkg
- name: Publish NuGet Packages
if: github.event_name != 'pull_request'
env:
NUGET_SOURCE_NAME: TheBrowserCompany
NUGET_SOURCE_URL: https://nuget.pkg.github.com/thebrowsercompany/index.json
NUGET_SOURCE_USERNAME: thebrowsercompany-bot2
NUGET_SOURCE_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }}
run: |
if ((nuget sources List | Select-String "${env:NUGET_SOURCE_NAME}").Count -gt 0) {
nuget sources Remove -Name "${env:NUGET_SOURCE_NAME}"
}
nuget sources Add -Name ${env:NUGET_SOURCE_NAME} -Source ${env:NUGET_SOURCE_URL} -Username ${env:NUGET_SOURCE_USERNAME} -Password ${env:NUGET_SOURCE_PASSWORD} -StorePasswordInClearText
nuget setApiKey ${env:NUGET_API_KEY} -Source ${env:NUGET_SOURCE_URL}
$pkgs = Get-ChildItem -Path com.google.firebase.windows.${{ matrix.arch }}.*.nupkg
nuget push $pkgs[0].Name -Source ${env:NUGET_SOURCE_URL} -SkipDuplicate
shell: pwsh
android:
runs-on: ubuntu-20.04
strategy:
fail-fast: true
matrix:
include:
- arch: 'arm64-v8a'
- arch: 'x86_64'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
path: ${{ github.workspace }}/SourceCache/firebase-cpp-sdk
ref: refs/heads/compnerd/swift
repository: thebrowsercompany/firebase-cpp-sdk
- uses: actions/checkout@v3
with:
path: ${{ github.workspace }}/SourceCache/firebase-android-sdk
repository: firebase/firebase-android-sdk
- name: Install Ninja
run: sudo apt-get install -y ninja-build
- name: Download Android NDK
run: |
NDK_VERSION="r21e"
NDK_FILE="android-ndk-${NDK_VERSION}-linux-x86_64.zip"
curl -L -o "${NDK_FILE}" "https://dl.google.com/android/repository/${NDK_FILE}"
unzip -q "${NDK_FILE}"
rm "${NDK_FILE}"
echo "NDK_ROOT=$(pwd)/android-ndk-${NDK_VERSION}" >> $GITHUB_ENV
echo "ANDROID_NDK_HOME=$(pwd)/android-ndk-${NDK_VERSION}" >> $GITHUB_ENV
- name: Install absl-py
run: pip install absl-py
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build Android
run: |
echo "NDK: $NDK_ROOT"
cd ${{ github.workspace }}/SourceCache/firebase-android-sdk
git submodule update --init --recursive
./gradlew :firebase-common:build
./gradlew tasks
find ${{ github.workspace }}/SourceCache/firebase-android-sdk -name "*.aar"
find ${{ github.workspace }}/SourceCache/firebase-android-sdk -name "*.jar"
exit 1
- name: Build
run: |
echo "NDK: $NDK_ROOT"
export SRC=${{ github.workspace }}/SourceCache/firebase-cpp-sdk
export DST=${{ github.workspace }}/SourceCache/firebase-cpp-sdk
function cmake_build {
arch=$1
module=$2
extra_params=$3
src_dir=$SRC
dst_dir=$DST
ndk_dir="$NDK_ROOT"
config_command="cmake \
-H$src_dir \
-B$dst_dir/$module/.externalNativeBuild/cmake/release/$arch \
-DANDROID_ABI=$arch \
-DANDROID_PLATFORM=android-19 \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$dst_dir/$module/build/intermediates/cmake/release/obj/$arch \
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/firebase/usr \
-DCMAKE_BUILD_TYPE=Debug \
-DANDROID_NDK=$ndk_dir \
-DCMAKE_TOOLCHAIN_FILE=$ndk_dir/build/cmake/android.toolchain.cmake \
-GNinja \
-DFIREBASE_INCLUDE_LIBRARY_DEFAULT=OFF \
-D FIREBASE_GITHUB_ACTION_BUILD=YES \
$extra_params"
echo "Configuring $module..."
eval "$config_command"
echo "Building $module..."
cmake --build $dst_dir/$module/.externalNativeBuild/cmake/release/$arch
}
arch="${{ matrix.arch }}"
cd ${{ github.workspace }}/SourceCache/firebase-cpp-sdk
# Prebuild the gradle app to avoid any gradle <-> cmake issues on GHA workflow.
./gradlew :app:invites_resources:generateDexJarRelease
# Build the invididual components
cmake_build $arch "app" ""
cmake_build $arch "storage" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_STORAGE=ON"
cmake_build $arch "messaging" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_MESSAGING=ON"
cmake_build $arch "analytics" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_ANALYTICS=ON"
cmake_build $arch "database" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_DATABASE=ON"
cmake_build $arch "gma" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_GMA=ON"
cmake_build $arch "dynamic_links" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_DYNAMIC_LINKS=ON"
cmake_build $arch "installations" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_INSTALLATIONS=ON"
cmake_build $arch "app_check" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_APP_CHECK=ON"
cmake_build $arch "firestore" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_FIRESTORE=ON"
cmake_build $arch "auth" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_AUTH=ON"
cmake_build $arch "functions" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_FUNCTIONS=ON"
cmake_build $arch "remote_config" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_REMOTE_CONFIG=ON"
- name: Install (manual)
run: |
echo "Copying static libraries ..."
source="${{ github.workspace }}/SourceCache/firebase-cpp-sdk"
destination_dir=${{ github.workspace }}/BuildRoot/Library/firebase/usr/libs/android/${{ matrix.arch }}
mkdir -p $destination_dir
while IFS= read -r file; do
cp "$file" "$destination_dir"
echo "Copied: $file"
done < <(find $source -type f -name "*.a")
echo "Copying header files ..."
header_destination_dir=${{ github.workspace }}/BuildRoot/Library/firebase/usr/include/firebase
firebase_dir=${{ github.workspace }}/SourceCache/firebase-cpp-sdk
mkdir -p $header_destination_dir \
$header_destination_dir/internal \
$header_destination_dir/auth \
$header_destination_dir/firestore \
$header_destination_dir/functions \
$header_destination_dir/storage
for header in ${firebase_dir}/app/src/include/firebase/app.h \
${firebase_dir}/app/src/include/firebase/future.h \
${firebase_dir}/app/src/include/firebase/log.h \
${firebase_dir}/app/src/include/firebase/util.h \
${firebase_dir}/app/src/include/firebase/variant.h \
${firebase_dir}/auth/src/include/firebase/auth.h \
${firebase_dir}/firestore/src/include/firebase/firestore.h \
${firebase_dir}/functions/src/include/firebase/functions.h \
${firebase_dir}/storage/src/include/firebase/storage.h \
; do
cp $header ${header_destination_dir}
done
for header in ${firebase_dir}/app/src/include/firebase/internal/*.h; do
cp $header ${header_destination_dir}/internal/
done
for header in ${firebase_dir}/auth/src/include/firebase/auth/*.h; do
cp $header ${header_destination_dir}/auth/
done
for header in ${firebase_dir}/firestore/src/include/firebase/firestore/*.h; do
cp $header ${header_destination_dir}/firestore/
done
for header in ${firebase_dir}/functions/src/include/firebase/functions/*.h; do
cp $header ${header_destination_dir}/functions/
done
for header in ${firebase_dir}/storage/src/include/firebase/storage/*.h; do
cp $header ${header_destination_dir}/storage/
done
for header in ${firebase_dir}/app/.externalNativeBuild/cmake/release/${{ matrix.arch }}/external/src/firestore/Firestore/core/include/firebase/firestore/firestore_errors.h \
${firebase_dir}/app/.externalNativeBuild/cmake/release/${{ matrix.arch }}/external/src/firestore/Firestore/core/include/firebase/firestore/geo_point.h \
${firebase_dir}/app/.externalNativeBuild/cmake/release/${{ matrix.arch }}/external/src/firestore/Firestore/core/include/firebase/firestore/timestamp.h ; do
cp $header ${header_destination_dir}/firestore/
done
mkdir -p "${{ github.workspace }}/BuildRoot/Library/firebase/usr/android"
for file in $(find ${firebase_dir} -name "*.aar"); do
cp "$file" "${{ github.workspace }}/BuildRoot/Library/firebase/usr/android"
done
find ${firebase_dir} -name "*.aar"
find ${firebase_dir} -name "*.jar"
- uses: actions/upload-artifact@v3
with:
name: firebase-android-${{ matrix.arch }}
path: ${{ github.workspace }}/BuildRoot/Library/firebase
release:
needs: [windows,android]
if: github.event_name != 'pull_request'
runs-on: windows-latest
steps:
- name: Download firebase-android-arm64-v8a artifact
uses: actions/download-artifact@v3
with:
name: firebase-android-arm64-v8a
path: ${{ github.workspace }}/firebase-android-arm64-v8a
- name: Download firebase-android-x86_64 artifact
uses: actions/download-artifact@v3
with:
name: firebase-android-x86_64
path: ${{ github.workspace }}/firebase-android-x86_64
- name: Download firebase-windows-amd64 artifact
uses: actions/download-artifact@v3
with:
name: firebase-windows-amd64
path: ${{ github.workspace }}/firebase-windows-amd64
- name: Download firebase-windows-arm64 artifact
uses: actions/download-artifact@v3
with:
name: firebase-windows-arm64
path: ${{ github.workspace }}/firebase-windows-arm64
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Compress-Archive -Path "${{ github.workspace }}/firebase-android-arm64-v8a" -DestinationPath firebase-android-arm64-v8a.zip
Get-FileHash -Path firebase-android-arm64-v8a.zip -Algorithm SHA256 > firebase-android-arm64-v8a.zip.sha256
Compress-Archive -Path "${{ github.workspace }}/firebase-android-x86_64" -DestinationPath firebase-android-x86_64.zip
Get-FileHash -Path firebase-android-x86_64.zip -Algorithm SHA256 > firebase-android-x86_64.zip.sha256
Compress-Archive -Path "${{ github.workspace }}/firebase-windows-amd64" -DestinationPath firebase-windows-amd64.zip
Get-FileHash -Path firebase-windows-amd64.zip -Algorithm SHA256 > firebase-windows-amd64.zip.sha256
Compress-Archive -Path "${{ github.workspace }}/firebase-windows-arm64" -DestinationPath firebase-windows-arm64.zip
Get-FileHash -Path firebase-windows-arm64.zip -Algorithm SHA256 > firebase-windows-arm64.zip.sha256
$Date = Get-Date -Format 'yyyyMMdd'
$Release = $(gh release list -R ${{ github.repository }} | Select-String -Pattern $Date -AllMatches).Count
gh release create "$Date.$Release" -R ${{ github.repository }}
gh release upload "$Date.$Release" firebase-android-arm64-v8a.zip -R ${{ github.repository }}
gh release upload "$Date.$Release" firebase-android-arm64-v8a.zip.sha256 -R ${{ github.repository }}
gh release upload "$Date.$Release" firebase-android-x86_64.zip -R ${{ github.repository }}
gh release upload "$Date.$Release" firebase-android-x86_64.zip.sha256 -R ${{ github.repository }}
gh release upload "$Date.$Release" firebase-windows-amd64.zip -R ${{ github.repository }}
gh release upload "$Date.$Release" firebase-windows-amd64.zip.sha256 -R ${{ github.repository }}
gh release upload "$Date.$Release" firebase-windows-arm64.zip -R ${{ github.repository }}
gh release upload "$Date.$Release" firebase-windows-arm64.zip.sha256 -R ${{ github.repository }}