mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 20:14:23 +08:00
-- f73e17cb24f7878933fc100bd9bfc39fce190b64 by Derek Mauro <dmauro@google.com>: Internal change PiperOrigin-RevId: 394306402 -- 3d3eeffa4e37f63aa50fec1b90858043b40fe377 by Abseil Team <absl-team@google.com>: Release a few more absl::Cord unit tests that were accidentally omitted from the OSS release before. PiperOrigin-RevId: 394016464 -- 8a77a8eb93d021aadd8fdf43e219bf35328001ad by CJ Johnson <johnsoncj@google.com>: Fix typo in identifier PiperOrigin-RevId: 394000560 -- d87206c7c8e045b03d74b91e47ef3db0eb47a17b by Derek Mauro <dmauro@google.com>: Fix typo: RandenHwAes PiperOrigin-RevId: 393879427 -- 980a3402eea77b0c77fb20dd124203002ff791ba by Derek Mauro <dmauro@google.com>: Adds macros `ABSL_LTS_RELEASE_VERSION` and `ABSL_LTS_RELEASE_PATCH_LEVEL` to allow projects to detect if an LTS version is being used. Fixes #1006 PiperOrigin-RevId: 393807178 -- aecc7ed34de718c64733dab76621eacb5af9af5f by CJ Johnson <johnsoncj@google.com>: Change `alloc` to `allocator` to match the fact that other identifiers are full words PiperOrigin-RevId: 393794869 -- ad754bbcf7b78f5d51ed5f39193ac3159429b2b4 by Derek Mauro <dmauro@google.com>: Remove self-include of cord_rep_btree.h PiperOrigin-RevId: 393792085 -- f8e937a0d8fe26400560754f3596e3c21bb6d0d7 by Abseil Team <absl-team@google.com>: Fix trivial typo in comment. PiperOrigin-RevId: 393770527 -- 7a58ca5d708038d222c6a2b6ff5076b4ceffd370 by Tomas Dzetkulic <dzetkulic@google.com>: Update Cord::AppendArray resize policy. PiperOrigin-RevId: 393362184 -- 316050d171190d9d6312cadf88b1cc2db2d1caa7 by Abseil Team <absl-team@google.com>: Add a new top level profiling/ directory to the Abseil library PiperOrigin-RevId: 393358109 -- 0dbb8e10f7fa4a7ac74e12b178e936a67b266c51 by CJ Johnson <johnsoncj@google.com>: Switch to the more common enable_if pattern of ` = 0` in InlinedVector PiperOrigin-RevId: 393301549 -- 136d3068ce33b50ac820e8bd01395a7164d5181f by Abseil Team <absl-team@google.com>: Clean up typedefs in internal/inlined_vector.h PiperOrigin-RevId: 393181754 GitOrigin-RevId: f73e17cb24f7878933fc100bd9bfc39fce190b64 Change-Id: I0c4cd4d71d97bd1bf651701b6302ea3d9ac59b66
134 lines
4.3 KiB
Python
Executable File
134 lines
4.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
#
|
|
# Copyright 2021 The Abseil Authors.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
"""A script to do source transformations to create a new LTS release.
|
|
|
|
Usage: ./create_lts.py YYYYMMDD
|
|
"""
|
|
|
|
import sys
|
|
|
|
|
|
def ReplaceStringsInFile(filename, replacement_dict):
|
|
"""Performs textual replacements in a file.
|
|
|
|
Rewrites filename with the keys in replacement_dict replaced with
|
|
their values. This function assumes the file can fit in memory.
|
|
|
|
Args:
|
|
filename: the filename to perform the replacement on
|
|
replacement_dict: a dictionary of key strings to be replaced with their
|
|
values
|
|
|
|
Raises:
|
|
Exception: A failure occured
|
|
"""
|
|
f = open(filename, 'r')
|
|
content = f.read()
|
|
f.close()
|
|
|
|
for key, value in replacement_dict.items():
|
|
original = content
|
|
content = content.replace(key, value)
|
|
if content == original:
|
|
raise Exception('Failed to find {} in {}'.format(key, filename))
|
|
|
|
f = open(filename, 'w')
|
|
f.write(content)
|
|
f.close()
|
|
|
|
|
|
def StripContentBetweenTags(filename, strip_begin_tag, strip_end_tag):
|
|
"""Strip contents from a file.
|
|
|
|
Rewrites filename with by removing all content between
|
|
strip_begin_tag and strip_end_tag, including the tags themselves.
|
|
|
|
Args:
|
|
filename: the filename to perform the replacement on
|
|
strip_begin_tag: the start of the content to be removed
|
|
strip_end_tag: the end of the content to be removed
|
|
|
|
Raises:
|
|
Exception: A failure occured
|
|
"""
|
|
f = open(filename, 'r')
|
|
content = f.read()
|
|
f.close()
|
|
|
|
while True:
|
|
begin = content.find(strip_begin_tag)
|
|
if begin == -1:
|
|
break
|
|
end = content.find(strip_end_tag, begin + len(strip_begin_tag))
|
|
if end == -1:
|
|
raise Exception('{}: imbalanced strip begin ({}) and '
|
|
'end ({}) tags'.format(filename, strip_begin_tag,
|
|
strip_end_tag))
|
|
content = content.replace(content[begin:end + len(strip_end_tag)], '')
|
|
|
|
f = open(filename, 'w')
|
|
f.write(content)
|
|
f.close()
|
|
|
|
|
|
def main(argv):
|
|
if len(argv) != 2:
|
|
print('Usage: {} YYYYMMDD'.format(sys.argv[0], file=sys.stderr))
|
|
sys.exit(1)
|
|
|
|
datestamp = sys.argv[1]
|
|
if len(datestamp) != 8 or not datestamp.isdigit():
|
|
raise Exception(
|
|
'datestamp={} is not in the YYYYMMDD format'.format(datestamp))
|
|
|
|
# Replacement directives go here.
|
|
ReplaceStringsInFile(
|
|
'absl/base/config.h', {
|
|
'#undef ABSL_LTS_RELEASE_VERSION':
|
|
'#define ABSL_LTS_RELEASE_VERSION {}'.format(datestamp),
|
|
'#undef ABSL_LTS_RELEASE_PATCH_LEVEL':
|
|
'#define ABSL_LTS_RELEASE_PATCH_LEVEL 0'
|
|
})
|
|
ReplaceStringsInFile(
|
|
'absl/base/options.h', {
|
|
'#define ABSL_OPTION_USE_INLINE_NAMESPACE 0':
|
|
'#define ABSL_OPTION_USE_INLINE_NAMESPACE 1',
|
|
'#define ABSL_OPTION_INLINE_NAMESPACE_NAME head':
|
|
'#define ABSL_OPTION_INLINE_NAMESPACE_NAME lts_{}'.format(
|
|
datestamp)
|
|
})
|
|
ReplaceStringsInFile(
|
|
'CMakeLists.txt', {
|
|
'project(absl LANGUAGES CXX)':
|
|
'project(absl LANGUAGES CXX VERSION {})'.format(datestamp)
|
|
})
|
|
# Set the SOVERSION to YYMM.0.0 - The first 0 means we only have ABI
|
|
# compatible changes, and the second 0 means we can increment it to
|
|
# mark changes as ABI-compatible, for patch releases. Note that we
|
|
# only use the last two digits of the year and the month because the
|
|
# MacOS linker requires the first part of the SOVERSION to fit into
|
|
# 16 bits.
|
|
# https://www.sicpers.info/2013/03/how-to-version-a-mach-o-library/
|
|
ReplaceStringsInFile(
|
|
'CMake/AbseilHelpers.cmake',
|
|
{'SOVERSION 0': 'SOVERSION "{}.0.0"'.format(datestamp[2:6])})
|
|
StripContentBetweenTags('CMakeLists.txt', '# absl:lts-remove-begin',
|
|
'# absl:lts-remove-end')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main(sys.argv)
|