1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-04-19 01:04:16 +03:00

Add StatsWrapper.h generator script

Summary: Generate a wrapper around BaseStats to support custom Stats classes

Reviewed By: jerryliu55

Differential Revision: D52939343

fbshipit-source-id: ec1748efca92e7cb5972322c338bcce856451fa2
This commit is contained in:
Nathan Aclander 2024-02-06 09:09:28 -08:00 committed by Facebook GitHub Bot
parent 68e5513f86
commit e11a7d8762
3 changed files with 50 additions and 0 deletions

1
.gitignore vendored
View File

@ -19,6 +19,7 @@ gen-cpp2
/proxygen/lib/utils/TraceEventType.h
/proxygen/lib/utils/TraceFieldType.cpp
/proxygen/lib/utils/TraceFieldType.h
/proxygen/lib/stats/StatsWrapper.h
_build/
# common editor artifacts

View File

@ -27,6 +27,16 @@ add_custom_command(
COMMENT "Generating HTTPCommonHeaders.h and HTTPCommonHeaders.cpp"
)
add_custom_command(
OUTPUT ${PROXYGEN_GENERATED_ROOT}/proxygen/lib/stats/StatsWrapper.h
COMMAND
${CMAKE_CURRENT_SOURCE_DIR}/stats/gen_StatsWrapper.sh
${PROXYGEN_FBCODE_ROOT}
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/stats/BaseStats.h
COMMENT "Generating StatsWrapper.h"
)
add_custom_command(
OUTPUT
${PROXYGEN_GENERATED_ROOT}/proxygen/lib/utils/TraceEventType.h
@ -56,6 +66,7 @@ add_custom_target(
${PROXYGEN_GENERATED_ROOT}/proxygen/lib/utils/TraceEventType.cpp
${PROXYGEN_GENERATED_ROOT}/proxygen/lib/utils/TraceFieldType.h
${PROXYGEN_GENERATED_ROOT}/proxygen/lib/utils/TraceFieldType.cpp
${PROXYGEN_GENERATED_ROOT}/proxygen/lib/stats/StatsWrapper.h
)
set(

View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
set -e
if [ "x$1" != "x" ];then
OUTPUT_DIR="$1"
fi
statsWrapper=$(cat <<EOF
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <proxygen/lib/stats/BaseStats.h>
#pragma once
namespace proxygen {
using StatsWrapper = proxygen::BaseStats;
} // proxygen
EOF
)
touch "${OUTPUT_DIR?}/proxygen/lib/stats/StatsWrapper.h"
echo "$statsWrapper" > "${OUTPUT_DIR?}/proxygen/lib/stats/StatsWrapper.h"
echo "Generated StatsWrapper.h"