Skip to content

Commit f250f50

Browse files
authored
Update abseil to master@{2018-11-06} (#2058)
* Update abseil-cpp to a new upstream Update to 7990fd459e9339467814ddb95000c87cb1e4d945 master@{2018-11-06} * Re-apply -Wcomma fix * Update add_subdirectory for Abseil * Remove references to Firestore/Port (which longer exists) * Fix ABSL_HAVE_THREAD_LOCAL when targeting iOS 8 in Xcode 10 * Clean up abseil warnings * Clean up a Firestore format string warning. * Exclude third_party/abseil-cpp from whitespace checks
1 parent c2fd8d1 commit f250f50

File tree

996 files changed

+102223
-674
lines changed

Some content is hidden

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

996 files changed

+102223
-674
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ add_external_subdirectory(benchmark)
8181
# Abseil-cpp
8282
# Force disable Abseil's tests, which don't compile under VS2017.
8383
set(old_build_testing ${BUILD_TESTING})
84-
set(BUILD_TESTING OFF CACHE BOOL "Disable Abseil tests" FORCE)
84+
set(ABSL_RUN_TESTS OFF CACHE BOOL "Disable Abseil tests" FORCE)
8585
add_subdirectory(
8686
Firestore/third_party/abseil-cpp
87+
EXCLUDE_FROM_ALL
8788
)
88-
set(BUILD_TESTING ${old_build_testing} CACHE BOOL "Restore BUILD_TESTING" FORCE)
8989

9090

9191
# gRPC

FirebaseFirestore.podspec

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
2424

2525
s.source_files = [
2626
'Firestore/Source/**/*',
27-
'Firestore/Port/**/*',
2827
'Firestore/Protos/nanopb/**/*.{h,cc}',
2928
'Firestore/Protos/objc/**/*.[hm]',
3029
'Firestore/core/include/**/*.{h,cc,mm}',
@@ -37,7 +36,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
3736
'Firestore/third_party/Immutable/*.[mh]'
3837
]
3938
s.exclude_files = [
40-
'Firestore/Port/*test.cc',
4139
'Firestore/third_party/Immutable/Tests/**',
4240

4341
# Exclude alternate implementations for other platforms
@@ -94,10 +92,16 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
9492
'Firestore/third_party/abseil-cpp/**/*.cc'
9593
]
9694
ss.exclude_files = [
97-
'Firestore/third_party/abseil-cpp/**/*_test.cc',
95+
'Firestore/third_party/abseil-cpp/**/*_benchmark.cc',
96+
'Firestore/third_party/abseil-cpp/**/*test*.cc',
97+
'Firestore/third_party/abseil-cpp/absl/hash/internal/print_hash_of.cc',
98+
'Firestore/third_party/abseil-cpp/absl/synchronization/internal/mutex_nonprod.cc',
9899
]
99100

100101
ss.library = 'c++'
101-
ss.compiler_flags = '$(inherited) ' + '-Wno-comma -Wno-range-loop-analysis'
102+
ss.compiler_flags = '$(inherited) ' +
103+
'-Wno-comma ' +
104+
'-Wno-range-loop-analysis ' +
105+
'-Wno-shorten-64-to-32'
102106
end
103107
end

Firestore/Source/Core/FSTViewSnapshot.mm

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,15 @@ - (BOOL)hasPendingWrites {
222222
}
223223

224224
- (NSString *)description {
225-
return [NSString stringWithFormat:
226-
@"<FSTViewSnapshot query:%@ documents:%@ oldDocument:%@ changes:%@ "
227-
"fromCache:%@ mutatedKeys:%zd syncStateChanged:%@ "
228-
"excludesMetadataChanges%@>",
229-
self.query, self.documents, self.oldDocuments, self.documentChanges,
230-
(self.fromCache ? @"YES" : @"NO"), self.mutatedKeys.size(),
231-
(self.syncStateChanged ? @"YES" : @"NO"),
232-
(self.excludesMetadataChanges ? @"YES" : @"NO")];
225+
return
226+
[NSString stringWithFormat:
227+
@"<FSTViewSnapshot query:%@ documents:%@ oldDocument:%@ changes:%@ "
228+
"fromCache:%@ mutatedKeys:%zu syncStateChanged:%@ "
229+
"excludesMetadataChanges%@>",
230+
self.query, self.documents, self.oldDocuments, self.documentChanges,
231+
(self.fromCache ? @"YES" : @"NO"), static_cast<size_t>(self.mutatedKeys.size()),
232+
(self.syncStateChanged ? @"YES" : @"NO"),
233+
(self.excludesMetadataChanges ? @"YES" : @"NO")];
233234
}
234235

235236
- (BOOL)isEqual:(id)object {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Please submit a new Abseil Issue using the template below:
2+
3+
## [Short title of proposed API change(s)]
4+
5+
--------------------------------------------------------------------------------
6+
--------------------------------------------------------------------------------
7+
8+
## Background
9+
10+
[Provide the background information that is required in order to evaluate the
11+
proposed API changes. No controversial claims should be made here. If there are
12+
design constraints that need to be considered, they should be presented here
13+
**along with justification for those constraints**. Linking to other docs is
14+
good, but please keep the **pertinent information as self contained** as
15+
possible in this section.]
16+
17+
## Proposed API Change (s)
18+
19+
[Please clearly describe the API change(s) being proposed. If multiple changes,
20+
please keep them clearly distinguished. When possible, **use example code
21+
snippets to illustrate before-after API usages**. List pros-n-cons. Highlight
22+
the main questions that you want to be answered. Given the Abseil project compatibility requirements, describe why the API change is safe.]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This is the list of Abseil authors for copyright purposes.
2+
#
3+
# This does not necessarily list everyone who has contributed code, since in
4+
# some cases, their employer may be the copyright holder. To see the full list
5+
# of contributors, see the revision history in source control.
6+
Google Inc.

Firestore/third_party/abseil-cpp/CMake/AbseilHelpers.cmake

Lines changed: 122 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
include(CMakeParseArguments)
1818

19+
# The IDE folder for Abseil that will be used if Abseil is included in a CMake
20+
# project that sets
21+
# set_property(GLOBAL PROPERTY USE_FOLDERS ON)
22+
# For example, Visual Studio supports folders.
23+
set(ABSL_IDE_FOLDER Abseil)
1924

2025
#
2126
# create a library in the absl namespace
@@ -34,7 +39,7 @@ function(absl_library)
3439
cmake_parse_arguments(ABSL_LIB
3540
"DISABLE_INSTALL" # keep that in case we want to support installation one day
3641
"TARGET;EXPORT_NAME"
37-
"SOURCES;PUBLIC_LIBRARIES;PRIVATE_COMPILE_FLAGS;PUBLIC_INCLUDE_DIRS;PRIVATE_INCLUDE_DIRS"
42+
"SOURCES;PUBLIC_LIBRARIES;PRIVATE_COMPILE_FLAGS"
3843
${ARGN}
3944
)
4045

@@ -43,19 +48,123 @@ function(absl_library)
4348

4449
add_library(${_NAME} STATIC ${ABSL_LIB_SOURCES})
4550

46-
target_compile_options(${_NAME} PRIVATE ${ABSL_COMPILE_CXXFLAGS} ${ABSL_LIB_PRIVATE_COMPILE_FLAGS})
51+
target_compile_options(${_NAME} PRIVATE ${ABSL_LIB_PRIVATE_COMPILE_FLAGS})
4752
target_link_libraries(${_NAME} PUBLIC ${ABSL_LIB_PUBLIC_LIBRARIES})
4853
target_include_directories(${_NAME}
4954
PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} ${ABSL_LIB_PUBLIC_INCLUDE_DIRS}
5055
PRIVATE ${ABSL_LIB_PRIVATE_INCLUDE_DIRS}
5156
)
57+
# Add all Abseil targets to a a folder in the IDE for organization.
58+
set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER})
5259

5360
if(ABSL_LIB_EXPORT_NAME)
5461
add_library(absl::${ABSL_LIB_EXPORT_NAME} ALIAS ${_NAME})
5562
endif()
5663
endfunction()
5764

65+
#
66+
# CMake function to imitate Bazel's cc_library rule.
67+
#
68+
# Parameters:
69+
# NAME: name of target (see Note)
70+
# HDRS: List of public header files for the library
71+
# SRCS: List of source files for the library
72+
# DEPS: List of other libraries to be linked in to the binary targets
73+
# COPTS: List of private compile options
74+
# DEFINES: List of public defines
75+
# LINKOPTS: List of link options
76+
# PUBLIC: Add this so that this library will be exported under absl:: (see Note).
77+
# TESTONLY: When added, this target will only be built if user passes -DABSL_RUN_TESTS=ON to CMake.
78+
#
79+
# Note:
80+
#
81+
# By default, absl_cc_library will always create a library named absl_internal_${NAME},
82+
# which means other targets can only depend this library as absl_internal_${NAME}, not ${NAME}.
83+
# This is to reduce namespace pollution.
84+
#
85+
# absl_cc_library(
86+
# NAME
87+
# awesome_lib
88+
# HDRS
89+
# "a.h"
90+
# SRCS
91+
# "a.cc"
92+
# )
93+
# absl_cc_library(
94+
# NAME
95+
# fantastic_lib
96+
# SRCS
97+
# "b.cc"
98+
# DEPS
99+
# absl_internal_awesome_lib # not "awesome_lib"!
100+
# )
101+
#
102+
# If PUBLIC is set, absl_cc_library will instead create a target named
103+
# absl_${NAME} and an alias absl::${NAME}.
104+
#
105+
# absl_cc_library(
106+
# NAME
107+
# main_lib
108+
# ...
109+
# PUBLIC
110+
# )
111+
#
112+
# User can then use the library as absl::main_lib (although absl_main_lib is defined too).
113+
#
114+
# TODO: Implement "ALWAYSLINK"
115+
116+
function(absl_cc_library)
117+
cmake_parse_arguments(ABSL_CC_LIB
118+
"DISABLE_INSTALL;PUBLIC;TESTONLY"
119+
"NAME"
120+
"HDRS;SRCS;COPTS;DEFINES;LINKOPTS;DEPS"
121+
${ARGN}
122+
)
58123

124+
if (NOT ABSL_CC_LIB_TESTONLY OR ABSL_RUN_TESTS)
125+
if (ABSL_CC_LIB_PUBLIC)
126+
set(_NAME "absl_${ABSL_CC_LIB_NAME}")
127+
else()
128+
set(_NAME "absl_internal_${ABSL_CC_LIB_NAME}")
129+
endif()
130+
131+
# Check if this is a header-only library
132+
if ("${ABSL_CC_LIB_SRCS}" STREQUAL "")
133+
set(ABSL_CC_LIB_IS_INTERFACE 1)
134+
else()
135+
set(ABSL_CC_LIB_IS_INTERFACE 0)
136+
endif()
137+
138+
if(NOT ABSL_CC_LIB_IS_INTERFACE)
139+
add_library(${_NAME} STATIC "")
140+
target_sources(${_NAME} PRIVATE ${ABSL_CC_LIB_SRCS} ${ABSL_CC_LIB_HDRS})
141+
target_include_directories(${_NAME}
142+
PUBLIC ${ABSL_COMMON_INCLUDE_DIRS})
143+
target_compile_options(${_NAME}
144+
PRIVATE ${ABSL_CC_LIB_COPTS})
145+
target_link_libraries(${_NAME}
146+
PUBLIC ${ABSL_CC_LIB_DEPS}
147+
PRIVATE ${ABSL_CC_LIB_LINKOPTS}
148+
)
149+
target_compile_definitions(${_NAME} PUBLIC ${ABSL_CC_LIB_DEFINES})
150+
151+
# Add all Abseil targets to a a folder in the IDE for organization.
152+
set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER})
153+
else()
154+
# Generating header-only library
155+
add_library(${_NAME} INTERFACE)
156+
target_include_directories(${_NAME} INTERFACE ${ABSL_COMMON_INCLUDE_DIRS})
157+
target_link_libraries(${_NAME}
158+
INTERFACE ${ABSL_CC_LIB_DEPS} ${ABSL_CC_LIB_LINKOPTS}
159+
)
160+
target_compile_definitions(${_NAME} INTERFACE ${ABSL_CC_LIB_DEFINES})
161+
endif()
162+
163+
if(ABSL_CC_LIB_PUBLIC)
164+
add_library(absl::${ABSL_CC_LIB_NAME} ALIAS ${_NAME})
165+
endif()
166+
endif()
167+
endfunction()
59168

60169
#
61170
# header only virtual target creation
@@ -93,6 +202,9 @@ function(absl_header_library)
93202
PRIVATE ${ABSL_HO_LIB_PRIVATE_INCLUDE_DIRS}
94203
)
95204

205+
# Add all Abseil targets to a a folder in the IDE for organization.
206+
set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER})
207+
96208
if(ABSL_HO_LIB_EXPORT_NAME)
97209
add_library(absl::${ABSL_HO_LIB_EXPORT_NAME} ALIAS ${_NAME})
98210
endif()
@@ -113,7 +225,7 @@ endfunction()
113225
#
114226
# all tests will be register for execution with add_test()
115227
#
116-
# test compilation and execution is disable when BUILD_TESTING=OFF
228+
# test compilation and execution is disable when ABSL_RUN_TESTS=OFF
117229
#
118230
function(absl_test)
119231

@@ -125,22 +237,25 @@ function(absl_test)
125237
)
126238

127239

128-
if(BUILD_TESTING)
240+
if(ABSL_RUN_TESTS)
129241

130242
set(_NAME ${ABSL_TEST_TARGET})
131243
string(TOUPPER ${_NAME} _UPPER_NAME)
132244

133245
add_executable(${_NAME}_bin ${ABSL_TEST_SOURCES})
134246

135-
target_compile_options(${_NAME}_bin PRIVATE ${ABSL_COMPILE_CXXFLAGS} ${ABSL_TEST_PRIVATE_COMPILE_FLAGS})
247+
target_compile_options(${_NAME}_bin PRIVATE ${ABSL_TEST_PRIVATE_COMPILE_FLAGS})
136248
target_link_libraries(${_NAME}_bin PUBLIC ${ABSL_TEST_PUBLIC_LIBRARIES} ${ABSL_TEST_COMMON_LIBRARIES})
137249
target_include_directories(${_NAME}_bin
138250
PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} ${ABSL_TEST_PUBLIC_INCLUDE_DIRS}
139251
PRIVATE ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
140252
)
141253

142-
add_test(${_NAME}_test ${_NAME}_bin)
143-
endif(BUILD_TESTING)
254+
# Add all Abseil targets to a a folder in the IDE for organization.
255+
set_property(TARGET ${_NAME}_bin PROPERTY FOLDER ${ABSL_IDE_FOLDER})
256+
257+
add_test(${_NAME} ${_NAME}_bin)
258+
endif(ABSL_RUN_TESTS)
144259

145260
endfunction()
146261

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
cmake_minimum_required(VERSION 2.8.2)
2+
3+
project(googletest-download NONE)
4+
5+
include(ExternalProject)
6+
ExternalProject_Add(googletest
7+
GIT_REPOSITORY https://github.com/google/googletest.git
8+
GIT_TAG master
9+
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
10+
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
11+
CONFIGURE_COMMAND ""
12+
BUILD_COMMAND ""
13+
INSTALL_COMMAND ""
14+
TEST_COMMAND ""
15+
)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Downloads and unpacks googletest at configure time. Based on the instructions
2+
# at https://github.com/google/googletest/tree/master/googletest#incorporating-into-an-existing-cmake-project
3+
4+
# Download the latest googletest from Github master
5+
configure_file(
6+
${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in
7+
googletest-download/CMakeLists.txt
8+
)
9+
10+
# Configure and build the downloaded googletest source
11+
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
12+
RESULT_VARIABLE result
13+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
14+
if(result)
15+
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
16+
endif()
17+
18+
execute_process(COMMAND ${CMAKE_COMMAND} --build .
19+
RESULT_VARIABLE result
20+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download)
21+
if(result)
22+
message(FATAL_ERROR "Build step for googletest failed: ${result}")
23+
endif()
24+
25+
# Prevent overriding the parent project's compiler/linker settings on Windows
26+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
27+
28+
# Add googletest directly to our build. This defines the gtest and gtest_main
29+
# targets.
30+
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
31+
${CMAKE_BINARY_DIR}/googletest-build
32+
EXCLUDE_FROM_ALL)

0 commit comments

Comments
 (0)