Skip to content

Commit 7b9742a

Browse files
authored
Rationalize C++ source layout (#446)
* Fix file name to reflect platforms that it applies to. * Rename the 'ios' directory to 'main'. * Change cross-platform file suffixes to '_main'. * create_firebase_metadata_provider_apple should in fact be create_firebase_metadata_provider_ios. * Update integration_test_internal and comments.
1 parent 461479d commit 7b9742a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+234
-237
lines changed

firestore/CMakeLists.txt

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
if(APPLE AND NOT ANDROID)
1616
set(settings_apple_SRCS
17-
src/common/settings_ios.mm)
17+
src/common/settings_apple.mm)
1818
else()
1919
set(settings_apple_SRCS)
2020
endif()
@@ -179,76 +179,76 @@ set(android_SRCS
179179

180180
# Sources that apply to all non-Android platforms.
181181
set(main_SRCS
182-
src/ios/collection_reference_ios.cc
183-
src/ios/collection_reference_ios.h
184-
src/ios/converter_ios.h
185-
src/ios/document_change_ios.cc
186-
src/ios/document_change_ios.h
187-
src/ios/document_reference_ios.cc
188-
src/ios/document_reference_ios.h
189-
src/ios/document_snapshot_ios.cc
190-
src/ios/document_snapshot_ios.h
191-
src/ios/field_value_ios.cc
192-
src/ios/field_value_ios.h
193-
src/ios/firestore_ios.cc
194-
src/ios/firestore_ios.h
195-
src/ios/listener_ios.h
196-
src/ios/listener_registration_ios.cc
197-
src/ios/listener_registration_ios.h
198-
src/ios/promise_factory_ios.h
199-
src/ios/promise_ios.h
200-
src/ios/query_ios.cc
201-
src/ios/query_ios.h
202-
src/ios/query_snapshot_ios.cc
203-
src/ios/query_snapshot_ios.h
204-
src/ios/set_options_ios.h
205-
src/ios/source_ios.h
206-
src/ios/transaction_ios.cc
207-
src/ios/transaction_ios.h
208-
src/ios/user_data_converter_ios.cc
209-
src/ios/user_data_converter_ios.h
210-
src/ios/util_ios.h
211-
src/ios/write_batch_ios.cc
212-
src/ios/write_batch_ios.h)
182+
src/main/collection_reference_main.cc
183+
src/main/collection_reference_main.h
184+
src/main/converter_main.h
185+
src/main/document_change_main.cc
186+
src/main/document_change_main.h
187+
src/main/document_reference_main.cc
188+
src/main/document_reference_main.h
189+
src/main/document_snapshot_main.cc
190+
src/main/document_snapshot_main.h
191+
src/main/field_value_main.cc
192+
src/main/field_value_main.h
193+
src/main/firestore_main.cc
194+
src/main/firestore_main.h
195+
src/main/listener_main.h
196+
src/main/listener_registration_main.cc
197+
src/main/listener_registration_main.h
198+
src/main/promise_factory_main.h
199+
src/main/promise_main.h
200+
src/main/query_main.cc
201+
src/main/query_main.h
202+
src/main/query_snapshot_main.cc
203+
src/main/query_snapshot_main.h
204+
src/main/set_options_main.h
205+
src/main/source_main.h
206+
src/main/transaction_main.cc
207+
src/main/transaction_main.h
208+
src/main/user_data_converter_main.cc
209+
src/main/user_data_converter_main.h
210+
src/main/util_main.h
211+
src/main/write_batch_main.cc
212+
src/main/write_batch_main.h)
213213

214214
# CredentialsProvider has no implementatation on Android and distinct
215215
# implementations for iOS and desktop platforms. On iOS, the implementation of
216216
# the interface actually comes from the FirebaseFirestore CocoaPod, so there's
217217
# no implementation listed here.
218218
set(credentials_provider_desktop_SRCS
219-
src/ios/create_credentials_provider.h
220-
src/ios/create_credentials_provider_desktop.cc
221-
src/ios/credentials_provider_desktop.cc
222-
src/ios/credentials_provider_desktop.h)
219+
src/main/create_credentials_provider.h
220+
src/main/create_credentials_provider_desktop.cc
221+
src/main/credentials_provider_desktop.cc
222+
src/main/credentials_provider_desktop.h)
223223

224224
set(credentials_provider_ios_SRCS
225-
src/ios/create_credentials_provider.h
226-
src/ios/create_credentials_provider_ios.mm)
225+
src/main/create_credentials_provider.h
226+
src/main/create_credentials_provider_ios.mm)
227227

228228
# FirebaseMetadataProvider has no implementation on Android and distinct
229229
# implementations for iOS and desktop platforms. On iOS, the implementation of
230230
# the interface actually comes from the FirebaseFirestore CocoaPod, so there's
231231
# no implementation listed here.
232232
set(firebase_metadata_provider_desktop_SRCS
233-
src/ios/create_firebase_metadata_provider.h
234-
src/ios/create_firebase_metadata_provider_desktop.cc
235-
src/ios/firebase_metadata_provider_desktop.cc
236-
src/ios/firebase_metadata_provider_desktop.h)
233+
src/main/create_firebase_metadata_provider.h
234+
src/main/create_firebase_metadata_provider_desktop.cc
235+
src/main/firebase_metadata_provider_desktop.cc
236+
src/main/firebase_metadata_provider_desktop.h)
237237

238238
set(firebase_metadata_provider_ios_SRCS
239-
src/ios/create_firebase_metadata_provider.h
240-
src/ios/create_firebase_metadata_provider_apple.mm)
239+
src/main/create_firebase_metadata_provider.h
240+
src/main/create_firebase_metadata_provider_ios.mm)
241241

242242
set(wrapper_assertions_SRCS
243243
src/common/wrapper_assertions.cc
244244
src/common/wrapper_assertions.h)
245245

246246
set(ios_only_SRCS
247-
src/ios/create_firebase_metadata_provider_apple.mm)
247+
src/main/create_firebase_metadata_provider_ios.mm)
248248

249249
set(desktop_only_SRCS
250-
src/ios/create_firebase_metadata_provider_desktop.cc
251-
src/ios/firebase_metadata_provider_desktop.cc)
250+
src/main/create_firebase_metadata_provider_desktop.cc
251+
src/main/firebase_metadata_provider_desktop.cc)
252252

253253
if(ANDROID)
254254
set(firestore_platform_SRCS "${android_SRCS}")

firestore/integration_test_internal/src/field_value_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#elif defined(FIRESTORE_STUB_BUILD)
99
#include "firestore/src/stub/field_value_stub.h"
1010
#else
11-
#include "firestore/src/ios/field_value_ios.h"
11+
#include "firestore/src/main/field_value_main.h"
1212
#endif // defined(__ANDROID__)
1313

1414
#include "gmock/gmock.h"

firestore/integration_test_internal/src/firestore_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ TEST_F(FirestoreIntegrationTest, TestDocumentReferenceExposesFirestore) {
10271027
// aren't registered in the main cache. Because of that, Firestore objects
10281028
// will lazily create a new Firestore instance upon the first access. This
10291029
// doesn't affect production code, only tests.
1030-
// Also, the logic in `util_ios.h` can be modified to make sure that
1030+
// Also, the logic in `util_main.h` can be modified to make sure that
10311031
// `TestFirestore()` doesn't create a new Firestore instance if there isn't
10321032
// one already.
10331033
EXPECT_NE(nullptr, db->Document("foo/bar").firestore());

firestore/integration_test_internal/src/util/integration_test_util.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "firebase/app.h"
88
#include "firebase/firestore.h"
99
#include "firestore/src/common/hard_assert_common.h"
10-
#include "firestore/src/ios/firestore_ios.h"
10+
#include "firestore/src/main/firestore_main.h"
1111

1212
namespace firebase {
1313
namespace firestore {

firestore/src/android/field_value_android.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class FieldValueInternal {
3333
FieldValueInternal(Type type, const jni::Object& object);
3434

3535
// Constructs a FieldValueInternal from a value of a specific type. Note that
36-
// these constructors must match the equivalents in field_value_ios.h.
36+
// these constructors must match the equivalents in field_value_main.h.
3737
//
3838
// Of particular note is that these pass by value even though the Android
3939
// implementation does not retain the values. This is done to make the

firestore/src/common/cleanup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#if __ANDROID__
77
#include "firestore/src/android/firestore_android.h"
88
#else
9-
#include "firestore/src/ios/firestore_ios.h"
9+
#include "firestore/src/main/firestore_main.h"
1010
#endif // __ANDROID__
1111

1212
#include "firestore/src/common/type_mapping.h"

firestore/src/common/collection_reference.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#elif defined(FIRESTORE_STUB_BUILD)
1111
#include "firestore/src/stub/collection_reference_stub.h"
1212
#else
13-
#include "firestore/src/ios/collection_reference_ios.h"
13+
#include "firestore/src/main/collection_reference_main.h"
1414
#endif // defined(__ANDROID__)
1515

1616
namespace firebase {

firestore/src/common/document_change.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#elif defined(FIRESTORE_STUB_BUILD)
1111
#include "firestore/src/stub/document_change_stub.h"
1212
#else
13-
#include "firestore/src/ios/document_change_ios.h"
13+
#include "firestore/src/main/document_change_main.h"
1414
#endif // defined(__ANDROID__)
1515

1616
namespace firebase {

firestore/src/common/document_reference.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#elif defined(FIRESTORE_STUB_BUILD)
1818
#include "firestore/src/stub/document_reference_stub.h"
1919
#else
20-
#include "firestore/src/ios/document_reference_ios.h"
20+
#include "firestore/src/main/document_reference_main.h"
2121
#endif // defined(__ANDROID__)
2222

2323
namespace firebase {

firestore/src/common/document_snapshot.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#elif defined(FIRESTORE_STUB_BUILD)
1616
#include "firestore/src/stub/document_snapshot_stub.h"
1717
#else
18-
#include "firestore/src/ios/document_snapshot_ios.h"
18+
#include "firestore/src/main/document_snapshot_main.h"
1919
#endif // defined(__ANDROID__)
2020

2121
namespace firebase {

firestore/src/common/field_value.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#elif defined(FIRESTORE_STUB_BUILD)
1616
#include "firestore/src/stub/field_value_stub.h"
1717
#else
18-
#include "firestore/src/ios/field_value_ios.h"
18+
#include "firestore/src/main/field_value_main.h"
1919
#endif // defined(__ANDROID__)
2020

2121
namespace firebase {

firestore/src/common/firestore.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#elif defined(FIRESTORE_STUB_BUILD)
1818
#include "firestore/src/stub/firestore_stub.h"
1919
#else
20-
#include "firestore/src/ios/firestore_ios.h"
20+
#include "firestore/src/main/firestore_main.h"
2121
#endif // defined(__ANDROID__)
2222

2323
#ifdef __APPLE__

firestore/src/common/listener_registration.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#elif defined(FIRESTORE_STUB_BUILD)
1010
#include "firestore/src/stub/listener_registration_stub.h"
1111
#else
12-
#include "firestore/src/ios/listener_registration_ios.h"
12+
#include "firestore/src/main/listener_registration_main.h"
1313
#endif // defined(__ANDROID__)
1414

1515
namespace firebase {

firestore/src/common/query.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#elif defined(FIRESTORE_STUB_BUILD)
1717
#include "firestore/src/stub/query_stub.h"
1818
#else
19-
#include "firestore/src/ios/query_ios.h"
19+
#include "firestore/src/main/query_main.h"
2020
#endif // defined(__ANDROID__)
2121

2222
namespace firebase {

firestore/src/common/query_snapshot.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#elif defined(FIRESTORE_STUB_BUILD)
1313
#include "firestore/src/stub/query_snapshot_stub.h"
1414
#else
15-
#include "firestore/src/ios/query_snapshot_ios.h"
15+
#include "firestore/src/main/query_snapshot_main.h"
1616
#endif // defined(__ANDROID__)
1717

1818
namespace firebase {

firestore/src/common/settings.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ std::ostream& operator<<(std::ostream& out, const Settings& settings) {
5555
return out << settings.ToString();
5656
}
5757

58-
// Apple uses a different mechanism, defined in `settings_ios.mm`.
58+
// Apple uses a different mechanism, defined in `settings_apple.mm`.
5959
#if !defined(__APPLE__) && !defined(__ANDROID__) && \
6060
!defined(FIRESTORE_STUB_BUILD)
6161
std::unique_ptr<util::Executor> Settings::CreateExecutor() const {

firestore/src/common/transaction.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#elif defined(FIRESTORE_STUB_BUILD)
1010
#include "firestore/src/stub/transaction_stub.h"
1111
#else
12-
#include "firestore/src/ios/transaction_ios.h"
12+
#include "firestore/src/main/transaction_main.h"
1313
#endif // defined(__ANDROID__)
1414

1515
namespace firebase {

firestore/src/common/write_batch.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#elif defined(FIRESTORE_STUB_BUILD)
1313
#include "firestore/src/stub/write_batch_stub.h"
1414
#else
15-
#include "firestore/src/ios/write_batch_ios.h"
15+
#include "firestore/src/main/write_batch_main.h"
1616
#endif // defined(__ANDROID__)
1717

1818
namespace firebase {

firestore/src/ios/collection_reference_ios.cc renamed to firestore/src/main/collection_reference_main.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
#include "firestore/src/ios/collection_reference_ios.h"
1+
#include "firestore/src/main/collection_reference_main.h"
22

33
#include <future> // NOLINT(build/c++11)
44
#include <utility>
55

66
#include "Firestore/core/src/core/user_data.h"
7-
#include "firestore/src/ios/converter_ios.h"
8-
#include "firestore/src/ios/document_reference_ios.h"
9-
#include "firestore/src/ios/field_value_ios.h"
10-
#include "firestore/src/ios/user_data_converter_ios.h"
7+
#include "firestore/src/main/converter_main.h"
8+
#include "firestore/src/main/document_reference_main.h"
9+
#include "firestore/src/main/field_value_main.h"
10+
#include "firestore/src/main/user_data_converter_main.h"
1111

1212
namespace firebase {
1313
namespace firestore {

firestore/src/ios/collection_reference_ios.h renamed to firestore/src/main/collection_reference_main.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#ifndef FIREBASE_FIRESTORE_CLIENT_CPP_SRC_IOS_COLLECTION_REFERENCE_IOS_H_
2-
#define FIREBASE_FIRESTORE_CLIENT_CPP_SRC_IOS_COLLECTION_REFERENCE_IOS_H_
1+
#ifndef FIREBASE_FIRESTORE_CLIENT_CPP_SRC_MAIN_COLLECTION_REFERENCE_MAIN_H_
2+
#define FIREBASE_FIRESTORE_CLIENT_CPP_SRC_MAIN_COLLECTION_REFERENCE_MAIN_H_
33

44
#include <string>
55

66
#include "Firestore/core/src/api/collection_reference.h"
77
#include "firestore/src/include/firebase/firestore/document_reference.h"
8-
#include "firestore/src/ios/promise_factory_ios.h"
9-
#include "firestore/src/ios/query_ios.h"
8+
#include "firestore/src/main/promise_factory_main.h"
9+
#include "firestore/src/main/query_main.h"
1010

1111
namespace firebase {
1212
namespace firestore {
@@ -31,4 +31,4 @@ class CollectionReferenceInternal : public QueryInternal {
3131
} // namespace firestore
3232
} // namespace firebase
3333

34-
#endif // FIREBASE_FIRESTORE_CLIENT_CPP_SRC_IOS_COLLECTION_REFERENCE_IOS_H_
34+
#endif // FIREBASE_FIRESTORE_CLIENT_CPP_SRC_MAIN_COLLECTION_REFERENCE_MAIN_H_

firestore/src/ios/converter_ios.h renamed to firestore/src/main/converter_main.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef FIREBASE_FIRESTORE_CLIENT_CPP_SRC_IOS_CONVERTER_IOS_H_
2-
#define FIREBASE_FIRESTORE_CLIENT_CPP_SRC_IOS_CONVERTER_IOS_H_
1+
#ifndef FIREBASE_FIRESTORE_CLIENT_CPP_SRC_MAIN_CONVERTER_MAIN_H_
2+
#define FIREBASE_FIRESTORE_CLIENT_CPP_SRC_MAIN_CONVERTER_MAIN_H_
33

44
#include <memory>
55
#include <utility>
@@ -16,16 +16,16 @@
1616
#include "absl/memory/memory.h"
1717
#include "firestore/src/common/type_mapping.h"
1818
#include "firestore/src/include/firebase/firestore.h"
19-
#include "firestore/src/ios/collection_reference_ios.h"
20-
#include "firestore/src/ios/document_change_ios.h"
21-
#include "firestore/src/ios/document_reference_ios.h"
22-
#include "firestore/src/ios/document_snapshot_ios.h"
23-
#include "firestore/src/ios/field_value_ios.h"
24-
#include "firestore/src/ios/listener_registration_ios.h"
25-
#include "firestore/src/ios/query_ios.h"
26-
#include "firestore/src/ios/query_snapshot_ios.h"
27-
#include "firestore/src/ios/transaction_ios.h"
28-
#include "firestore/src/ios/write_batch_ios.h"
19+
#include "firestore/src/main/collection_reference_main.h"
20+
#include "firestore/src/main/document_change_main.h"
21+
#include "firestore/src/main/document_reference_main.h"
22+
#include "firestore/src/main/document_snapshot_main.h"
23+
#include "firestore/src/main/field_value_main.h"
24+
#include "firestore/src/main/listener_registration_main.h"
25+
#include "firestore/src/main/query_main.h"
26+
#include "firestore/src/main/query_snapshot_main.h"
27+
#include "firestore/src/main/transaction_main.h"
28+
#include "firestore/src/main/write_batch_main.h"
2929

3030
namespace firebase {
3131
namespace firestore {
@@ -128,4 +128,4 @@ inline const api::DocumentSnapshot& GetCoreApi(const DocumentSnapshot& from) {
128128
} // namespace firestore
129129
} // namespace firebase
130130

131-
#endif // FIREBASE_FIRESTORE_CLIENT_CPP_SRC_IOS_CONVERTER_IOS_H_
131+
#endif // FIREBASE_FIRESTORE_CLIENT_CPP_SRC_MAIN_CONVERTER_MAIN_H_

firestore/src/ios/create_credentials_provider.h renamed to firestore/src/main/create_credentials_provider.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef FIREBASE_FIRESTORE_CLIENT_CPP_SRC_IOS_CREATE_CREDENTIALS_PROVIDER_H_
2-
#define FIREBASE_FIRESTORE_CLIENT_CPP_SRC_IOS_CREATE_CREDENTIALS_PROVIDER_H_
1+
#ifndef FIREBASE_FIRESTORE_CLIENT_CPP_SRC_MAIN_CREATE_CREDENTIALS_PROVIDER_H_
2+
#define FIREBASE_FIRESTORE_CLIENT_CPP_SRC_MAIN_CREATE_CREDENTIALS_PROVIDER_H_
33

44
#include <memory>
55

@@ -16,4 +16,4 @@ std::unique_ptr<auth::CredentialsProvider> CreateCredentialsProvider(App& app);
1616
} // namespace firestore
1717
} // namespace firebase
1818

19-
#endif // FIREBASE_FIRESTORE_CLIENT_CPP_SRC_IOS_CREATE_CREDENTIALS_PROVIDER_H_
19+
#endif // FIREBASE_FIRESTORE_CLIENT_CPP_SRC_MAIN_CREATE_CREDENTIALS_PROVIDER_H_

firestore/src/ios/create_credentials_provider_desktop.cc renamed to firestore/src/main/create_credentials_provider_desktop.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "absl/memory/memory.h"
22
#include "auth/src/include/firebase/auth.h"
3-
#include "firestore/src/ios/create_credentials_provider.h"
4-
#include "firestore/src/ios/credentials_provider_desktop.h"
3+
#include "firestore/src/main/create_credentials_provider.h"
4+
#include "firestore/src/main/credentials_provider_desktop.h"
55

66
namespace firebase {
77
namespace firestore {

firestore/src/ios/create_credentials_provider_ios.mm renamed to firestore/src/main/create_credentials_provider_ios.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "firestore/src/ios/create_credentials_provider.h"
1+
#include "firestore/src/main/create_credentials_provider.h"
22

33
#import "FirebaseCoreInternal.h"
44
#import "FIRAuthInterop.h"

0 commit comments

Comments
 (0)