Skip to content

Commit 25a6e9a

Browse files
authored
Add logic to generate source file zip needed for documentation (#413)
* Collect source files to be documented * Update build_linux.yml * Update CMake files, remove from workflow for now * Update unity_pack.cmake * Update build_zips.py * Update firebase_swig.cmake * Remove debug statements
1 parent 30c3a58 commit 25a6e9a

File tree

16 files changed

+215
-37
lines changed

16 files changed

+215
-37
lines changed

analytics/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ if (FIREBASE_INCLUDE_UNITY)
7373
)
7474
endif()
7575

76+
unity_pack_documentation_sources(analytics
77+
DOCUMENTATION_SOURCES
78+
${firebase_analytics_src}
79+
${firebase_analytics_swig_gen_src}
80+
)
81+
7682
set_property(TARGET firebase_analytics_cs
7783
PROPERTY FOLDER
7884
"Firebase ${FIREBASE_PLATFORM_NAME}"

app/CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,18 @@ set(firebase_app_swig
3939
src/swig/app.i
4040
)
4141

42-
# Firebase App CSharp files
43-
set(firebase_app_src
42+
# Firebase App CSharp files that should be included in reference docs
43+
set(firebase_app_src_documented
4444
src/AppOptions.cs
4545
src/DependencyStatus.cs
46-
src/ErrorMessages.cs
4746
src/FirebaseException.cs
4847
src/InitializationException.cs
48+
)
49+
50+
# Firebase App CSharp files
51+
set(firebase_app_src
52+
${firebase_app_src_documented}
53+
src/ErrorMessages.cs
4954
src/LogUtil.cs
5055
src/VariantExtension.cs
5156
src/TaskCompletionSourceCompat.cs
@@ -112,6 +117,13 @@ if (FIREBASE_INCLUDE_UNITY)
112117
)
113118
endif()
114119

120+
unity_pack_documentation_sources(app
121+
DOCUMENTATION_SOURCES
122+
${firebase_app_src_documented}
123+
${firebase_app_swig_gen_src}
124+
task_extension/TaskExtension.cs
125+
)
126+
115127
set_property(TARGET firebase_app_cs
116128
PROPERTY FOLDER
117129
"Firebase ${FIREBASE_PLATFORM_NAME}"

auth/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ if (FIREBASE_INCLUDE_UNITY)
8787
)
8888
endif()
8989

90+
unity_pack_documentation_sources(auth
91+
DOCUMENTATION_SOURCES
92+
${firebase_auth_src}
93+
${firebase_auth_swig_gen_src}
94+
)
95+
9096
set_property(TARGET firebase_auth_cs
9197
PROPERTY FOLDER
9298
"Firebase ${FIREBASE_PLATFORM_NAME}"

auth/src/PhoneAuthProvider.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,44 @@
1818

1919
namespace Firebase.Auth {
2020

21+
/// @brief Use phone number text messages to authenticate.
22+
///
23+
/// Allows developers to use the phone number and SMS verification codes
24+
/// to authenticate a user.
25+
///
26+
/// The verification flow results in a Credential that can be used to,
27+
/// * Sign in to an existing phone number account/sign up with a new
28+
/// phone number
29+
/// * Link a phone number to a current user. This provider will be added to
30+
/// the user.
31+
/// * Update a phone number on an existing user.
32+
/// * Re-authenticate an existing user. This may be needed when a sensitive
33+
/// operation requires the user to be recently logged in.
34+
///
35+
/// Possible verification flows:
36+
/// (1) User manually enters verification code.
37+
/// - App calls @ref VerifyPhoneNumber.
38+
/// - Web verification page is displayed to user where they may need to
39+
/// solve a CAPTCHA. [iOS only].
40+
/// - Auth server sends the verification code via SMS to the provided
41+
/// phone number. App receives verification id via @ref CodeSent.
42+
/// - User receives SMS and enters verification code in app's GUI.
43+
/// - App uses user's verification code to call
44+
/// @ref PhoneAuthProvider::GetCredential.
45+
///
46+
/// (2) SMS is automatically retrieved (Android only).
47+
/// - App calls @ref VerifyPhoneNumber with `timeout_ms` > 0.
48+
/// - Auth server sends the verification code via SMS to the provided
49+
/// phone number.
50+
/// - SMS arrives and is automatically retrieved by the operating system.
51+
/// Credential is automatically created and passed to the app via
52+
/// @ref VerificationCompleted.
53+
///
54+
/// (3) Phone number is instantly verified (Android only).
55+
/// - App calls @ref VerifyPhoneNumber.
56+
/// - The operating system validates the phone number without having to
57+
/// send an SMS. Credential is automatically created and passed to
58+
/// the app via @ref VerificationCompleted.
2159
public sealed class PhoneAuthProvider : global::System.IDisposable {
2260
/// Maximum value of `autoVerifyTimeOutMs` in @ref VerifyPhoneNumber.
2361
/// @ref VerifyPhoneNumber will automatically clamp values to this amount.

cmake/firebase_swig.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ macro(firebase_swig_add_library name)
137137
${UNITY_SWIG_PUBLIC_DEP_INCLUDE}
138138
)
139139

140+
set(all_cpp_header_files)
141+
foreach (directory ${UNITY_SWIG_PUBLIC_DEP_INCLUDE})
142+
file(GLOB_RECURSE cpp_header_files "${directory}/*.h")
143+
list(APPEND all_cpp_header_files ${cpp_header_files})
144+
endforeach()
145+
140146
set_property(TARGET ${name} PROPERTY SWIG_GENERATED_INCLUDE_DIRECTORIES
141147
${FIREBASE_CPP_SDK_DIR}
142148
${FIREBASE_UNITY_DIR}
@@ -195,6 +201,12 @@ macro(firebase_swig_add_library name)
195201
add_custom_command(
196202
OUTPUT ${UNITY_SWIG_CS_FIX_FILE}
197203
DEPENDS ${UNITY_SWIG_CS_GEN_FILE}
204+
COMMAND
205+
python
206+
${CMAKE_CURRENT_LIST_DIR}/../swig_commenter.py
207+
--input=\"${all_cpp_header_files}\"
208+
--output=\"${UNITY_SWIG_CS_GEN_FILE}\"
209+
--namespace_prefix=\"Firebase\"
198210
COMMAND
199211
python
200212
${FIREBASE_SWIG_FIX_PY}

cmake/unity_pack.cmake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ endif()
3030
set(CPACK_GENERATOR "ZIP")
3131
set(CPACK_PACKAGE_VERSION "${FIREBASE_UNITY_SDK_VERSION}")
3232
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) # DO NOT pack the root directory.
33+
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
3334

3435
include(CPack)
3536

@@ -364,3 +365,25 @@ function(unity_pack_folder folder)
364365
DESTINATION ${UNITY_PACK_PACK_PATH}
365366
)
366367
endfunction()
368+
369+
# Packs files intended for documentation, under the documentation component
370+
#
371+
# unity_pack_documentation_sources(<name>
372+
# DOCUMENTATION_SOURCES
373+
# )
374+
#
375+
# Args:
376+
# name: Name of the subfolder to put it under
377+
# DOCUMENTATION_SOURCES: Files to package
378+
#
379+
function(unity_pack_documentation_sources name)
380+
set(multi DOCUMENTATION_SOURCES)
381+
cmake_parse_arguments(UNITY_PACK "" "" "${multi}" ${ARGN})
382+
383+
install(
384+
FILES ${UNITY_PACK_DOCUMENTATION_SOURCES}
385+
DESTINATION ${name}
386+
COMPONENT documentation
387+
EXCLUDE_FROM_ALL
388+
)
389+
endfunction()

crashlytics/CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,14 @@ set(firebase_crashlytics_swig
2828
src/swig/crashlytics.i
2929
)
3030

31+
# Firebase Crashlytics CSharp files that should be included in reference docs
32+
set(firebase_crashlytics_src_documented
33+
src/Crashlytics.cs
34+
)
35+
3136
# Firebase Crashlytics CSharp files
3237
set(firebase_crashlytics_src
33-
src/Crashlytics.cs
38+
${firebase_crashlytics_src_documented}
3439
src/ExceptionHandler.cs
3540
src/Impl.cs
3641
src/LoggedException.cs
@@ -120,6 +125,11 @@ if (FIREBASE_INCLUDE_UNITY)
120125
)
121126
endif()
122127

128+
unity_pack_documentation_sources(crashlytics
129+
DOCUMENTATION_SOURCES
130+
${firebase_crashlytics_src_documented}
131+
)
132+
123133
set_property(TARGET firebase_crashlytics_cs
124134
PROPERTY FOLDER
125135
"Firebase ${FIREBASE_PLATFORM_NAME}"

database/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ if (FIREBASE_INCLUDE_UNITY)
9191
)
9292
endif()
9393

94+
unity_pack_documentation_sources(database
95+
DOCUMENTATION_SOURCES
96+
${firebase_database_src}
97+
${firebase_database_swig_gen_src}
98+
)
99+
94100
set_property(TARGET firebase_database_cs
95101
PROPERTY FOLDER
96102
"Firebase ${FIREBASE_PLATFORM_NAME}"

dynamic_links/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ if (FIREBASE_INCLUDE_UNITY)
8585
)
8686
endif()
8787

88+
unity_pack_documentation_sources(dynamic_links
89+
DOCUMENTATION_SOURCES
90+
${firebase_dynamic_links_src}
91+
${firebase_dynamic_links_swig_gen_src}
92+
)
93+
8894
set_property(TARGET firebase_dynamic_links_cs
8995
PROPERTY FOLDER
9096
"Firebase ${FIREBASE_PLATFORM_NAME}"

firestore/CMakeLists.txt

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,41 +21,17 @@ set(firebase_firestore_swig
2121
src/swig/firestore.i
2222
)
2323

24-
# Firebase Firestore CSharp files
25-
set(firebase_firestore_src
26-
src/Converters/AnonymousTypeConverter.cs
27-
src/Converters/ArrayConverter.cs
28-
src/Converters/AttributedIdAssigner.cs
29-
src/Converters/AttributedTypeConverter.cs
30-
src/Converters/ConverterBase.cs
31-
src/Converters/ConverterCache.cs
32-
src/Converters/CustomConverter.cs
33-
src/Converters/DictionaryConverter.cs
34-
src/Converters/EnumConverter.cs
35-
src/Converters/EnumerableConverter.cs
36-
src/Converters/EnumerableConverterBase.cs
37-
src/Converters/IFirestoreInternalConverter.cs
38-
src/Converters/MapConverterBase.cs
39-
src/Converters/SimpleConverters.cs
40-
src/internal/AssertFailedException.cs
41-
src/internal/Enums.cs
42-
src/internal/EnvironmentVersion.cs
43-
src/internal/Hash.cs
44-
src/internal/Preconditions.cs
45-
src/internal/Util.cs
24+
# Firebase Firestore CSharp files that should be included in reference docs
25+
set(firebase_firestore_src_documented
4626
src/Blob.cs
47-
src/BuildStubs.cs
4827
src/CollectionReference.cs
49-
src/ConverterRegistry.cs
50-
src/DeserializationContext.cs
5128
src/DocumentChange.cs
5229
src/DocumentReference.cs
5330
src/DocumentSnapshot.cs
5431
src/FieldPath.cs
5532
src/FieldValue.cs
5633
src/FirebaseFirestore.cs
5734
src/FirebaseFirestoreSettings.cs
58-
src/FirestoreConverter.cs
5935
src/FirestoreDataAttribute.cs
6036
src/FirestoreDocumentIdAttribute.cs
6137
src/FirestoreEnumNameConverter.cs
@@ -64,13 +40,10 @@ set(firebase_firestore_src
6440
src/FirestorePropertyAttribute.cs
6541
src/GeoPoint.cs
6642
src/ListenerRegistration.cs
67-
src/ListenerRegistrationMap.cs
6843
src/LoadBundleTaskProgress.cs
6944
src/MetadataChanges.cs
70-
src/MonoPInvokeCallbackAttribute.cs
7145
src/Query.cs
7246
src/QuerySnapshot.cs
73-
src/SerializationContext.cs
7447
src/ServerTimestampAttribute.cs
7548
src/ServerTimestampBehavior.cs
7649
src/SetOptions.cs
@@ -79,11 +52,43 @@ set(firebase_firestore_src
7952
src/Timestamp.cs
8053
src/Transaction.cs
8154
src/TransactionOptions.cs
82-
src/TransactionManager.cs
8355
src/UnknownPropertyHandling.cs
56+
src/WriteBatch.cs
57+
)
58+
59+
# Firebase Firestore CSharp files
60+
set(firebase_firestore_src
61+
${firebase_firestore_src_documented}
62+
src/Converters/AnonymousTypeConverter.cs
63+
src/Converters/ArrayConverter.cs
64+
src/Converters/AttributedIdAssigner.cs
65+
src/Converters/AttributedTypeConverter.cs
66+
src/Converters/ConverterBase.cs
67+
src/Converters/ConverterCache.cs
68+
src/Converters/CustomConverter.cs
69+
src/Converters/DictionaryConverter.cs
70+
src/Converters/EnumConverter.cs
71+
src/Converters/EnumerableConverter.cs
72+
src/Converters/EnumerableConverterBase.cs
73+
src/Converters/IFirestoreInternalConverter.cs
74+
src/Converters/MapConverterBase.cs
75+
src/Converters/SimpleConverters.cs
76+
src/internal/AssertFailedException.cs
77+
src/internal/Enums.cs
78+
src/internal/EnvironmentVersion.cs
79+
src/internal/Hash.cs
80+
src/internal/Preconditions.cs
81+
src/internal/Util.cs
82+
src/BuildStubs.cs
83+
src/ConverterRegistry.cs
84+
src/DeserializationContext.cs
85+
src/FirestoreConverter.cs
86+
src/ListenerRegistrationMap.cs
87+
src/MonoPInvokeCallbackAttribute.cs
88+
src/SerializationContext.cs
89+
src/TransactionManager.cs
8490
src/ValueDeserializer.cs
8591
src/ValueSerializer.cs
86-
src/WriteBatch.cs
8792
)
8893

8994
add_subdirectory(src/swig)
@@ -174,6 +179,11 @@ if (FIREBASE_INCLUDE_UNITY)
174179
)
175180
endif()
176181

182+
unity_pack_documentation_sources(firestore
183+
DOCUMENTATION_SOURCES
184+
${firebase_firestore_src_documented}
185+
)
186+
177187
set_property(TARGET firebase_firestore_cs
178188
PROPERTY FOLDER
179189
"Firebase ${FIREBASE_PLATFORM_NAME}"

0 commit comments

Comments
 (0)