Skip to content

Update abseil to master@{2018-11-06} #2058

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 11 commits into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ add_external_subdirectory(benchmark)
# Abseil-cpp
# Force disable Abseil's tests, which don't compile under VS2017.
set(old_build_testing ${BUILD_TESTING})
set(BUILD_TESTING OFF CACHE BOOL "Disable Abseil tests" FORCE)
set(ABSL_RUN_TESTS OFF CACHE BOOL "Disable Abseil tests" FORCE)
add_subdirectory(
Firestore/third_party/abseil-cpp
EXCLUDE_FROM_ALL
)
set(BUILD_TESTING ${old_build_testing} CACHE BOOL "Restore BUILD_TESTING" FORCE)


# gRPC
Expand Down
12 changes: 8 additions & 4 deletions FirebaseFirestore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,

s.source_files = [
'Firestore/Source/**/*',
'Firestore/Port/**/*',
'Firestore/Protos/nanopb/**/*.{h,cc}',
'Firestore/Protos/objc/**/*.[hm]',
'Firestore/core/include/**/*.{h,cc,mm}',
Expand All @@ -37,7 +36,6 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
'Firestore/third_party/Immutable/*.[mh]'
]
s.exclude_files = [
'Firestore/Port/*test.cc',
'Firestore/third_party/Immutable/Tests/**',

# Exclude alternate implementations for other platforms
Expand Down Expand Up @@ -94,10 +92,16 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
'Firestore/third_party/abseil-cpp/**/*.cc'
]
ss.exclude_files = [
'Firestore/third_party/abseil-cpp/**/*_test.cc',
'Firestore/third_party/abseil-cpp/**/*_benchmark.cc',
'Firestore/third_party/abseil-cpp/**/*test*.cc',
'Firestore/third_party/abseil-cpp/absl/hash/internal/print_hash_of.cc',
'Firestore/third_party/abseil-cpp/absl/synchronization/internal/mutex_nonprod.cc',
]

ss.library = 'c++'
ss.compiler_flags = '$(inherited) ' + '-Wno-comma -Wno-range-loop-analysis'
ss.compiler_flags = '$(inherited) ' +
'-Wno-comma ' +
'-Wno-range-loop-analysis ' +
'-Wno-shorten-64-to-32'
end
end
17 changes: 9 additions & 8 deletions Firestore/Source/Core/FSTViewSnapshot.mm
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,15 @@ - (BOOL)hasPendingWrites {
}

- (NSString *)description {
return [NSString stringWithFormat:
@"<FSTViewSnapshot query:%@ documents:%@ oldDocument:%@ changes:%@ "
"fromCache:%@ mutatedKeys:%zd syncStateChanged:%@ "
"excludesMetadataChanges%@>",
self.query, self.documents, self.oldDocuments, self.documentChanges,
(self.fromCache ? @"YES" : @"NO"), self.mutatedKeys.size(),
(self.syncStateChanged ? @"YES" : @"NO"),
(self.excludesMetadataChanges ? @"YES" : @"NO")];
return
[NSString stringWithFormat:
@"<FSTViewSnapshot query:%@ documents:%@ oldDocument:%@ changes:%@ "
"fromCache:%@ mutatedKeys:%zu syncStateChanged:%@ "
"excludesMetadataChanges%@>",
self.query, self.documents, self.oldDocuments, self.documentChanges,
(self.fromCache ? @"YES" : @"NO"), static_cast<size_t>(self.mutatedKeys.size()),
(self.syncStateChanged ? @"YES" : @"NO"),
(self.excludesMetadataChanges ? @"YES" : @"NO")];
}

- (BOOL)isEqual:(id)object {
Expand Down
22 changes: 22 additions & 0 deletions Firestore/third_party/abseil-cpp/ABSEIL_ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Please submit a new Abseil Issue using the template below:

## [Short title of proposed API change(s)]

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

## Background

[Provide the background information that is required in order to evaluate the
proposed API changes. No controversial claims should be made here. If there are
design constraints that need to be considered, they should be presented here
**along with justification for those constraints**. Linking to other docs is
good, but please keep the **pertinent information as self contained** as
possible in this section.]

## Proposed API Change (s)

[Please clearly describe the API change(s) being proposed. If multiple changes,
please keep them clearly distinguished. When possible, **use example code
snippets to illustrate before-after API usages**. List pros-n-cons. Highlight
the main questions that you want to be answered. Given the Abseil project compatibility requirements, describe why the API change is safe.]
6 changes: 6 additions & 0 deletions Firestore/third_party/abseil-cpp/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This is the list of Abseil authors for copyright purposes.
#
# This does not necessarily list everyone who has contributed code, since in
# some cases, their employer may be the copyright holder. To see the full list
# of contributors, see the revision history in source control.
Google Inc.
129 changes: 122 additions & 7 deletions Firestore/third_party/abseil-cpp/CMake/AbseilHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

include(CMakeParseArguments)

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

#
# create a library in the absl namespace
Expand All @@ -34,7 +39,7 @@ function(absl_library)
cmake_parse_arguments(ABSL_LIB
"DISABLE_INSTALL" # keep that in case we want to support installation one day
"TARGET;EXPORT_NAME"
"SOURCES;PUBLIC_LIBRARIES;PRIVATE_COMPILE_FLAGS;PUBLIC_INCLUDE_DIRS;PRIVATE_INCLUDE_DIRS"
"SOURCES;PUBLIC_LIBRARIES;PRIVATE_COMPILE_FLAGS"
${ARGN}
)

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

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

target_compile_options(${_NAME} PRIVATE ${ABSL_COMPILE_CXXFLAGS} ${ABSL_LIB_PRIVATE_COMPILE_FLAGS})
target_compile_options(${_NAME} PRIVATE ${ABSL_LIB_PRIVATE_COMPILE_FLAGS})
target_link_libraries(${_NAME} PUBLIC ${ABSL_LIB_PUBLIC_LIBRARIES})
target_include_directories(${_NAME}
PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} ${ABSL_LIB_PUBLIC_INCLUDE_DIRS}
PRIVATE ${ABSL_LIB_PRIVATE_INCLUDE_DIRS}
)
# Add all Abseil targets to a a folder in the IDE for organization.
set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER})

if(ABSL_LIB_EXPORT_NAME)
add_library(absl::${ABSL_LIB_EXPORT_NAME} ALIAS ${_NAME})
endif()
endfunction()

#
# CMake function to imitate Bazel's cc_library rule.
#
# Parameters:
# NAME: name of target (see Note)
# HDRS: List of public header files for the library
# SRCS: List of source files for the library
# DEPS: List of other libraries to be linked in to the binary targets
# COPTS: List of private compile options
# DEFINES: List of public defines
# LINKOPTS: List of link options
# PUBLIC: Add this so that this library will be exported under absl:: (see Note).
# TESTONLY: When added, this target will only be built if user passes -DABSL_RUN_TESTS=ON to CMake.
#
# Note:
#
# By default, absl_cc_library will always create a library named absl_internal_${NAME},
# which means other targets can only depend this library as absl_internal_${NAME}, not ${NAME}.
# This is to reduce namespace pollution.
#
# absl_cc_library(
# NAME
# awesome_lib
# HDRS
# "a.h"
# SRCS
# "a.cc"
# )
# absl_cc_library(
# NAME
# fantastic_lib
# SRCS
# "b.cc"
# DEPS
# absl_internal_awesome_lib # not "awesome_lib"!
# )
#
# If PUBLIC is set, absl_cc_library will instead create a target named
# absl_${NAME} and an alias absl::${NAME}.
#
# absl_cc_library(
# NAME
# main_lib
# ...
# PUBLIC
# )
#
# User can then use the library as absl::main_lib (although absl_main_lib is defined too).
#
# TODO: Implement "ALWAYSLINK"

function(absl_cc_library)
cmake_parse_arguments(ABSL_CC_LIB
"DISABLE_INSTALL;PUBLIC;TESTONLY"
"NAME"
"HDRS;SRCS;COPTS;DEFINES;LINKOPTS;DEPS"
${ARGN}
)

if (NOT ABSL_CC_LIB_TESTONLY OR ABSL_RUN_TESTS)
if (ABSL_CC_LIB_PUBLIC)
set(_NAME "absl_${ABSL_CC_LIB_NAME}")
else()
set(_NAME "absl_internal_${ABSL_CC_LIB_NAME}")
endif()

# Check if this is a header-only library
if ("${ABSL_CC_LIB_SRCS}" STREQUAL "")
set(ABSL_CC_LIB_IS_INTERFACE 1)
else()
set(ABSL_CC_LIB_IS_INTERFACE 0)
endif()

if(NOT ABSL_CC_LIB_IS_INTERFACE)
add_library(${_NAME} STATIC "")
target_sources(${_NAME} PRIVATE ${ABSL_CC_LIB_SRCS} ${ABSL_CC_LIB_HDRS})
target_include_directories(${_NAME}
PUBLIC ${ABSL_COMMON_INCLUDE_DIRS})
target_compile_options(${_NAME}
PRIVATE ${ABSL_CC_LIB_COPTS})
target_link_libraries(${_NAME}
PUBLIC ${ABSL_CC_LIB_DEPS}
PRIVATE ${ABSL_CC_LIB_LINKOPTS}
)
target_compile_definitions(${_NAME} PUBLIC ${ABSL_CC_LIB_DEFINES})

# Add all Abseil targets to a a folder in the IDE for organization.
set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER})
else()
# Generating header-only library
add_library(${_NAME} INTERFACE)
target_include_directories(${_NAME} INTERFACE ${ABSL_COMMON_INCLUDE_DIRS})
target_link_libraries(${_NAME}
INTERFACE ${ABSL_CC_LIB_DEPS} ${ABSL_CC_LIB_LINKOPTS}
)
target_compile_definitions(${_NAME} INTERFACE ${ABSL_CC_LIB_DEFINES})
endif()

if(ABSL_CC_LIB_PUBLIC)
add_library(absl::${ABSL_CC_LIB_NAME} ALIAS ${_NAME})
endif()
endif()
endfunction()

#
# header only virtual target creation
Expand Down Expand Up @@ -93,6 +202,9 @@ function(absl_header_library)
PRIVATE ${ABSL_HO_LIB_PRIVATE_INCLUDE_DIRS}
)

# Add all Abseil targets to a a folder in the IDE for organization.
set_property(TARGET ${_NAME} PROPERTY FOLDER ${ABSL_IDE_FOLDER})

if(ABSL_HO_LIB_EXPORT_NAME)
add_library(absl::${ABSL_HO_LIB_EXPORT_NAME} ALIAS ${_NAME})
endif()
Expand All @@ -113,7 +225,7 @@ endfunction()
#
# all tests will be register for execution with add_test()
#
# test compilation and execution is disable when BUILD_TESTING=OFF
# test compilation and execution is disable when ABSL_RUN_TESTS=OFF
#
function(absl_test)

Expand All @@ -125,22 +237,25 @@ function(absl_test)
)


if(BUILD_TESTING)
if(ABSL_RUN_TESTS)

set(_NAME ${ABSL_TEST_TARGET})
string(TOUPPER ${_NAME} _UPPER_NAME)

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

target_compile_options(${_NAME}_bin PRIVATE ${ABSL_COMPILE_CXXFLAGS} ${ABSL_TEST_PRIVATE_COMPILE_FLAGS})
target_compile_options(${_NAME}_bin PRIVATE ${ABSL_TEST_PRIVATE_COMPILE_FLAGS})
target_link_libraries(${_NAME}_bin PUBLIC ${ABSL_TEST_PUBLIC_LIBRARIES} ${ABSL_TEST_COMMON_LIBRARIES})
target_include_directories(${_NAME}_bin
PUBLIC ${ABSL_COMMON_INCLUDE_DIRS} ${ABSL_TEST_PUBLIC_INCLUDE_DIRS}
PRIVATE ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
)

add_test(${_NAME}_test ${_NAME}_bin)
endif(BUILD_TESTING)
# Add all Abseil targets to a a folder in the IDE for organization.
set_property(TARGET ${_NAME}_bin PROPERTY FOLDER ${ABSL_IDE_FOLDER})

add_test(${_NAME} ${_NAME}_bin)
endif(ABSL_RUN_TESTS)

endfunction()

Expand Down
15 changes: 15 additions & 0 deletions Firestore/third_party/abseil-cpp/CMake/CMakeLists.txt.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 2.8.2)

project(googletest-download NONE)

include(ExternalProject)
ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
32 changes: 32 additions & 0 deletions Firestore/third_party/abseil-cpp/CMake/DownloadGTest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Downloads and unpacks googletest at configure time. Based on the instructions
# at https://github.com/google/googletest/tree/master/googletest#incorporating-into-an-existing-cmake-project

# Download the latest googletest from Github master
configure_file(
${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in
googletest-download/CMakeLists.txt
)

# Configure and build the downloaded googletest source
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
if(result)
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
endif()

execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download)
if(result)
message(FATAL_ERROR "Build step for googletest failed: ${result}")
endif()

# Prevent overriding the parent project's compiler/linker settings on Windows
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)

# Add googletest directly to our build. This defines the gtest and gtest_main
# targets.
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
${CMAKE_BINARY_DIR}/googletest-build
EXCLUDE_FROM_ALL)
Loading