Skip to content

Add generated docs check and generated headers target, and remove FIREBASE_NAMESPACE macro. #499

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0adb899
Add generated headers target, Doxyfile, and Doxygen check.
jonsimantov Jun 29, 2021
0acffa8
Add workflow.
jonsimantov Jun 29, 2021
2fb3ecf
Fix format
jonsimantov Jun 29, 2021
fa02b9a
Fix whitespace
jonsimantov Jun 29, 2021
010579b
Output Doxygen error messages
jonsimantov Jun 29, 2021
483315a
Fix newlines
jonsimantov Jun 29, 2021
8929aac
Add Doxygen options.
jonsimantov Jun 29, 2021
f8aba69
Update warnings.
jonsimantov Jun 29, 2021
934fee2
Update warnings.
jonsimantov Jun 29, 2021
b466e5d
Tweak warnings.
jonsimantov Jun 29, 2021
211f7b8
Fix cross-reference error with App and Future.
jonsimantov Jun 29, 2021
0e17241
Fix script
jonsimantov Jun 29, 2021
29e09a9
Fix formatting.
jonsimantov Jun 29, 2021
58ac93a
Fix parameter.
jonsimantov Jun 29, 2021
9f5acf0
Test bad param name.
jonsimantov Jun 29, 2021
855b360
Restore Firestore header.
jonsimantov Jun 29, 2021
e14560f
Output errors separately.
jonsimantov Jun 29, 2021
21fa2fc
Add missing documentation to certain headers.
jonsimantov Jun 29, 2021
d096176
Fix typo.
jonsimantov Jun 30, 2021
c5d0953
Add filtering to remove <SWIG>..</SWIG>, and check for errors too.
jonsimantov Jun 30, 2021
c4dd1ea
Always grep for errors.
jonsimantov Jun 30, 2021
04880f7
Fix filter and rename workflow job.
jonsimantov Jun 30, 2021
0645fb0
Slight doc rephrase.
jonsimantov Jun 30, 2021
0d7efe6
Also print a nice GitHub log message for formatting code.
jonsimantov Jun 30, 2021
151a6d8
Fix script and call it with github_log option enabled.
jonsimantov Jun 30, 2021
839da78
Update github log message.
jonsimantov Jun 30, 2021
b69ac2a
Change message header and fix the formatting issue we were testing.
jonsimantov Jun 30, 2021
7ab0128
Change output slightly.
jonsimantov Jun 30, 2021
8bfeb70
Remove all usage of FIREBASE_NAMESPACE, replacing it with just
jonsimantov Jun 30, 2021
17a40b0
Reformat files.
jonsimantov Jun 30, 2021
0de4d33
Remove one last FIREBASE_NAMESPACE.
jonsimantov Jun 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: git fetch origin main
- name: Detect Formatting Changes
shell: bash
run: python3 scripts/format_code.py -git_diff -noformat_file -verbose
run: python3 scripts/format_code.py -git_diff -noformat_file -verbose -github_log

check_integration_test_labels:
# This check fails if integration tests are queued, in progress, or failed.
Expand All @@ -42,4 +42,37 @@ jobs:
none_of: "${{ env.statusLabelInProgress }},${{ env.statusLabelFailed }},${{ env.triggerLabelFull }},${{ env.triggerLabelQuick }}"
repo_token: ${{ github.token }}


generated_docs_check:
# This check succeeds if Doxygen documentation generates without errors.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: false
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install prerequisites
run: python scripts/gha/install_prereqs_desktop.py
- name: Generate headers
run: |
mkdir build
cd build
cmake ..
cmake --build . --target FIREBASE_GENERATED_HEADERS
- name: Install doxygen
run: sudo apt-get install doxygen
- name: Run doxygen
run: |
cp docs/Doxyfile /tmp/Doxyfile
echo INPUT = $(find */src/include/firebase/ build/generated/ -name '*.h') >> /tmp/Doxyfile
doxygen /tmp/Doxyfile 2>doxygen_errors.txt
cat doxygen_errors.txt
- name: Check output
run: |
if grep -Eq "error:|warning:" doxygen_errors.txt; then
# Grep for warnings and print them out (replacing \n with %0A for github log)
grep -E "error:|warning:|^ parameter" doxygen_errors.txt | sed ':a;N;$!ba;s/\n/%0A/g' | sed 's/^/::error ::DOXYGEN ERRORS: %0A/'
exit 1
fi
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,12 @@ if(FIREBASE_CPP_BUILD_TESTS)
add_subdirectory(testing)
endif()

# Custom target containing all generated headers, used to generate docs only.
add_custom_target(FIREBASE_GENERATED_HEADERS)

if(NOT FIREBASE_CPP_USE_PRIOR_GRADLE_BUILD)
add_subdirectory(app)
add_dependencies(FIREBASE_GENERATED_HEADERS FIREBASE_APP_GENERATED_HEADERS)
else()
# Add firebase_app as a target on the previously built app.
add_library(firebase_app STATIC IMPORTED GLOBAL)
Expand All @@ -552,6 +556,7 @@ if (FIREBASE_INCLUDE_ADMOB)
endif()
if (FIREBASE_INCLUDE_ANALYTICS)
add_subdirectory(analytics)
add_dependencies(FIREBASE_GENERATED_HEADERS FIREBASE_ANALYTICS_GENERATED_HEADERS)
endif()
if (FIREBASE_INCLUDE_AUTH)
add_subdirectory(auth)
Expand All @@ -564,6 +569,7 @@ if (FIREBASE_INCLUDE_DYNAMIC_LINKS)
endif()
if (FIREBASE_INCLUDE_FIRESTORE)
add_subdirectory(firestore)
add_dependencies(FIREBASE_GENERATED_HEADERS FIREBASE_FIRESTORE_GENERATED_HEADERS)
endif()
if (FIREBASE_INCLUDE_FUNCTIONS)
add_subdirectory(functions)
Expand Down
6 changes: 6 additions & 0 deletions analytics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ generate_analytics_header(
"${CMAKE_CURRENT_LIST_DIR}/ios_headers/FIRUserPropertyNames.h"
"${user_property_names_header}"
)
add_custom_target(FIREBASE_ANALYTICS_GENERATED_HEADERS
DEPENDS
"${user_property_names_header}"
"${parameter_names_header}"
"${event_names_header}"
)

# Common source files used by all platforms
set(common_SRCS
Expand Down
1 change: 1 addition & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ binary_to_array("invites_resources"
# Generate version.h
set(version_header_dir ${FIREBASE_GEN_FILE_DIR}/app/src/include/firebase)
set(version_header ${version_header_dir}/version.h)
add_custom_target(FIREBASE_APP_GENERATED_HEADERS DEPENDS "${version_header}")
file(MAKE_DIRECTORY ${version_header_dir})
add_custom_command(
OUTPUT ${version_header}
Expand Down
8 changes: 2 additions & 6 deletions app/memory/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
#include <atomic>
#endif // !defined(_STLPORT_VERSION)

#if !defined(FIREBASE_NAMESPACE)
#define FIREBASE_NAMESPACE firebase
#endif

namespace FIREBASE_NAMESPACE {
namespace firebase {
namespace compat {

// For now only the types below are allowed to be atomic. Feel free to add more
Expand Down Expand Up @@ -149,5 +145,5 @@ T Atomic<T>::fetch_sub(T arg) {

} // namespace compat
// NOLINTNEXTLINE - allow namespace overridden
} // namespace FIREBASE_NAMESPACE
} // namespace firebase
#endif // FIREBASE_APP_CLIENT_CPP_MEMORY_ATOMIC_H_
10 changes: 3 additions & 7 deletions app/memory/shared_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
#include "app/meta/move.h"
#include "app/src/include/firebase/internal/type_traits.h"

#if !defined(FIREBASE_NAMESPACE)
#define FIREBASE_NAMESPACE firebase
#endif

namespace FIREBASE_NAMESPACE {
namespace firebase {

namespace internal {

Expand All @@ -49,7 +45,7 @@ class ControlBlock {
uint64_t ref_count() const { return ref_count_.load(); }

private:
::FIREBASE_NAMESPACE::compat::Atomic<uint64_t> ref_count_;
::firebase::compat::Atomic<uint64_t> ref_count_;
};

} // namespace internal
Expand Down Expand Up @@ -229,5 +225,5 @@ void SharedPtr<T>::Clear() {
ctrl_ = nullptr;
}
// NOLINTNEXTLINE - allow namespace overridden
} // namespace FIREBASE_NAMESPACE
} // namespace firebase
#endif // FIREBASE_APP_CLIENT_CPP_MEMORY_SHARED_PTR_H_
8 changes: 2 additions & 6 deletions app/memory/unique_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
#include "app/meta/move.h"
#include "app/src/include/firebase/internal/type_traits.h"

#if !defined(FIREBASE_NAMESPACE)
#define FIREBASE_NAMESPACE firebase
#endif

namespace FIREBASE_NAMESPACE {
namespace firebase {

// Smart pointer that owns another object and releases it when destroyed.
//
Expand Down Expand Up @@ -123,6 +119,6 @@ UniquePtr<T> MakeUnique(Args&&... args) {
}

// NOLINTNEXTLINE - allow namespace overridden
} // namespace FIREBASE_NAMESPACE
} // namespace firebase

#endif // FIREBASE_APP_CLIENT_CPP_MEMORY_UNIQUE_PTR_H_
8 changes: 2 additions & 6 deletions app/meta/move.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@

#include "app/src/include/firebase/internal/type_traits.h"

#if !defined(FIREBASE_NAMESPACE)
#define FIREBASE_NAMESPACE firebase
#endif

namespace FIREBASE_NAMESPACE {
namespace firebase {

// Casts the argument to an rvalue-reference.
//
Expand Down Expand Up @@ -51,6 +47,6 @@ inline T&& Forward(typename remove_reference<T>::type&& arg) {
}

// NOLINTNEXTLINE - allow namespace overridden
} // namespace FIREBASE_NAMESPACE
} // namespace firebase

#endif // FIREBASE_APP_CLIENT_CPP_META_MOVE_H_
8 changes: 2 additions & 6 deletions app/src/app_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@
#define strtok_r strtok_s
#endif // FIREBASE_PLATFORM_WINDOWS

#if !defined(FIREBASE_NAMESPACE)
#define FIREBASE_NAMESPACE firebase
#endif

namespace FIREBASE_NAMESPACE {
namespace firebase {

#ifdef FIREBASE_LINUX_BUILD_CONFIG_STRING
void CheckCompilerString(const char* input) {
Expand Down Expand Up @@ -487,4 +483,4 @@ Logger* FindAppLoggerByName(const char* name) {

} // namespace app_common
// NOLINTNEXTLINE - allow namespace overridden
} // namespace FIREBASE_NAMESPACE
} // namespace firebase
8 changes: 2 additions & 6 deletions app/src/app_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@
#include "app/src/include/firebase/app.h"
#include "app/src/logger.h"

#if !defined(FIREBASE_NAMESPACE)
#define FIREBASE_NAMESPACE firebase
#endif

namespace FIREBASE_NAMESPACE {
namespace firebase {

// Default app name.
extern const char* const kDefaultAppName;
Expand Down Expand Up @@ -102,6 +98,6 @@ Logger* FindAppLoggerByName(const char* name);

} // namespace app_common
// NOLINTNEXTLINE - allow namespace overridden
} // namespace FIREBASE_NAMESPACE
} // namespace firebase

#endif // FIREBASE_APP_CLIENT_CPP_SRC_APP_COMMON_H_
4 changes: 2 additions & 2 deletions app/src/app_identifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "app/src/include/firebase/app.h"

namespace FIREBASE_NAMESPACE {
namespace firebase {
namespace internal {

// Generate a unique identifier from the Firebase app options.
Expand All @@ -42,4 +42,4 @@ std::string CreateAppIdentifierFromOptions(const AppOptions& options) {
}

} // namespace internal
} // namespace FIREBASE_NAMESPACE
} // namespace firebase
4 changes: 2 additions & 2 deletions app/src/app_identifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

#include "app/src/include/firebase/app.h"

namespace FIREBASE_NAMESPACE {
namespace firebase {
namespace internal {

// Generate a unique identifier from the Firebase app options.
std::string CreateAppIdentifierFromOptions(const AppOptions& options);

} // namespace internal
} // namespace FIREBASE_NAMESPACE
} // namespace firebase

#endif // FIREBASE_APP_CLIENT_CPP_SRC_APP_IDENTIFIER_H_
10 changes: 3 additions & 7 deletions app/src/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
__FILE__ "(" FIREBASE_EXPAND_STRINGIFY(__LINE__) "): "
#endif // defined(NDEBUG)

#if !defined(FIREBASE_NAMESPACE)
#define FIREBASE_NAMESPACE firebase
#endif

// FIREBASE_ASSERT_* macros are not compiled out of release builds. They should
// be used for assertions that need to be propagated to end-users of SDKs.
// FIREBASE_DEV_ASSERT_* macros are compiled out of release builds, similar to
Expand All @@ -47,7 +43,7 @@
#define FIREBASE_ASSERT_WITH_EXPRESSION(condition, expression) \
do { \
if (!(condition)) { \
FIREBASE_NAMESPACE::LogAssert( \
firebase::LogAssert( \
FIREBASE_ASSERT_MESSAGE_PREFIX FIREBASE_EXPAND_STRINGIFY( \
expression)); \
} \
Expand Down Expand Up @@ -113,10 +109,10 @@
#define FIREBASE_ASSERT_MESSAGE_WITH_EXPRESSION(condition, expression, ...) \
do { \
if (!(condition)) { \
FIREBASE_NAMESPACE::LogError( \
firebase::LogError( \
FIREBASE_ASSERT_MESSAGE_PREFIX FIREBASE_EXPAND_STRINGIFY( \
expression)); \
FIREBASE_NAMESPACE::LogAssert(__VA_ARGS__); \
firebase::LogAssert(__VA_ARGS__); \
} \
} while (false)

Expand Down
8 changes: 2 additions & 6 deletions app/src/callback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
#include "app/src/semaphore.h"
#include "app/src/thread.h"

#if !defined(FIREBASE_NAMESPACE)
#define FIREBASE_NAMESPACE firebase
#endif

namespace FIREBASE_NAMESPACE {
namespace firebase {
namespace callback {

class CallbackEntry;
Expand Down Expand Up @@ -339,4 +335,4 @@ void PollCallbacks() {

} // namespace callback
// NOLINTNEXTLINE - allow namespace overridden
} // namespace FIREBASE_NAMESPACE
} // namespace firebase
7 changes: 2 additions & 5 deletions app/src/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
#include <functional>
#endif

#if !defined(FIREBASE_NAMESPACE)
#define FIREBASE_NAMESPACE firebase
#endif

/// @cond FIREBASE_APP_INTERNAL

Expand All @@ -36,7 +33,7 @@

#include <string>

namespace FIREBASE_NAMESPACE {
namespace firebase {
namespace callback {

/// Initialize the Callback system.
Expand Down Expand Up @@ -397,7 +394,7 @@ void PollCallbacks();

} // namespace callback
// NOLINTNEXTLINE - allow namespace overridden
} // namespace FIREBASE_NAMESPACE
} // namespace firebase
/// @endcond

#endif // FIREBASE_APP_CLIENT_CPP_SRC_CALLBACK_H_
8 changes: 2 additions & 6 deletions app/src/cleanup_notifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@

#include <algorithm>

#if !defined(FIREBASE_NAMESPACE)
#define FIREBASE_NAMESPACE firebase
#endif

namespace FIREBASE_NAMESPACE {
namespace firebase {

Mutex *CleanupNotifier::cleanup_notifiers_by_owner_mutex_ = new Mutex();
std::map<void *, CleanupNotifier *>
Expand Down Expand Up @@ -121,4 +117,4 @@ CleanupNotifier *CleanupNotifier::FindByOwner(void *owner) {
}

// NOLINTNEXTLINE - allow namespace overridden
} // namespace FIREBASE_NAMESPACE
} // namespace firebase
8 changes: 2 additions & 6 deletions app/src/cleanup_notifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@

#include "app/src/mutex.h"

#if !defined(FIREBASE_NAMESPACE)
#define FIREBASE_NAMESPACE firebase
#endif

namespace FIREBASE_NAMESPACE {
namespace firebase {

// If an object gives out other objects that refer back to it, the original
// object can use this CleanupNotifier class to invalidate any other objects it
Expand Down Expand Up @@ -131,6 +127,6 @@ class TypedCleanupNotifier {
};

// NOLINTNEXTLINE - allow namespace overridden
} // namespace FIREBASE_NAMESPACE
} // namespace firebase

#endif // FIREBASE_APP_CLIENT_CPP_SRC_CLEANUP_NOTIFIER_H_
Loading